SOON icon indicating copy to clipboard operation
SOON copied to clipboard

Bboxes do not contain center point

Open guhur opened this issue 4 years ago • 2 comments

Hi,

The SOON dataset is offering bboxes defined as polygons of (heading, elevation) points. A predicted point is considered as valid if it belongs to its related polygon.

However, it seems that the polygons do not always contain the ground truth points.

The following code provides a success rate of 55.8% :

import json
data = json.load(open('data/task/SOON_train.json'))
total = 0
success = 0
for soon_item in data:
    for bbox in soon_item['bboxes']:
        t =  bbox['target']
        polygon = Polygon([
            [t['left_top']['heading']/ (2 * math.pi), (t['left_top']['elevation']+math.pi)/ (2 * math.pi)],
            [t['right_top']['heading']/ (2 * math.pi), (t['right_top']['elevation']+math.pi)/ (2 * math.pi)],
            [t['right_bottom']['heading']/ (2 * math.pi), (t['right_bottom']['elevation']+math.pi)/ (2 * math.pi)],
            [t['left_bottom']['heading']/ (2 * math.pi), (t['left_bottom']['elevation']+math.pi)/ (2 * math.pi)],    
        ])
        p = Point(
            t['center']['heading']/ (2 * math.pi), 
            (t['center']['elevation']+math.pi)/ (2 * math.pi)
        )
        success += int(polygon.contains(p))
        total += 1
print(success /total)

I am using the normalization as described here: https://github.com/ZhuFengdaaa/SOON/blob/master/r2r_src/utils.py#L156

guhur avatar Sep 24 '21 11:09 guhur

This is a serious problem. This problem occurs when the boundaries of a bounding box are across 0 (360) degree (e.g., left side<0 and right side > 0). The center can be regarded as "outside" the bounding box, even if it is inside the bounding box. We are still looking for a solution to this problem, and we welcome any improvement.

ZhuFengdaaa avatar Sep 24 '21 11:09 ZhuFengdaaa

If I understand correctly what you mean, the right side should be on the left side in this example: image

So I guess one way to fix the dataset is to attempt every transformation until the point belongs to the bounding box. I am not sure it would be enough though.

guhur avatar Sep 24 '21 12:09 guhur