Detectron2 maskrcnn implementation question

I am studying Detectron2 implementation of Mask-RCNN. I am trying to understand why there is a max( , 0.1) needed in masks.rasterize_polygons_within_box

    # 2. Rescale the polygons to the new box size
    ratio_h = mask_size / max(h, 0.1)
    ratio_w = mask_size / max(w, 0.1)

Here, h and w are the height and width of the box. Where does the number 0.1 come from? Is that just to prevent a divide by zero error?
Thanks.

Yes, it’s to prevent division by a too small number.
0.1 is quite arbitrarily set. Since (h, w) means the size of the object, if it’s < 0.1 it wouldn’t be meaningful anyway.

1 Like