open-mmlab / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
46 stars 35 forks source link

In the function setDetParams(), np.linspace() may not create exact values #20

Open minan19605 opened 3 years ago

minan19605 commented 3 years ago

Ubuntu 18.04, AMD Ryzen 3700x

MMCV: 1.0.5 MMDetection: 2.3.0+68d860d MMDetection Compiler: GCC 7.5 MMDetection CUDA Compiler: 10.1

In the function setDetParams(), the code: self. iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True) self.recThrs = np.linspace(.0, 1.00, int(np.round((1.00 - .0) / .01)) + 1, endpoint=True)

I found the self. iouThrs values are like: [0.5 , 0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.8999999 , 0.95]

The self.recThrs has the same issues.

So I changed those codes as below and tested ok. Please check if the modification is ok.

    iouThrs = np.linspace(.5,
                               0.95,
                               int(np.round((0.95 - .5) / .05)) + 1,
                               endpoint=True)
    self.iouThrs = **_np.round(iouThrs, decimals=2)_**
    recThrs = np.linspace(.0,
                               1.00,
                               int(np.round((1.00 - .0) / .01)) + 1,
                               endpoint=True)
    self.recThrs = **_np.round(recThrs, decimals=2)_**