vt-vl-lab / FGVC

[ECCV 2020] Flow-edge Guided Video Completion
Other
1.55k stars 263 forks source link

RuntimeError: Error keeps saying "to have 3 channels, but got 4 channels instead" #54

Closed crumbface909 closed 2 years ago

crumbface909 commented 3 years ago

Literally just keeps saying this:

Traceback (most recent call last): File "video_completion.py", line 613, in main(args) File "video_completion.py", line 576, in main video_completion_seamless(args) File "video_completion.py", line 402, in video_completion_seamless corrFlowF = calculate_flow(args, RAFT_model, video, 'forward') File "video_completion.py", line 120, in calculateflow , flow = model(image1, image2, iters=20, test_mode=True) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "/content/FGVC/RAFT/raft.py", line 101, in forward fmap1, fmap2 = self.fnet([image1, image2]) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/content/FGVC/RAFT/extractor.py", line 176, in forward x = self.conv1(x) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 396, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[2, 4, 72, 128] to have 3 channels, but got 4 channels instead

gaochen315 commented 3 years ago

Hi @crumbface909, it seems like your images have an additional alpha channel. So the code loads RGBA instead of RGB. I fixed it. Please clone the code and try again. Let me know if this solved the issue.