ScaledYOLOv4 icon indicating copy to clipboard operation
ScaledYOLOv4 copied to clipboard

How to show Average Precision of Each Class

Open Jethro-241 opened this issue 3 years ago • 8 comments

In our object detection model, there's 2 classes: Paper and Plastic. How can I show the average precision of paper and plastic separately and their mAP?

what exception? All I get is mAP, P, R, etc. like this below: image

What I want to get is this: image

I want to get the average precision

Can you demonstrate it to me? Here's the colab link: https://colab.research.google.com/drive/10KL3fJbImLXmMAw8aSLOLlngQsQ6MG5P?usp=sharing

Jethro-241 avatar Sep 15 '21 11:09 Jethro-241

for your reference. https://medium.datadriveninvestor.com/how-to-create-custom-coco-data-set-for-object-detection-96ec91958f36

i do not find the test script in your colab.

WongKinYiu avatar Sep 15 '21 11:09 WongKinYiu

do you have an email address so we can send our test.py?

Jethro-241 avatar Sep 15 '21 11:09 Jethro-241

just prepare coco style gt and make sure it is put in the corresponding location as what in test.py, you will get the expected results.

WongKinYiu avatar Sep 15 '21 11:09 WongKinYiu

what line in your test.py will you see the corresponding location? so we can check it out in your code.

Jethro-241 avatar Sep 15 '21 11:09 Jethro-241

please install pycocotools and put coco style gt file as https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/test.py#L228 and set opt.save_json = True https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/test.py#L264

WongKinYiu avatar Sep 15 '21 11:09 WongKinYiu

thanks we will try it right now

Jethro-241 avatar Sep 15 '21 11:09 Jethro-241

How did you solve this? I have the same problem, too. i want to see per class but only can see "all". what should i do?

qutyyds avatar Jun 09 '22 01:06 qutyyds

add following code after https://github.com/WongKinYiu/ScaledYOLOv4/blob/yolov4-large/test.py#L235


            for cid in range(80):
                print(names[cid])
                cocoEval.params.catIds = [coco91class[cid]]
                cocoEval.evaluate()
                cocoEval.accumulate()
                cocoEval.summarize()

WongKinYiu avatar Jun 09 '22 01:06 WongKinYiu