w1oves / Rein

[CVPR 2024] Official implement of <Stronger, Fewer, & Superior: Harnessing Vision Foundation Models for Domain Generalized Semantic Segmentation>
https://zxwei.site/rein
GNU General Public License v3.0
215 stars 19 forks source link

What is difference between FrozenBackboneEncoderDecoder and EncoderDecoder #26

Closed seabearlmx closed 5 months ago

seabearlmx commented 5 months ago

Hello, the Rein is trained on the frozen dinov2 backbones, but the Rein likely uses EncoderDecoder. so, what is the difference when I add the code model = dict(type="FrozenBackboneEncoderDecoder") to the file rein_dinov2_mask2former_512x512_bs1x4.py

w1oves commented 5 months ago

FrozenBackboneEncoderDecoder freezes the entire backbone (including the rein) and disables gradient backpropagation throughout the backbone. Here, Backbone operates under torch.no_grad(), ensuring a very fast execution due to reduced computational overhead.

During the training of Rein, only the pretrained backbone is frozen, allowing for the fine-tuning of Rein. This selective freezing is implemented through the train() function of the backbone coupled with the PEFTOptimizerConstructor, and it is distinct from the functionality of FrozenBackboneEncoderDecoder.

w1oves commented 5 months ago

Rein will not be fine-tuned if you add add the code model = dict(type="FrozenBackboneEncoderDecoder") to the file rein_dinov2_mask2former_512x512_bs1x4.py.