AP results don't match
The AP validation results that we got don't match the one published on github (https://github.com/lyuwenyu/RT-DETR). I am including snippet of the code that we used.
Here are our results for the RTDETRv2-S model (github values in parentheses):
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.409 (48.1)
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.541 (65.1)
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.444
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.234
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.440
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.577
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.325
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.473
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.479
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.266
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.509
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.666
Code used to run inference:
coco = COCO("coco_dataset/annotations/instances_val2017.json")
image_processor = RTDetrImageProcessor.from_pretrained("PekingU/rtdetr_v2_r18vd")
model = RTDetrV2ForObjectDetection.from_pretrained("PekingU/rtdetr_v2_r18vd")
inputs = image_processor(images=image, return_tensors="pt")
The AP validation results that we got don;t match the one published on github (https://github.com/lyuwenyu/RT-DETR). I am including the code that we used below.
Here are our results for the RTDETRv2-S model:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.409
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.541
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.444
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.234
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.440
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.577
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.325
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.473
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.479
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.266
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.509
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.666
Code used to run inference:
coco = COCO("coco_dataset/annotations/instances_val2017.json")
image_processor = RTDetrImageProcessor.from_pretrained("PekingU/rtdetr_v2_r18vd")
model = RTDetrV2ForObjectDetection.from_pretrained("PekingU/rtdetr_v2_r18vd")
for image in image_list:
inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
results = image_processor.post_process_object_detection(
outputs,
threshold=0.5,
target_sizes=torch.tensor([(image.height, image.width)])
)
detections.extend(convert_pytorch2coco(image_id, results[0]))
...
detections_coco = coco.loadRes(detections)
cocoEval = COCOeval(coco, detections_coco, 'bbox')
cocoEval.params.imgIds = coco.getImgIds()
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()