noahzn / Lite-Mono

[CVPR2023] Lite-Mono: A Lightweight CNN and Transformer Architecture for Self-Supervised Monocular Depth Estimation
MIT License
540 stars 61 forks source link

'LiteMono' object has no attribute 'dilation' #27

Closed jiangxf0929 closed 1 year ago

jiangxf0929 commented 1 year ago

Hi, when I train my dataset and load weights to test, I get the following error, what is the reason? AttributeError: 'LiteMono' object has no attribute 'dilation'

noahzn commented 1 year ago

Hi, which file did you run? Can you copy the complete error message?

jiangxf0929 commented 1 year ago

hello, My test command is "python test_simple.py --load_weights_folder ./tmp/Mytrain/ --image_path ./data/mydata/image_02/data/", train command is "python train.py --data_path ./data --model_name mytrain --num_epochs 30 --batch_size 2 --mypretrain ./preweights/lite-mono-pretrain.pth --lr 0.0001 5e-6 31 0.0001 1e-5 31". Error message is "-> Loading model from ./tmp/Mytrain/ Loading pretrained encoder Traceback (most recent call last): File "test_simple.py", line 192, in test_simple(args) File "test_simple.py", line 81, in test_simple encoder = networks.LiteMono(model=args.model, File "/Lite-Mono-main/networks/depth_encoder.py", line 384, in init stage_blocks.append(DilatedConv(dim=self.dims[i], k=3, dilation=self.dilation[i][j], drop_path=dp_rates[cur + j], File "/miniconda3/envs/nerf-pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LiteMono' object has no attribute 'dilation'"

noahzn commented 1 year ago

What version of PyTorch are you using? There seems to be a problem on the PyTorch side.

jiangxf0929 commented 1 year ago

torch 1.12.1, Which version did you use in LiteMono?

noahzn commented 1 year ago

I tested with PyTorch 1.7.1 and 1.12.1. Could you check if you are using the correct checkpoints? For testing you need to load this checkpoint (default: Lite-Mono) by setting --load_weights_folder, and for training please load this file by setting --mypretrain

jiangxf0929 commented 1 year ago

I have tested with your checkpoint (lite-mono_1024 and lite-mono_640), and it works. but when I use your pretrain.pth to train and test my data, the same error appears.

jiangxf0929 commented 1 year ago

Ok, I find, my image size is not 640 \times 192 or 1024 \times 320

noahzn commented 1 year ago

Glad you found the problem! If you want to train with different image sizes, you can modify the code.

jiangxf0929 commented 1 year ago

Many thanks for your patience and help! 😊