0

我在 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]

谢谢!

4

1 回答 1

2

“有些图像中我有 100 多个对象要分类。”

maxDets = 100 并不意味着它只会对 100 个图像进行分类,而是指% AverageRecall given 100 detections per image

inshort maxDets 与指标无关。分类的图像。

欲了解更多信息,请访问: http ://cocodataset.org/#detection-eval

张量板图召回

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

根据此代码片段,我发现它检查了否。检测,因此model.roi_heads.detections_per_img=300对您的目的是正确的。而且我还没有在 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]

这个代码片段说我们只能过滤掉我们想要在我们的模型中拥有的一些顶级检测。

于 2020-05-05T15:04:51.637 回答