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

how to use the val.py script to detect only 'person' and 'car' classes? #13409

Open
1 task done
ghosmile opened this issue Nov 10, 2024 · 2 comments
Open
1 task done
Labels
detect Object Detection issues, PR's question Further information is requested

Comments

@ghosmile
Copy link

Search before asking

Question

I want to use the val.py script to detect only 'person' and 'car' classes, but the output prediction results still include other classes, and modifying the include_class in the dataloaders file doesn't work, what should I do?"
image
image
pred has else class

Additional

No response

@ghosmile ghosmile added the question Further information is requested label Nov 10, 2024
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label Nov 10, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @ghosmile, thank you for reaching out to us with your question regarding YOLOv5 🚀! This is an automated response, but rest assured that an Ultralytics engineer will assist you soon.

If you're looking to customize val.py to detect only specific classes such as 'person' and 'car', please ensure you're correctly filtering the output predictions. You may need to adjust your script to handle class filters appropriately.

For bug reports or issues, providing a minimum reproducible example would greatly assist us in debugging. This includes concise code snippets, environment details, and any relevant logs or error messages.

In case you are looking for guidance on usage or best practices, please explore our tutorials, which cover a range of topics from custom data training to hyperparameter optimization.

Requirements

Make sure your environment satisfies the following:

  • Python version 3.8.0 or higher
  • All necessary dependencies installed from requirements.txt
  • PyTorch 1.8 or higher

Environments

YOLOv5 runs smoothly in verified environments including free GPU Notebooks, Google Cloud, Amazon Deep Learning AMI, and Docker images.

Status

Check the current status of our Continuous Integration (CI) tests. If the CI badge is green, all tests are passing, ensuring stable operation across various platforms.

Stay tuned, and thank you for your patience as we work to support your needs! 😊🔍

@pderrenger
Copy link
Member

@ghosmile to detect only 'person' and 'car' classes using val.py, you can modify the --classes argument in your command like this: python val.py --weights yolov5s.pt --data coco.yaml --classes 0 2, where 0 and 2 correspond to 'person' and 'car' class indices in the COCO dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants