voc2coco icon indicating copy to clipboard operation
voc2coco copied to clipboard

Convert from 1-based index to 0-based index

Open XudongWang12Sigma opened this issue 6 years ago • 2 comments

In line 80 and line 81, I am not sure whether we should use width = (x_max-1) - (x_min - 1) = x_max - x_min for getting the 0-based index width of coco style. However, you only -1 for x_min, I am not sure whether we should also - 1 for x_mmax? Is it correct? Original:

        xmin = int(get_and_check(bndbox, 'xmin', 1).text) - 1
        ymin = int(get_and_check(bndbox, 'ymin', 1).text) - 1
        xmax = int(get_and_check(bndbox, 'xmax', 1).text)
        ymax = int(get_and_check(bndbox, 'ymax', 1).text)

Corrected:

        xmin = int(get_and_check(bndbox, 'xmin', 1).text) - 1
        ymin = int(get_and_check(bndbox, 'ymin', 1).text) - 1
        xmax = int(get_and_check(bndbox, 'xmax', 1).text) - 1
        ymax = int(get_and_check(bndbox, 'ymax', 1).text) - 1

XudongWang12Sigma avatar Nov 21 '18 19:11 XudongWang12Sigma

为什么xmin与ymin要减1呢?如果都不减也能使长和宽不变呢 @XudongWang12Sigma

Wenting-Xu avatar Aug 09 '20 12:08 Wenting-Xu

我也想问一下为什么xmin和ymin要减1呢?

Renascence6 avatar Sep 28 '20 09:09 Renascence6