mvoelk / ssd_detectors

SSD-based object and text detection with Keras, SSD, DSOD, TextBoxes, SegLink, TextBoxes++, CRNN
MIT License
302 stars 85 forks source link

polygon_to_rbox3 average height #30

Closed eugene123tw closed 5 years ago

eugene123tw commented 5 years ago

I am wondering why the average height is compute as h = (norm(np.cross(dt, tl-br)) + norm(np.cross(dt, tr-bl))) / (2*(norm(dt)+eps)) in polygon_to_rbox3 function? Why didn't just compute like this (norm(tr - br) + norm(tl - bl))/2?

Original code reference: https://github.com/mvoelk/ssd_detectors/blob/master/utils/bboxes.py#L60

mvoelk commented 5 years ago

If I remember correctly, it compensates better for distorted rectangles. As an example, you have an image with size 800x600 and oriented bounding boxes defined as polygons. After resizing the image to 512x512, the aspect ratio changes and you end up with distorted rectangles.