ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.24k stars 16.21k forks source link

Does yolov5 have some way to detect single type object? #726

Closed abczww closed 4 years ago

abczww commented 4 years ago

❔Question

I am using yolov5 to detect objects by webcam, yolov5 could detect so many type objects, but I don't care about most type of them, I just need single type, like: person. I think if yolov5 just detect single type object it should work faster. But I didn't find a way to impleent this requirement. I have to add some extra codes to filter the result to get all persons which means the project became slower theoretically.

In a nutshell, I want to yolov model have many types and could detect all types objects, and it should could detect some specified type objects or single type object either. e.g.: I trained many types in model including: 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light' But I just want to detect 'person', 'bicycle', Or just 'person',

Additional context

github-actions[bot] commented 4 years ago

Hello @abczww, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

glenn-jocher commented 4 years ago

@abczww detect.py can filter detections by class: https://github.com/ultralytics/yolov5/blob/1ddf692bf89ac47d5e2dc8333cd0f4f145bb7f61/detect.py#L160

To detect only people in images: python detect.py --classes 0

jomdolalas commented 4 years ago

@abczww Hi! Would like to know how you were able to use your webcam as the input? The code !python detect.py --source 0 does not work for me. I am using a laptop with a webcam installed. Do I need to use an external one?

Frank1126lin commented 4 years ago

@abczww Hi! Would like to know how you were able to use your webcam as the input? The code !python detect.py --source 0 does not work for me. I am using a laptop with a webcam installed. Do I need to use an external one?

@jomdolalas just use --source 0 or --source 1 etc is ok.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

TuyenSD commented 2 years ago

i want to detect just 1 biggest object, so what shoud i do, thks for listening

glenn-jocher commented 2 years ago

@TuyenSD simply select the largest detection.

mintu07ruet commented 2 years ago

@glenn-jocher , I was using yolov5+deep tracker (https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch) to track the following objects- 0= Person 1= Bicycle 3= motorcycle 7=truck 17=Horse 36= Skateboard Although car is tracking properly but frame is not hold continuously for bicycle and pedestrian. Any suggestions to improve the tracking! Here is the output video https://drive.google.com/file/d/16ZfNxG8p0dEpZZJ9I2vZ__jGJ4IT8w2I/view?usp=sharing Thanks!