haofeixu / aanet

[CVPR'20] AANet: Adaptive Aggregation Network for Efficient Stereo Matching
Apache License 2.0
521 stars 100 forks source link

Deformable conv initialization? #61

Closed dreamhua82 closed 3 years ago

dreamhua82 commented 3 years ago

Hi, I noticed that in deform.py file the offset conv's weights are initialized by these codes (line 67,68): nn.init.constant_(self.offsetconv.weight, 0.) nn.init.constant(self.offset_conv.bias, 0.)

But in resnet.py file there are another initialization codes (line 136-141): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaimingnormal(m.weight, mode='fan_out', nonlinearity='relu') I wonder whether the latter code influence the previous code to initialize the offset conv??

Thanks.

haofeixu commented 3 years ago

Hi @dreamhua82 , thanks for pointing this out. Yes, you are right, but it will only affect the initialization of the resnet feature. For other modules (e.g., aggregation and refinement), the offset conv initialization will take effect. You can also try our AANet+ model, which doesn't have this problem and enjoys better performance. Thanks.

dreamhua82 commented 3 years ago

Hi, thanks for your kind reply. Can I only use your deformable conv in PSMNet to substitute some of the conv (e.g., in feature extraction module) to get a better performance than original PSMNet(not use AAModule)?

haofeixu commented 3 years ago

You can try to make a comparison, but the improvement may be marginal.