Handle input sources with multi-level child subfolders#8924
Handle input sources with multi-level child subfolders#8924DrSnowbird wants to merge 7 commits intoultralytics:masterfrom
Conversation
…rs.py to recursively load child folders' images for detection
pull from upstream
…irectories in input source folder
pull from upstream
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
👋 Hello @DrSnowbird, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- ✅ Verify your PR is up-to-date with upstream/master. If your PR is behind upstream/master an automatic GitHub Actions merge may be attempted by writing /rebase in a new comment, 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 merge 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
|
@DrSnowbird recursive subfolder inference is already available with glob commands, i.e. |
|
@DrSnowbird I noticed the README example lacked quotes so I fixed the glob examples in #8927 |
|
Thanks for comment python detect.py --source './images' |
|
@DrSnowbird the command for recursive inference for all images and videos is very simple. The dataloader automatically ignores any non-viable files. python detect.py --source 'path/**/*' |
|
@glenn-jocher - thanks for information. |
|
Understood, @DrSnowbird! We appreciate your efforts and dedication to simplifying the user experience. The YOLOv5 community benefits greatly from diverse perspectives and contributions. If you have any further ideas or feedback, we're always open to discussion. Thank you for your understanding and support. |
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Enhancements to YOLOv5 output directory structure and a test script for detection.
📊 Key Changes
detect.py, ensuring outputs are organized inimagesandlabelssubdirectories.detect.pynow respects the relative directory structure of the input source when saving outputs.mkdircommands to create necessary nested directories for saving images and labels.test-detect.py, a simple script to perform model inference and print the results.utils/dataloaders.pyto properly load all files recursively when a directory is specified.🎯 Purpose & Impact
detect.pyallow for better organization of outputs, especially when dealing with nested input directories, enhancing usability for users with complex datasets.test-detect.pyscript offers a straightforward way for users to test model inference, improving the initial user experience and providing a quick way to validate installations and models.