Closed XingZeng307 closed 3 years ago
π Hello @XingZeng307, 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://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7
. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If 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), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@XingZeng307 classifier branch was behind by quite a few commits, so I merged master and re-ran the example usage, and also observe poor results now. I'll take a look at this this week, as YOLOv5s should be producing about 0.99 accuracy on MNIST also, so it looks like there's a bug somewhere. Thanks for letting us know!
@XingZeng307 the output is shown here most recently on 10 March: https://github.com/ultralytics/yolov5/issues/2409#issuecomment-794591997
So it seems like something changed between then and now to cause the accuracy drop.
@XingZeng307 Ok I see the problem. In the new training only the new Classify() head has it's gradients turned on, so the entire backbone is frozen. You can see in my screenshot from today's classifier training it says 1192362 parameters, 2570 gradients
, whereas in the March 2021 results it shows 1194954 parameters, 1194954 gradients
.
@XingZeng307 good news π! Your original issue may now been fixed β in https://github.com/ultralytics/yolov5/commit/ad50c810077c72429433d0294474f53d6d6cd80f. To receive this update you can:
git pull
from within your yolov5/
directorygit clone https://github.com/ultralytics/yolov5
againmodel = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 π!
@glenn-jocher Thank you sooo much. It works now!!
@XingZeng307 no problem. The classifier branch still needs some work to figure out the best hyperparameters to use for training though. I noticed if I set the epochs too short, i.e. --epochs 5 the losses become unstable, but at --epochs 10 they train fine.
@glenn-jocher Yeah. As you did in detection, maybe applying hyperparameter evolution helps for hyperparameters optimization? And also adapting the mosaic dataloader for better performance.
π 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 β!
Do I need to clone from 'classifier' branch or from the master/main branch?? Since there is no classifier.py
in the main branch
I'm also getting very low accuracy on the custom dataset.
I'm using this command: !python classifier.py --data orientation --epochs 5 --img 640 --batch 16 --model yolov5s --cache
I'm getting around 40% accuracy.
βQuestion
Hi, thanks for the great work and opening up the classifier branch.
Could you please check again? I did training on MNIST too, using yolov5s, but only 41% accuracy in top5 epochs, but if using EfficientNet, the results will be similar to the above one you were shown in issue#2001. (MNIST is at 99% in 5 epochs.)
I also tried a different dataset, there is still a big difference in accuracy between yolov5 classifier and EfficientNet classifier.
I pulled the latest repository. (don't know why it doesn't work). Here is my result.
python classifier.py --data mnist output:
Thank you!