ultralytics 8.0.40 TensorRT metadata and Results visualizer (#1014)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: Bogdan Gheorghe <112427971+bogdan-galileo@users.noreply.github.com>
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
Co-authored-by: Jaap van de Loosdrecht <jaap@vdlmv.nl>
Co-authored-by: Noobtoss <96134731+Noobtoss@users.noreply.github.com>
Co-authored-by: nerdyespresso <106761627+nerdyespresso@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-02-17 20:06:06 +01:00 committed by GitHub
parent e799592718
commit 9047d737f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 576 additions and 280 deletions

View file

@ -34,7 +34,8 @@ Results object consists of these component objects:
- `Results.boxes` : `Boxes` object with properties and methods for manipulating bboxes
- `Results.masks` : `Masks` object used to index masks or to get segment coordinates.
- `Results.prob` : `torch.Tensor` containing the class probabilities/logits.
- `Results.probs` : `torch.Tensor` containing the class probabilities/logits.
- `Results.orig_shape` : `tuple` containing the original image size as (height, width).
Each result is composed of torch.Tensor by default, in which you can easily use following functionality:
@ -92,3 +93,19 @@ results[0].probs # cls prob, (num_class, )
```
Class reference documentation for `Results` module and its components can be found [here](reference/results.md)
## Visualizing results
You can use `visualize()` function of `Result` object to get a visualization. It plots all componenets(boxes, masks, classification logits, etc) found in the results object
```python
res = model(img)
res_plotted = res[0].visualize()
cv2.imshow("result", res_plotted)
```
!!! example "`visualize()` arguments"
`show_conf (bool)`: Show confidence
`line_width (Float)`: The line width of boxes. Automatically scaled to img size if not provided
`font_size (Float)`: The font size of . Automatically scaled to img size if not provided