ibaiGorordo / ONNX-YOLOv8-Object-Detection

Python scripts performing object detection using the YOLOv8 model in ONNX.
MIT License
393 stars 101 forks source link

How to do detection in only selected classes , not all my classes #7

Closed VYRION-Ai closed 1 year ago

VYRION-Ai commented 1 year ago

How to do detection in only selected classes , not all my classes

Tamminhdiep97 commented 1 year ago

I do a little trick like this in yolov8/utils.py image cls_id = 0 is for human only

well, i don't really know anyway other than this, i know that this trick is only work on display on image, the network will still detecting all the classes, so anyone know the proper answer please delight us.

VYRION-Ai commented 1 year ago

@Tamminhdiep97 as you said , just doing filter like this at top class_filter=[0,1,2,3,4,5,6,7]

`    for box, score, class_id in zip(boxes, scores, class_ids):

      if class_id in class_filter:`
ibaiGorordo commented 1 year ago

Thanks!