gangweiX / Fast-ACVNet

[TPAMI 2024] Fast-ACV: Fast Attention Concatenation Volume for Accurate and Real-time Stereo Matching
MIT License
356 stars 37 forks source link

AttributeError: 'EfficientNetFeatures' object has no attribute 'act1' #4

Closed philleer closed 1 year ago

philleer commented 1 year ago

@gangweiX Hey, great work you have done!

Seems there is something wrong in the Fast_ACV_plus.py code, will you spare some time to check it? Fast_ACV_plus.py#L43

class Feature(SubModule):
    def __init__(self):
        super(Feature, self).__init__()
        pretrained =  True
        model = timm.create_model('mobilenetv2_100', pretrained=pretrained, features_only=True)
        layers = [1,2,3,5,6]
        chans = [16, 24, 32, 96, 160]
        self.conv_stem = model.conv_stem
        self.bn1 = model.bn1
        self.act1 = model.act1

Not sure any difference with or without the act1 layer.

Since I have checked the mobilenetv2_100 model, and there is indeed no act1 layer inside, as shown below.

mobilenetv2_100 model info

```python EfficientNetFeatures( (conv_stem): Conv2d(3, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False) (bn1): BatchNormAct2d( 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (blocks): Sequential( (0): Sequential( (0): DepthwiseSeparableConv( (conv_dw): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False) (bn1): BatchNormAct2d( 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pw): Conv2d(32, 16, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn2): BatchNormAct2d( 16, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (1): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(16, 96, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(96, 96, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=96, bias=False) (bn2): BatchNormAct2d( 96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(96, 24, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 24, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (1): InvertedResidual( (conv_pw): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(144, 144, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=144, bias=False) (bn2): BatchNormAct2d( 144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(144, 24, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 24, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (2): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(144, 144, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=144, bias=False) (bn2): BatchNormAct2d( 144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(144, 32, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (1): InvertedResidual( (conv_pw): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False) (bn2): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (2): InvertedResidual( (conv_pw): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False) (bn2): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (3): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(192, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=192, bias=False) (bn2): BatchNormAct2d( 192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(192, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (1): InvertedResidual( (conv_pw): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False) (bn2): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (2): InvertedResidual( (conv_pw): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False) (bn2): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (3): InvertedResidual( (conv_pw): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False) (bn2): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (4): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False) (bn2): BatchNormAct2d( 384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(384, 96, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (1): InvertedResidual( (conv_pw): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False) (bn2): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (2): InvertedResidual( (conv_pw): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False) (bn2): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (5): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(576, 576, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=576, bias=False) (bn2): BatchNormAct2d( 576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(576, 160, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (1): InvertedResidual( (conv_pw): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False) (bn2): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) (2): InvertedResidual( (conv_pw): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False) (bn2): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) (6): Sequential( (0): InvertedResidual( (conv_pw): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (conv_dw): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False) (bn2): BatchNormAct2d( 960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): ReLU6(inplace=True) ) (se): Identity() (conv_pwl): Conv2d(960, 320, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNormAct2d( 320, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True (drop): Identity() (act): Identity() ) (drop_path): Identity() ) ) ) ) ```

gangweiX commented 1 year ago

Thank you for your attention, this is caused by the inconsistency of the timm version. Please pip install timm==0.5.4. I have introduced how to install environment in README.md.