RuntimeError: Given groups=1, weight of size 64 2 7 7, expected input[100, 1, 512, 512] to have 2 channels, but got 1 channels instead

Hi, everyone. When I ran flownet, got this error, can anyone help me?
This is the place where the error was started, from ‘‘flow_pyramid_pred = [torch.nn.functional.interpolate(model(img_pyramid[-1])[0], size=(256, 256))]’’

And the torch.size of my dataset is [100,1,512,512]

And this is the code of flownet-S

It seems the default in_channels value is set to 2, while your input data has only a single channel.
Set in_channels=1 in your model initialization and run the code again.

PS: It’s always better to post directly by wrapping it in three backticks ``` :wink:

Thanks for your reply!!
but actually i want to input 2 images into flownet, so the in_channel is 2, i really don’t know how could I do it in my code(from [100,1,512,512] to [50,2,512,512]).

If you would like to input two image, would you like to concatenate them in the channel dimension or handle them separately, e.g. by calling the forward method on both images separately?