cocoapi icon indicating copy to clipboard operation
cocoapi copied to clipboard

getAnnIds: areaRng not inclusive of limits

Open ashnair1 opened this issue 3 years ago • 5 comments

If you were to query annotations within a particular area range, via the getAnnIds function, it ignores those objects that have areas equal to the limits.

For example,

# Assuming objects areas only lie between 10^2 and 1e5^2 pixels

areaRng = [10,32,64,96]

small    = len(ann.getAnnIds(areaRng=[(areaRng[0]**2) , areaRng[1]**2]))
medium   = len(ann.getAnnIds(areaRng=[(areaRng[1]**2) , areaRng[2]**2]))
large    = len(ann.getAnnIds(areaRng=[(areaRng[2]**2) , areaRng[3]**2]))
total = len(ann.getAnnIds(areaRng=[(areaRng[0]**2), (areaRng[3]**2)]))

assert total = small + medium + large

The assertion would fail if there are objects that have area exactly equal to 10^2, 32^2, 64^2 or 96 ^2 pixels.

ashnair1 avatar Aug 11 '21 06:08 ashnair1

Hi @ppwwyyxx, any thoughts on this PR?

ashnair1 avatar Jan 10 '22 12:01 ashnair1

Though I agree that the code is incorrect, this will change the evaluation results and therefore have major consequences. Please send it to the official repo instead of this fork.

I do not want to diverge from the official repo in evaluation results, even when the official repo is wrong.

ppwwyyxx avatar Jan 26 '22 08:01 ppwwyyxx

Fair enough. I've opened cocodataset/cocoapi#568 for this fix.

ashnair1 avatar Jan 26 '22 08:01 ashnair1

@ppwwyyxx Do you know who currently maintains the official repo?

ashnair1 avatar Apr 28 '22 09:04 ashnair1

As far as I understood, official repo is not being maintained

fcakyon avatar Apr 28 '22 10:04 fcakyon