Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About detect.py #12954

Open
1 task done
Bonjourzwh opened this issue Apr 23, 2024 · 9 comments
Open
1 task done

About detect.py #12954

Bonjourzwh opened this issue Apr 23, 2024 · 9 comments
Labels
question Further information is requested

Comments

@Bonjourzwh
Copy link

Search before asking

Question

When I run detect.py ,how can I get this result?This result have bus and truck.

Additional

No response

@Bonjourzwh Bonjourzwh added the question Further information is requested label Apr 23, 2024
@Bonjourzwh
Copy link
Author

![Uploading }A]IOII5U4MSO`0Z8~7MK.png…]()

@Bonjourzwh
Copy link
Author

}A IOII5U4MSO`0Z8~7MK

@glenn-jocher
Copy link
Member

@Bonjourzwh hey there! It looks like there was an issue with uploading your image. Could you please try re-uploading it, or describe in detail what result you're expecting with detect.py? Looking forward to assisting you further! 😊

@Bonjourzwh
Copy link
Author

@Bonjourzwh嘿!上传您的图片时似乎出现了问题。您能否尝试重新上传它,或者详细描述您期望的结果detect.py?期待为您提供进一步帮助! 😊

Uploading Screenshot_2024-04-24-00-33-02-647_com.miui.gallery-edit.jpg…

@Bonjourzwh
Copy link
Author

Uploading Screenshot_2024-04-24-00-33-02-647_com.miui.gallery-edit.jpg…
Uploading Screenshot_2024-04-24-00-33-02-647_com.miui.gallery-edit.jpg…

@Bonjourzwh
Copy link
Author

}一个IOII5U4MSO`0Z8~7MK

}一个IOII5U4MSO`0Z8~7MK

justlike this

@glenn-jocher
Copy link
Member

It appears there's an interest in understanding how to achieve specific detection results with YOLOv5 using detect.py. If you're aiming to detect specific classes such as buses and trucks, ensure your YOLOv5 model is trained on a dataset that includes these classes.

For a straightforward detection command, use:

python detect.py --source your_image_or_video_path --weights your_trained_weights_path --conf 0.25 --classes 5 7

Here, --classes 5 7 specifies class IDs for buses and trucks, assuming these are the correct class IDs in your model's dataset. The --conf option sets the confidence threshold.

Please, adjust the paths and class IDs according to your specific setup and dataset. If these aren't the results you're looking for, could you provide more details about your expected outcome? Happy to help further! 😊

@Bonjourzwh
Copy link
Author

}A IOII5U4MSO'0Z8~7MK

this result have two classes,how can i get the result like this?

@glenn-jocher
Copy link
Member

Hey there! To achieve detection focusing on specific classes, such as the two classes shown in your example, you would use the --classes flag with detect.py. This flag allows you to specify which class IDs you're interested in. You'll need to know the class IDs for the objects you're detecting (e.g., if 0 and 2 are your class IDs for the desired objects):

python detect.py --source your_image_or_video_path --weights your_trained_weights_path --classes 0 2

Just replace your_image_or_video_path with the path to your image or video, and your_trained_weights_path with the path to your model weights. This command filters the detection output to only include your specified classes. 😊

Make sure to adjust the class IDs (0 2 in this example) according to your model's trained classes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants