ewrfcas / MVSFormer

Codes of MVSFormer: Multi-View Stereo by Learning Robust Image Features and Temperature-based Depth (TMLR2023)
Apache License 2.0
175 stars 10 forks source link

Issue running pre-trained weights #3

Closed eddienewton closed 1 year ago

eddienewton commented 1 year ago

Hi,

Great work and impressive results! I'm trying to run your pretrained weights, and I'm getting the following errors for both the MVSFormer and MVSFormer-Blended weights.

model = TwinMVSNet(config['arch']['args']) File "/source/models/mvsformer_model.py", line 329, in __init__ self.vit = gvts.alt_gvt_small() File "/source/models/gvt.py", line 552, in __init__ super(alt_gvt_small, self).__init__( File "/source/models/gvt.py", line 469, in __init__ super(ALTGVT, self).__init__(img_size, patch_size, in_chans, num_classes, embed_dims, num_heads, File "/source/models/gvt.py", line 458, in __init__ super(PCPVT, self).__init__(img_size, patch_size, in_chans, num_classes, embed_dims, num_heads, File "/source/models/gvt.py", line 386, in __init__ super(CPVTV2, self).__init__(img_size, patch_size, in_chans, num_classes, embed_dims, num_heads, mlp_ratios, File "/source/models/gvt.py", line 276, in __init__ _block = nn.ModuleList([block_cls( File "/source/models/gvt.py", line 276, in <listcomp> _block = nn.ModuleList([block_cls( File "/source/models/gvt.py", line 205, in __init__ super(GroupBlock, self).__init__(dim, num_heads, mlp_ratio, qkv_bias, qk_scale, drop, attn_drop, File "/opt/conda/lib/python3.8/site-packages/timm/models/vision_transformer.py", line 257, in __init__ self.attn = Attention(dim, num_heads=num_heads, qkv_bias=qkv_bias, attn_drop=attn_drop, proj_drop=drop) File "/opt/conda/lib/python3.8/site-packages/timm/models/vision_transformer.py", line 213, in __init__ self.proj_drop = nn.Dropout(proj_drop) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/dropout.py", line 14, in __init__ if p < 0 or p > 1:

Have you seen this issue? I'm able to use the -P weights, but are they slower than the normal pertained weights?

Thanks,

eddienewton commented 1 year ago

I was able to run the code by replacing line 7 of gvt.py with:

from models.vision_transformer import Block as TimmBlock

Is this correct?

Thanks.

ewrfcas commented 1 year ago

Sorry for the late response. You can try to install timm==0.3.2. Besides, models.vision_transformer.Block is the same as the one in timm0.3.2 (vision_transformer.Block has one more arg return_attention to return the attention map).

eddienewton commented 1 year ago

Great, thanks for the explanation. This worked. Closing the issue now.