How to turn off detections of some objects ? #2463
jardaoravec
started this conversation in
General
Replies: 2 comments 4 replies
-
|
@jardaoravec yes you can opt-in to the classes you want to detect by passing a classes list: python detect.py --weights yolov5s.pt --classes 0 2 # detect only persons and carsor with YOLOv5 PyTorch Hub models: import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
model.classes = [0, 2] # detect only persons and cars
# Images
dir = 'https://github.com/ultralytics/yolov5/raw/master/data/images/'
imgs = [dir + f for f in ('zidane.jpg', 'bus.jpg')] # batch of images
# Inference
results = model(imgs)
results.print() # or .show(), .save() |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
@glenn-jocher Hi. How to disable YOLOv5 model from detecting certain objects, if i trained my own model using yolov5. Is it possible to do so? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can I ask one more question about turning off detections for some of objects ? I noticed this Yolo is detecting really everything, things like keyboards or cups is it possible to turn some of them off somewhere in code ?
Beta Was this translation helpful? Give feedback.
All reactions