-3

I have trained my yolov8 model and now i have best.pt file to predict the object. But i want that when i will give the image to my model then it only crop the bounding boxes of Person Class not cars and helmets bouding boxes. Please help me

model = YOLO('models/best.pt')

# Predict on frames
results = model.predict(frames[0])
print(results)

#classes = results[0].cls[0]

But this doesnot work

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0
results = model.predict(frames[0], classes=0)

Use the 'classes' argument to filter results by class. Store here the class IDs you want to detect. For example, if you want to detect only the Person class and it has the id '0', assign classes=0, for more than one value use list: classes=[0,1,2]

hanna_liavoshka
  • 115
  • 1
  • 6