-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
How to output test.py metrics per class? #1829
Comments
👋 Hello @kotagiripranay, 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. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt 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), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@kotagiripranay test.py computes metrics on trained models. See Colab notebook for examples. |
Hi, @glenn-jocher I think you have understood the question in the wrong way. let me explain in detail so you can help me out in solving it.
!python test.py --weights weights/best.pt --data pub_colab.yaml --img 640 --iou 0.65 so I got the output as :
I THINK ITS CLEAR TILL NOW THE PROBLEM STATEMENT is :
an example which I am expecting :
can u help me out with the way how can I get the map for individual classes on my test data? |
@kotagiripranay use |
TODO: automatic |
That's great it worked thankyou @glenn-jocher, Now I have one more query can u please me out in the same way as the above one now I came to know the matrix for individual classes to testing data using test.py --verbose THE NEW PROBLEM STATEMENT IS: now I will upload some new jpg files WITHOUT ANY LABELS in yolov5/inference/images folder By using the code : !python detect.py --weights weights/last.pt --img 640 --conf 0.4 the output is : Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', fourcc='mp4v', img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='inference/images', view_img=False, weights='weights/best.pt') image 1/50 inference/images/PMC1599750_00010.jpg: 640x512 2 figures, 5 texts, 1 titles, Done. (0.028s) so here new images are created in the output folder by detecting their respective classes as shown above QUESTION : how to calculate the map of new data for individual classes as we did for the above testing data which I shared in yolov5/inference/images folder |
@kotagiripranay mAP computation requires labels naturally. Therefore asking how to compute mAP on unlabelled data is completely contrary to the purpose of the metric. |
@glenn-jocher I am asking is there any way to calculate map on the predicted images which are stored in yolov5/inference/output folder this is the image which predicted by using the code : !python detect.py --weights weights/last.pt --img 640 --conf 0.4 output : Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', fourcc='mp4v', img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='inference/images', view_img=False, weights='weights/best.pt') image 1/1 inference/images/PMC1781957_00028.jpg: 640x512 7 texts, 4 titles, Done. (0.028s) here the model has detected 7 texts and 4 titles, and the predicted file is saved in yolov5/inference/output folder I want to calculate the map or accuracy for this set of predicted files that are present in the total folder... can u help me out with it...:) |
@kotagiripranay its very simple:
|
@glenn-jocher as I new to object detection ...out of curiosity asking one doubt .. test.py is for calculating map on test data....but what if I provided completely new data that has no labels..? I tried a new data in test.py -- data/pub_colab.yaml --img 640 but in pub_colab.yaml ...I provided train data images and their respective labels but in test data, I provided only images but no labels as usually it has thrown an error: cannot find the labels. answer to this question...? |
@kotagiripranay metrics are computed on labelled data only. |
@glenn-jocher thanks buddy....now it's clear ... |
@kotagiripranay PR #1869 implements --verbose automatically now when calling test.py directly with a dataset smaller than 20 classes. |
@glenn-jocher Is there some sort of file that's created or method from which we can save the per-class metrics outputted (the ones at the end of training) using |
@AnshKetchum try --verbose:
|
@glenn-jocher I've tried running
|
@AnshKetchum Sorry for the confusion. Currently, there isn't a built-in feature to save the per-class metrics to a file directly in YOLOv5. You can manually save the verbose output to a file using Linux |
❔Question
Hi
can anyone help me out with how to check the performance of the yolov5 model on my new data
By using detect.py I can get the output detected.
But how to check its map and how to plot its matrix eg: training and Val we get map.5 and map.95
Additional context
The text was updated successfully, but these errors were encountered: