我正在pytorch上实现一个更快的RCNN网络。我已经学习了下一个教程。
https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
有些图像中我有100多个对象需要分类。然而,在本教程中,我最多只能检测到100个对象,因为参数"maxdets"=100。
有没有办法改变这个值,使它适应我的项目?
IoU metric: bbox
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.235
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.655
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.105
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.238
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.006
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.066
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.331
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.331
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
如果只更改下一个参数,问题就会解决吗?
cocoeval.Params.setDetParams.maxDets = [1, 10, 100]
谢谢!
"有些图像中有100多个对象需要分类。">
maxDets=100并不意味着它只对100张图像进行分类,而是指% AverageRecall given 100 detections per image
在短时间内,maxDets被重新分配到度量,而不是被分类的图像的实际数量。
欲了解更多信息,请访问:http://cocodataset.org/#detection-eval
Tensorboard图形调用
https://github.com/matterport/Mask_RCNN/issues/663
# Limit to max_per_image detections **over all classes**
if number_of_detections > self.detections_per_img > 0:
cls_scores = result.get_field("scores")
image_thresh, _ = torch.kthvalue(
cls_scores.cpu(), number_of_detections - self.detections_per_img + 1
)
keep = cls_scores >= image_thresh.item()
keep = torch.nonzero(keep).squeeze(1)
result = result[keep]
return result
根据这个代码片段,我发现它检查检测的数量所以CCD_ 2对于您的目的是正确的。我还没有找到太多关于maxdets的适当文档,但我想上面的代码应该可以工作。
# non-maximum suppression, independently done per class
keep = box_ops.batched_nms(boxes, scores, labels, self.nms_thresh)
# keep only topk scoring predictions
keep = keep[:self.detections_per_img]
这个代码片段表明,我们只能筛选出一些我们希望在模型中进行的顶级检测。