rampal-punia / yolov8-streamlit-detection-tracking

Object detection and tracking algorithm implemented for Real-Time video streams and static images.
https://codingmantras-yolov8-streamlit-detection-tracking-app-njcqjg.streamlit.app/
279 stars 119 forks source link

how to detect spesific class #14

Closed Mirshal closed 2 months ago

Mirshal commented 2 months ago

can you help me in finding a way how the model only detects one object class, namely person. I am very grateful if you can provide instructions

rampal-punia commented 2 months ago

Hi, Mirshal.

In Yolo you can set model.classes to the list which you want to detect specifically. The person class index is 0. So if you pass model.classes as [0] then it will detect only the person class.

Alternatively you can pass the classes keyword argument with [0] here. Like this

model.predict("bus.jpg", classes=[0], conf=0.5)