GMMSeg icon indicating copy to clipboard operation
GMMSeg copied to clipboard

performance advice, find_unused_parameters

Open joihn opened this issue 2 years ago • 1 comments

hello, thanks for this code,

FYI this setting induce a big performance hit, leading to slow training, configs/_gmmseg/models/base_model_config.py:1 find_unused_parameters = True

You probably added it because part of your network is not used during training (and will therefore generate an error, which you manage to workaround by using find_unused_parameters = True).

I think I found the unused part of the net. You inherit BaseDecodeHead mmseg/models/decode_heads/gmmseg_head.py:23 class GMMSegHead(BaseDecodeHead):

Which define an unused conv2d: mmseg/models/decode_heads/decode_head.py:104 self.conv_seg = nn.Conv2d(channels, num_classes, kernel_size=1)

You can remote it. (del self.conv_seg in class GMMSegHead ) which would allow you to set find_unused_parameters = False and enjoy a nice speedup during training.

joihn avatar Dec 11 '23 14:12 joihn

Thank you for bringing up the performance issue and investing your diligent effort in suggesting a potential solution!

I encourage future users to check for more details, and I have pinned this issue at the top. Hope this helps for future users.

Your valuable input is highly appreciated. Thank you once again!

leonnnop avatar Jan 20 '24 10:01 leonnnop