-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Custom trained object detection model not working #8528
Comments
👋 Hello @RockZombie4, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email [email protected]. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
@RockZombie4 I doubt your training will work with so few images. If you only have 76 images you'll probably want to train very many epochs, i.e. >>1000 to get enough iterations to produce results. Alternatively simply lower your --conf-thresh. Obviously at some point as confidence thresholds trends to zero boxes will begin to appear. |
How do I lower the |
Line 221 in 526e650
|
@RockZombie4 but I have no idea why you would expect results from 1 epoch of training. This is useless. See Train Custom Data for directions on training and Tips for Improving Results tutorials: YOLOv5 Tutorials
Good luck 🍀 and let us know if you have any other questions! |
I tried training with 1000 epochs, set the image size to 96, and lowered the Do I train with a pretrained weight? |
@RockZombie4 👋 Hello! Thanks for asking about improving YOLOv5 🚀 training results. 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! |
👋 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 ⭐! |
#but i have trained my model on a large data like 5,000 images and trained them on 100 epoch and the weights file dosen't even detect anything and the accuracy was 86% |
Bug image 1/1: 720x1280 (no detections) |
@RockZombie4 👋 Hello! Thanks for reaching out. If you are getting an accuracy of 86% but no detections are being made, there could be several reasons why this is happening. I suggest you do the following:
If none of these solutions work, then provide detail information about your problem as well as the information in the log files so that we can diagnose the issue further. |
Lowering the --conf value did the work thank you so much! You're an angel!😊😊😇 |
@harshrocks glad to hear that lowering the |
Had similar issue here. Trained my dataset it was accurate on validation set but my dumb self predicted with targeting to classes=[9] because I was reusing code that detected Traffic Lights with yolov8n where Traffic Light was on the 9th index of classes that it detects. And I trained my model to detect only one class so I had to change it to classes=[0]. |
@alienCarpet14 it's great to hear that you were able to identify the source of the issue! It's not uncommon for these kinds of challenges to arise during the development and deployment of models. Thank you for sharing your experience, and we hope your insights will be helpful to others encountering similar issues. If you have any further questions or need assistance, please feel free to reach out. |
Search before asking
YOLOv5 Component
Training, Detection
Bug
I have recently trained a custom object detection model for YOLOv5 with makesense.ai .
I exported as a label file, and I put 76 images in the proper training directory, and 8 images in the proper validation directory.
I just need it to detect my face as a test but whenever I run
detect.py
with the custom weights generated bytrain.py
, it never detects. There is no error message being output in the logs, but for some reason it just doesn't show any detection box around my face.Here is my yolov5 custom model:
datasets.zip
I used this command to attempt to detect an image with my face:
python detect.py --data data/coco128.yaml --weights runs/train/exp10/weights/best.pt --source ~/Pictures/Webcam/2022-07-05-064922.jpg
I used this command to train the dataset:
python train.py --data data/coco128.yaml --epochs 1 --imgsz 76
Please help me!
Environment
Minimal Reproducible Example
No response
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: