Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Given groups=1, weight of size [16, 3, 3, 3], expected input[4, 4, 2048, 1536] to have 3 channels, but got 4 channels instead #10

Open
rebecca0011 opened this issue Dec 30, 2021 · 0 comments

Comments

@rebecca0011
Copy link

I only downloaded the 00008 data as a training and validation set due to network problems, but got this error

/home/rc/anaconda3/envs/DL/bin/python3.7 /home/rc/StereoMatching/SMD-Nets/apps/train.py --dataroot /home/rc/StereoMatching/SMD-Nets/Dataset/UnrealStereo4K_00008 --checkpoints_path /home/rc/StereoMatching/SMD-Nets/checkpoints --training_file /home/rc/StereoMatching/SMD-Nets/filenames/train2.txt --testing_file /home/rc/StereoMatching/SMD-Nets/filenames/test2.txt --results_path /home/rc/StereoMatching/SMD-Nets/output --name train --mode passive --batch_size 2 --num_epoch 1 --learning_rate 1e-4 --gamma 0.1 --crop_height 2048 --crop_width 1536 --num_sample_inout 5000 --aspect_ratio 1. --sampling dda --output_representation bimodal --backbone HSMNet
train data size:  92
test data size:  10
/home/rc/StereoMatching/SMD-Nets/checkpoints/train
Start Training
Traceback (most recent call last):
  File "/home/rc/StereoMatching/SMD-Nets/apps/train.py", line 196, in <module>
    train(opt)
  File "/home/rc/StereoMatching/SMD-Nets/apps/train.py", line 113, in train
    errors = net.forward(left, right, sample, labels=labels)
  File "/home/rc/StereoMatching/SMD-Nets/lib/model/SMDHead.py", line 108, in forward
    self.filter(left, right)
  File "/home/rc/StereoMatching/SMD-Nets/lib/model/SMDHead.py", line 23, in filter
    self.feat_list = self.stereo_network(left, right)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/rc/StereoMatching/SMD-Nets/lib/backbone/HSMNet/hsm.py", line 60, in forward
    conv4, conv3, conv2, conv1, enc0, enc1, enc2, enc3 = self.feature_extraction(torch.cat([left, right], 0))
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/rc/StereoMatching/SMD-Nets/lib/backbone/HSMNet/utils.py", line 80, in forward
    conv1 = self.convbnrelu1_1(x)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/rc/StereoMatching/SMD-Nets/lib/backbone/HSMNet/utils.py", line 154, in forward
    outputs = self.cbr_unit(inputs)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/container.py", line 119, in forward
    input = module(input)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 399, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/home/rc/anaconda3/envs/DL/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size [16, 3, 3, 3], expected input[4, 4, 2048, 1536] to have 3 channels, but got 4 channels instead

Process finished with exit code 1

The parameters I use are set like this
--dataroot /home/rc/StereoMatching/SMD-Nets/Dataset/UnrealStereo4K_00008 --checkpoints_path /home/rc/StereoMatching/SMD-Nets/checkpoints --training_file /home/rc/StereoMatching/SMD-Nets/filenames/train2.txt --testing_file /home/rc/StereoMatching/SMD-Nets/filenames/test2.txt --results_path /home/rc/StereoMatching/SMD-Nets/output --name train --mode passive --batch_size 2 --num_epoch 1 --learning_rate 1e-4 --gamma 0.1 --crop_height 2048 --crop_width 1536 --num_sample_inout 5000 --aspect_ratio 1. --sampling dda --output_representation "bimodal" --backbone HSMNet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant