Fix keypoints.conf update Results docs (#2977)

This commit is contained in:
Laughing
2023-06-05 04:33:17 +08:00
committed by GitHub
parent a9129fb40e
commit bb5bbc2893
3 changed files with 35 additions and 13 deletions

View File

@ -138,7 +138,8 @@ The `Results` object contains the following components:
- `Results.boxes`: `Boxes` object with properties and methods for manipulating bounding boxes
- `Results.masks`: `Masks` object for indexing masks or getting segment coordinates
- `Results.probs`: `torch.Tensor` containing class probabilities or logits
- `Results.keypoints`: `Keypoints` object for with properties and methods for manipulating predicted keypoints.
- `Results.probs`: `Probs` object for containing class probabilities.
- `Results.orig_img`: Original image loaded in memory
- `Results.path`: `Path` containing the path to the input image
@ -178,8 +179,8 @@ operations are cached, meaning they're only calculated once per object, and thos
boxes.xywh # box with xywh format, (N, 4)
boxes.xyxyn # box with xyxy format but normalized, (N, 4)
boxes.xywhn # box with xywh format but normalized, (N, 4)
boxes.conf # confidence score, (N, 1)
boxes.cls # cls, (N, 1)
boxes.conf # confidence score, (N, )
boxes.cls # cls, (N, )
boxes.data # raw bboxes tensor, (N, 6) or boxes.boxes
```
@ -197,15 +198,35 @@ operations are cached, meaning they're only calculated once per object, and thos
masks.data # raw masks tensor, (N, H, W) or masks.masks
```
### Keypoints
`Keypoints` object can be used index, manipulate and normalize coordinates. The keypoint conversion operation is cached.
!!! example "Keypoints"
```python
results = model(inputs)
keypoints = results[0].keypoints # Masks object
keypoints.xy # x, y keypoints (pixels), (num_dets, num_kpts, 2/3), the last dimension can be 2 or 3, depends the model.
keypoints.xyn # x, y keypoints (normalized), (num_dets, num_kpts, 2/3)
keypoints.conf # confidence score(num_dets, num_kpts) of each keypoint if the last dimension is 3.
keypoints.data # raw keypoints tensor, (num_dets, num_kpts, 2/3)
```
### probs
`probs` attribute of `Results` class is a `Tensor` containing class probabilities of a classification operation.
`Probs` object can be used index, get top1&top5 indices and scores of classification.
!!! example "Probs"
```python
results = model(inputs)
results[0].probs # cls prob, (num_class, )
probs = results[0].probs # cls prob, (num_class, )
probs.top5 # The top5 indices of classification, List[Int] * 5.
probs.top1 # The top1 indices of classification, a value with Int type.
probs.top5conf # The top5 scores of classification, a tensor with shape (5, ).
probs.top1conf # The top1 scores of classification. a value with torch.tensor type.
keypoints.data # raw probs tensor, (num_class, )
```
Class reference documentation for `Results` module and its components can be found [here](../reference/yolo/engine/results.md)
@ -213,7 +234,7 @@ Class reference documentation for `Results` module and its components can be fou
## Plotting results
You can use `plot()` function of `Result` object to plot results on in image object. It plots all components(boxes,
masks, classification logits, etc.) found in the results object
masks, classification probabilities, etc.) found in the results object
!!! example "Plotting"