tusen-ai/simpledet

ap for specific object class

mad-fogs opened this issue · 4 comments

Dear authers,

TridentNet included within this repo is one of the best opne-source detection model currently.
I use this repo to finetune on private dataset of 4 classes of object, however, how to get ap for each specific class ? since our datasets is unblance one.

Thanks very much for your help!

In detection_test.py, 293 line,
coco_eval.params.iouType = "bbox"

Add this line after line 293,as follow

coco_eval.params.catIds = [0] # 0 represent specfic class ,You can add or subtract categories as needed

In detection_test.py, 293 line,
coco_eval.params.iouType = "bbox"

Add this line after line 293,as follow

coco_eval.params.catIds = [0] # 0 represent specfic class ,You can add or subtract categories as needed

Thanks very much for your help!
but when i use class 0, the returned ap are all -1. I guess 0 stands for the background here.
i will try to check class 1.

@dongzhenguo2016 Thanks!
@mad-fogs

    for catId in coco.getCatIds():
        print('evl catId:{}'.format(catId))
        coco_eval = COCOeval(coco, coco_dt)
        coco_eval.params.iouType = "bbox_ex"
        coco_eval.params.catIds = [catId]
        coco_eval.evaluate()
        coco_eval.accumulate()
        coco_eval.summarize()

@dongzhenguo2016
@huangzehao
thanks very much for all your kind help, i got the map for each class now.