cocodataset / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
6.11k stars 3.76k forks source link

get average recall and average precision #329

Open batman-far opened 5 years ago

batman-far commented 5 years ago

These days, I train a model for person detection, in each epoch performance of model changes, I use COCO-API to evaluate my detector. Therefore, I can see average recall(AR) and average precision(AP) on screen because summary print it on screen, but I want to get those values by code and save my model if AP and AR improve. Therefore, I want those values instead of their print on screen. But I don't know how.

batman-far commented 5 years ago

I found the answer:

# running evaluation
cocoEval = COCOeval(cocoGt, cocoDt, annType)
cocoEval.params.imgIds = imgIds
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()

print('=========================')
print(cocoEval.stats)
print('=========================')
niazahamd89 commented 4 years ago

Hi @batman-far i need a little information how you generate cocoDt result.json file let me explain that please.

I want to clear is i train my model on coco train and validation set for pose estimation now i want to evaluate my model to find the AP and AR. i am going to use coco evaluation metric for this purpose, in demo.ipynb the first file i need is the Gt file which i downloaded from coco site the second file i need the Dt file now i am confuse how i can generate this Dt file? my training is complete the model generate weights file in .ckpt format and i test the model is able to plot pose in pictures.

there are some result.json files in cocoapi result folder https://github.com/philferriere/cocoapi/tree/master/results basically the same file person_keypoints_val2014_fakekeypoints100_results.json i want to generate for my model to evaluate.