yinghdb / EmbedMask

EmbedMask: Embedding Coupling for One-stage Instance Segmentation
MIT License
160 stars 19 forks source link

Why margin need to be scaled by "scale_size"? #15

Open shoutOutYangJie opened 4 years ago

shoutOutYangJie commented 4 years ago

here, I don't understand this paragraph.

 if self.norm_reg_targets:
                margin_x = (bbox_pred * self.fpn_strides[l] / scale_size)
            else:
                margin_x = bbox_pred / scale_size

what is the reason why bbox_pred divide scale_size

shoutOutYangJie commented 4 years ago

another question : what is the function of **mask_scale_factor""?

shoutOutYangJie commented 4 years ago

third question. is it possible that mask_prob_cuda can be replaced with cpu operation or pure python code.

yinghdb commented 4 years ago

@shoutOutYangJie

  1. The value of 'bbox_pred' is too large as an input for the output layer, so I simply scale it with a constant to reduce the value.

  2. 'mask_scale_factor' is used to decide the size of final pixel embedding map, cause the pixel embedding map predicted from the networks will be enlarged (2x by default).

  3. It can be replaced with cpu operation, but the speed will reduce.

By the way, I have just updated some new codes to EmbedMask, which improves the performance. You can checkout the new codes if interested.

lucasjinreal commented 3 years ago

@yinghdb Hi, can u check adet version code:

/adet/modeling/embedmask/mask_pred.py", line 7, in <module>
    from adet.layers import mask_prob_efficient
ImportError: cannot import name 'mask_prob_efficient'

there is no such file in your fork version adet

yinghdb commented 3 years ago

@jinfagang

This line should be deleted, sorry!

lucasjinreal commented 3 years ago

@yinghdb did u updated the git? You mean this line is unnecessary or lack of this file?

yinghdb commented 3 years ago

@jinfagang I have updated the git. The line is unnecessary now. It was used to test something before.

Johnqczhang commented 3 years ago

https://github.com/yinghdb/AdelaiDet/blob/master/adet/modeling/embedmask/embedmask.py#L323 Hi, @yinghdb, in your new version based on adet, why the input of the margin prediction layer (i.e., features output by the bbox_tower) needs to be scaled by margin_reduce_factor? What the value of this hyper-param is based on?

yinghdb commented 3 years ago

@Johnqczhang

This is for stable training. The function is similar to reducing the gradients of the backward network. If not reducing the gradients of the margin head, the training is likely to be failed. I have not paid too much attention to this issue, and there should be a better solution to it.