Skip to content

RuntimeError: Need input.size[1] == 3 but got 4 instead. #5

@lclin1010

Description

@lclin1010

When I run :

python demo.py --model_name DenseASPP161 --model_path ./weights/denseASPP161.pkl --img_dir ./img

I got this:

loading pre-trained weight
1.png
Traceback (most recent call last):
File "demo.py", line 19, in
infer.folder_inference(args.img_dir, is_multiscale=False)
File "/home/dl/code/DenseASPP/inference.py", line 71, in folder_inference
pre = self.single_inference(img)
File "/home/dl/code/DenseASPP/inference.py", line 94, in single_inference
pre = self.seg_model.forward(image)
File "/home/dl/code/DenseASPP/models/DenseASPP.py", line 114, in forward
feature = self.features(_input)
File "/home/dl/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/home/dl/anaconda2/lib/python2.7/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/home/dl/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/home/dl/anaconda2/lib/python2.7/site-packages/torch/nn/modules/conv.py", line 254, in forward
self.padding, self.dilation, self.groups)
File "/home/dl/anaconda2/lib/python2.7/site-packages/torch/nn/functional.py", line 52, in conv2d
return f(input, weight, bias)
RuntimeError: Need input.size[1] == 3 but got 4 instead.

Do you know what is the problem? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions