tusen-ai / simpledet

A Simple and Versatile Framework for Object Detection and Instance Recognition
Apache License 2.0
3.08k stars 488 forks source link

ap for specific object class #300

Closed mad-fogs closed 4 years ago

mad-fogs commented 4 years ago

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!

dongzhenguo2016 commented 4 years ago

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

mad-fogs commented 4 years ago

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.

huangzehao commented 4 years ago

@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()
mad-fogs commented 4 years ago

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