Skip to content

Commit

Permalink
added instructions for extracting bounding boxes (#1312)
Browse files Browse the repository at this point in the history
* added instructions for extracting bounding boxes

* Update YOLONAS.md

removed the redundant instructions and used the improved (more readable) code as suggested

* Update YOLONAS.md

minor changes

* Update YOLONAS.md

Added missing lines

* rollback `import super_gradients` in the example

* Change title level

* change title level

---------

Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com>
  • Loading branch information
AkashParua and Louis-Dupont committed Aug 20, 2023
1 parent 6f0a66f commit d822731
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion YOLONAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ YOLO-NAS's architecture employs quantization-aware blocks and selective quantiza

## Quickstart

### Extract bounding boxes
```python
import super_gradients

yolo_nas = super_gradients.training.models.get("yolo_nas_l", pretrained_weights="coco").cuda()
yolo_nas.predict("https://deci-pretrained-models.s3.amazonaws.com/sample_images/beatles-abbeyroad.jpg").show()
model_predictions = yolo_nas.predict("https://deci-pretrained-models.s3.amazonaws.com/sample_images/beatles-abbeyroad.jpg").show()

prediction = model_predictions[0].prediction # One prediction per image - Here we work with 1 image so we get the first.

bboxes = prediction.bboxes_xyxy # [[Xmin,Ymin,Xmax,Ymax],..] list of all annotation(s) for detected object(s)
bboxes = prediction.bboxes_xyxy # [[Xmin,Ymin,Xmax,Ymax],..] list of all annotation(s) for detected object(s)
class_names = prediction.class_names. # ['Class1', 'Class2', ...] List of the class names
class_name_indexes = prediction.labels.astype(int) # [2, 3, 1, 1, 2, ....] Index of each detected object in class_names(corresponding to each bounding box)
confidences = prediction.confidence.astype(float) # [0.3, 0.1, 0.9, ...] Confidence value(s) in float for each bounding boxes
```

![YOLO-NAS Predict Demo](documentation/source/images/yolo_nas_predict_demo.png)
Expand Down

0 comments on commit d822731

Please sign in to comment.