I am trying to make a quantum network that would classify images of the Messidor dataset as DR or No DR. But i am getting this error
The first conv layer of your model (self.conv1
) uses a single input channel, while you are providing input image tensors with 3 channels.
Set in_channels=3
in self.conv1
or transform the input to have a single channel only.
PS: it’s better to post code snippets by wrapping them into three backticks ```, as it makes debugging easier.
you should be doing this
self.conv1 = nn.Conv2d(3, 6, kernel_size=80)
self.conv2 = nn.Conv2d(6, 16, kernel_size=80)
instead of
self.conv1 = nn.Conv2d(1, 6, kernel_size=80, in_channels=3) self.conv2 = nn.Conv2d(6, 16, kernel_size=80, in_channels=3)
This is how nn.Conv2d takes parameters.
nn.Conv2d(in_channels=3, out_channels=6, kernel_size=80)
in your case you had 1 as input parameter for no of input channels and again had in_channels=3.
i have posted another error please help
Your current input is too small for the model architecture and an intermediate activation would be empty after the pooling layer, so that you would either have to increase the spatial size of the input or change the architecture and remove some pooling ops.