Closed shisenglin closed 2 years ago
@shisenglin mAP is the area under the Precision-Recall curve. See https://en.wikipedia.org/wiki/Precision_and_recall
@shisenglin mAP 是精度-召回率曲线下的面积。请参见 https://en.wikipedia.org/wiki/Precision_and_recall Thank you for your reply!I understand the concept of mAP, but I just can't find the code you wrote to calculate mAP in yolov5, or I don't know if there is any code in YOLOv5 to calculate mAP, and I don't know how to run it to generate an image of mAP.
@shisenglin see utils/metrics.py
@shisenglin see utils/metrics.py
Can I run the file metrics.py to generate mAP images?
@shisenglin val.py computes mAP:
python val.py --weights yolov5s.pt --data coco128.yaml
@shisenglin val.py 计算 mAP:
python val.py --weights yolov5s.pt --data coco128.yaml
This error occurs after running : OSError: [WinError 1455] The page file is too small to complete the operation. Error loading "D:\Anaconda3\envs\luoge\lib\site-packages\torch\lib\cudnn_adv_infer64_8.dll" or one of its dependencies. What is the reason for this error?
@shisenglin this is a windows error unrelated to YOLOv5. See https://www.thewindowsclub.com/increase-page-file-size-virtual-memory-windows
@shisenglin this is a windows error unrelated to YOLOv5. See https://www.thewindowsclub.com/increase-page-file-size-virtual-memory-windows
Thanks to the author's answer, the problem of reporting errors has been solved, and now the operation has results, but the values of P and R seem to be a little low.
@shisenglin 👋 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 project/name
directory, typically yolov5/runs/train/exp
.
We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.
train_batch*.jpg
on train start to verify your labels appear correct, i.e. see example mosaic.Larger 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.
--weights
argument. Models download automatically from the latest YOLOv5 release.
python train.py --data custom.yaml --weights yolov5s.pt
yolov5m.pt
yolov5l.pt
yolov5x.pt
custom_pretrained.pt
--weights ''
argument:
python train.py --data custom.yaml --weights '' --cfg yolov5s.yaml
yolov5m.yaml
yolov5l.yaml
yolov5x.yaml
Before 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.
--img 640
, though due to the high amount of small objects in the dataset it can benefit from training at higher resolutions such as --img 1280
. If there are many small objects then custom datasets will benefit from training at native or higher resolution. Best inference results are obtained at the same --img
as the training was run at, i.e. if you train at --img 1280
you should also test and detect at --img 1280
.--batch-size
that your hardware allows for. Small batch sizes produce poor batchnorm statistics and should be avoided.hyp['obj']
will help reduce overfitting in those specific loss components. For an automated method of optimizing these hyperparameters, see our Hyperparameter Evolution Tutorial.If 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!
@glenn-jocher Thank you very much to the author for helping me so patiently with the problems that arose during the use of yolov5. I think the answers you gave were extremely comprehensive and useful for me as a novice. I will come back to you again if I encounter any other problems in using yolov5, and I hope you would like to give me answers again. Thank you very much!
@glenn-jocher I have trained my own dataset using yolov5 to get the training model. I've learned to put the training model to detect images by using detect.py, but I don't know how to detect videos. If I want to detect videos, where do I need to change the code? I hope the author can reply and answer, thanks a lot!
@shisenglin see https://github.com/ultralytics/yolov5#quick-start-examples for inference examples on videos:
@glenn-jocher So in the above image I just need to change the f1.jpg in default = ROOT / 'data/images/f1.jpg' to vid.mp4 and I will be able to detect the video right?
👋 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 ⭐!
@shisenglin yes, you are correct! Changing the path from f1.jpg
to vid.mp4
would allow you to detect the video. Additionally, you may also need to specify the output directory for the video detections by setting the --save-txt
flag. Good luck with your video detections!
Search before asking
Question
I'm a novice, and I don't know how yolov5 calculates map when testing datasets. Hope to receive an answer.
Additional
No response