yolact icon indicating copy to clipboard operation
yolact copied to clipboard

producing classwise results for coco

Open deepaksinghcv opened this issue 4 years ago • 5 comments

could somebody help me with producing boxAP and maskAP for each class.

deepaksinghcv avatar Jun 25 '20 17:06 deepaksinghcv

Did you find a solution so far?

sabine1993 avatar Jul 08 '20 07:07 sabine1993

I have a solution: fisrt run the evaluation script whrich produces the json result files python eval.py --trained_model=weights/yolact_base_54_800000.pth --output_coco_json the run python run_coco_eval.py

you can either change in run_coco_eval: bbox_eval = COCOeval(gt_annotations, bbox_dets, 'bbox') bbox_eval.params.catIds = [7] # person id : 1 #bbox_eval.params.imgIds = imgIds bbox_eval.evaluate() bbox_eval.accumulate() bbox_eval.summarize() then you get only the results for the specific class

or you can add in cocoeval.py in line 456 #cacluate AP(average precision) for each category num_classes = 80 avg_ap = 0.0 if ap == 1: for i in range(0, num_classes): print('category : {0} : {1}'.format(i,np.mean(s[:,:,i,:]))) avg_ap +=np.mean(s[:,:,i,:]) print('(all categories) mAP : {}'.format(avg_ap / num_classes))

it will additionaly print all the results per class

sabine1993 avatar Jul 08 '20 08:07 sabine1993

I will check it out. Thank you for informing

deepaksinghcv avatar Jul 08 '20 08:07 deepaksinghcv

hello all do you know how can i print precision and recall for each class? thanks

denashamss avatar May 04 '22 21:05 denashamss

@sabine1993 Thanks for your effort. But has anyone been successful with @sabine1993 code? It wasn't successful in my case

Eldad27 avatar Aug 16 '22 07:08 Eldad27