-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Add crops = results.crop()
dictionary
#4676
Add crops = results.crop()
dictionary
#4676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hello @ELHoussineT, thank you for submitting a 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- ✅ Verify your PR is up-to-date with origin/master. If your PR is behind origin/master an automatic GitHub actions rebase may be attempted by including the /rebase command in a comment body, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature # <----- replace 'feature' with local branch name
git rebase upstream/master
git push -u origin -f
- ✅ Verify all Continuous Integration (CI) checks are passing.
- ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee
@ELHoussineT thanks for the PR! We can't accept this as-is because it is duplicating code and functionality, you should instead update the existing functionality to return the values you want. Details are below: Existing Lines 367 to 385 in fad57c2
Existing Lines 411 to 415 in fad57c2
Thank you! |
Sure thing. I added the logic into existing functions (029401d). I structured it in away that does not introduce radical change. The default |
@ELHoussineT great, thanks for the updates, I will review these tomorrow! The python crop return feature has been requested before so I think this is a good idea. |
@glenn-jocher Sure thing. I was actually quite surprised you didn't have this before. |
/rebase |
ef5265f
to
7bea695
Compare
crops = results.crops()
dictionary
@ELHoussineT PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
crops = results.crops()
dictionarycrops = results.crop()
dictionary
PyTorch Hub tutorial updated with Usage example in https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading Cropped ResultsResults can be returned and saved as detection crops: results = model(imgs) # inference
crops = results.crop(save=True) # cropped detections dictionary |
Thanks Glenn for sanitizing this. |
* adding get cropped functionality * Add target logic in existing functions * Crops cleanup * Add dictionary keys: conf, cls, box * Bug fixes - avoid return after first image Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
* adding get cropped functionality * Add target logic in existing functions * Crops cleanup * Add dictionary keys: conf, cls, box * Bug fixes - avoid return after first image Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Adding function that returns list of dicts containing cropped detections and their labels
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Enhancements to image cropping and results output in the YOLOv5 model's inference display method.
📊 Key Changes
crops
list to gather crop data for images during inference.crops
list.crop
method to return thecrops
list and support optional saving with a specified directory.🎯 Purpose & Impact
crops
list, downstream applications can easily utilize the cropping results for further processing or analysis.