-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
Small objects detection with custom dataset #6634
Comments
Maybe you can try yolov5-p2 https://github.com/ultralytics/yolov5/blob/master/models/hub/yolov5-p2.yaml |
Didn't work. still can't detect anything |
@litaldavar 👋 Hello! Thanks for asking about improving YOLOv5 🚀 training results. Detecting small objects is a default use case. Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement. If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below. Dataset
Model SelectionLarger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.
python train.py --data custom.yaml --weights yolov5s.pt
yolov5m.pt
yolov5l.pt
yolov5x.pt
custom_pretrained.pt
python train.py --data custom.yaml --weights '' --cfg yolov5s.yaml
yolov5m.yaml
yolov5l.yaml
yolov5x.yaml Training SettingsBefore modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.
Further ReadingIf you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/ Good luck 🍀 and let us know if you have any other questions! |
Usually when it comes to small object detection training and inferencing with high resolution works.You can try models that was trained on high resolutions like s6,m6 etc. Also I would recommend you to take a look at tensorflow's Help Protect the Great Barrier Reef competition on Kaggle where objects are so small that they are barely detectable.As far as I know top solutions are yolov5 with high resolution training and inferencing.I think taking a look at some notebooks and discussions may help. |
The minimum area of boundingboxes is set with a threshold, please look at utils > augmentations.py > def box_candidates area_thr parameter & change it accordingly, this will ensure good training and interferece on small objects |
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐! |
Hi Gleen!what's up!! n Happy belated 41st birthday! Wishing you a very lucky year! Tell me please, you said, 『Background images are images with no objects』 And |
@ybonzou thank you! A background image just contains no objects from the dataset you are training. So for example if you train on people, a background image is any image that has no people. |
Hi Mr.Glenn, thank you for your reply!! |
dear sir, Secondly, after data augmented, will the original image also be treated as the training image? like this data augmentation tips: perspective: 0.0 # image perspective (+/- fraction), range 0-0.001 |
@Cong-Wan 👋 Hello! Thanks for asking about image augmentation. YOLOv5 🚀 applies online imagespace and colorspace augmentations in the trainloader (but not the val_loader) to present a new and unique augmented Mosaic (original image + 3 random images) each time an image is loaded for training. Images are never presented twice in the same way. Augmentation HyperparametersThe hyperparameters used to define these augmentations are in your hyperparameter file (default
yolov5/data/hyps/hyp.scratch-low.yaml Lines 6 to 34 in b94b59e
Augmentation PreviewsYou can view the effect of your augmentation policy in your train_batch*.jpg images once training starts. These images will be in your train logging directory, typically
YOLOv5 Albumentations IntegrationYOLOv5 🚀 is now fully integrated with Albumentations, a popular open-source image augmentation package. Now you can train the world's best Vision AI models even better with custom Albumentations 😃! PR #3882 implements this integration, which will automatically apply Albumentations transforms during YOLOv5 training if Example Good luck 🍀 and let us know if you have any other questions! |
Dear glenn, Good morning ,sir! Thank you for your answer! I have two other questions for you😊. First, how do I save all train_batch*.jpg? Next, a image have itself label, but the label (*.txt) file is empty, will yolov5 use it as a background image? Looking forward to your reply! BR, |
@litaldavar train_batch*.jpg are created automatically in your runs/train/exp directory on train start. Yes you can just add background images to your dataset without needing any label txt file. |
Search before asking
Question
Hello
I'm trying to train a dataset with images of small beetles.
after training I tried to detect a small beetle but got not detected
Is there any way to use the model to train on small objects?
Thanks
Additional
No response
The text was updated successfully, but these errors were encountered: