fasterrcnn-pytorch-training-pipeline
fasterrcnn-pytorch-training-pipeline copied to clipboard
COCOeval vs MeanAveragePrecision
In the eval.py you use AverageMeanPrecision from torchmetrics, in the train.py for evaluation you use the evaluation using pycocotools. When I use them both, I obtain different values for AP. Which one do you recommend to use and why?
@EmmaVanPuyenbr
I think I know the issue. When you use eval.py
that uses Torchmetrics, it uses the best weights for the mAP calculation.
You may be mistakenly comparing that the last epochs mAP from the validation loop. Please take a look at the log fine and find the best loop's mAP. I am sure that mAP and the Torchmetrics mAP will be the same.
well I calculated and compared them after each epoch and even in the first epoch they are not the same? is it maybe also the mAP of the best iteration vs the last iteration?
Yes, that may be the case. Please check the terminal once for the best epoch mAP and then run eval.py
.
Or else, you can get the best epoch from the CSV file as well.
@EmmaVanPuyenbr hello, I have same issue that [email protected] with cocoeval and meanaverageprecision. Did you solve the probelm?
I've found the solution for this issue. Add the code while loading model checkpoint!
model.transform.min_size = (args['img_size'], )