# mAP for test set

**URL:** <https://discuss.roboflow.com/t/map-for-test-set/2656>\
**Category:** 🤝  Community Help\
**Created:** [July 13, 2023, 8:55am UTC](https://discuss.roboflow.com/t/map-for-test-set/2656 "2023-07-13T08:55:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvprimakipr](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/jvprimakipr/32/2249_2.png) [@jvprimakipr](https://discuss.roboflow.com/u/jvprimakipr)\
**Post date:** [July 13, 2023, 8:55am UTC](https://discuss.roboflow.com/t/map-for-test-set/2656/1 "2023-07-13T08:55:37Z")

</div>

My project is object detection and I am using google colab to training my model with YOLOv5. But, the notebook that roboflow gives to me to use as an example, does not have something that I want.  
I would like to calculate the mAP for my test set (test images in the same dataset version used to train the model).

When I train the dataset with the roboflow model, I got this metrics:

![Captura de tela 2023-07-13 054349](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/f/ffddde191554c7fd6a675d377a8603b363c0ea20.png)

But, using the model YOLOv5 in colab, and exporting it and its weights to the roboflow, I got only the part of Training Graphs.  
The part of AP for each class in Validation set, I got when the training finished. And when I ran inference with trained weights on Test set, I only got images with labels as result, and not metrics.  
The command used:

```auto
%cd /content/yolov5/

!python detect.py --weights runs/train/yolov5s_results/weights/best.pt --img 256 --conf 0.5 --source TDM-15/test/images

```

I think this can be easy, but I have no idea what command I can use to get the mAP, or compare the ground truth with the predictions.

Edit1: I was able to calculate the mAP for all class, changing the code to this:

```auto
!python val.py --data /content/yolov5/test.yaml --weights runs/train/yolov5s_results/weights/best.pt --img 256 --conf 0.5 --iou-thres 0.5 --task "test"

```

But how can I calculate this for each class?

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [July 14, 2023, 1:53am UTC](https://discuss.roboflow.com/t/map-for-test-set/2656/2 "2023-07-14T01:53:20Z")

</div>

Hi @jvprimakipr

Can you share which notebook you’re using? Is it [our YOLOv5 notebook](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov5-object-detection-on-custom-data.ipynb)?

If so, according to [this GitHub issue](https://github.com/ultralytics/yolov5/issues/1598), you can get per class stats using the `--verbose` on `val.py`
