My code is a bit lengthy, but what i am wondering is where do i change the channel input for the network, the network i am training takes in 1 channel and the images i have,have 4 channels.This is the error i get when i try to train it
RuntimeError Traceback (most recent call last)
<ipython-input-336-8e1b70ff88e8> in <module>()
16 for epoch in range(0, num_epochs):
17 # train for one epoch
---> 18 curr_loss = train(train_loader, model, criterion, epoch, num_epochs)
19
20 # store best loss and save a model checkpoint
<ipython-input-334-a6512205648d> in train(train_loader, model, criterion, epoch, num_epochs)
12 # compute output
13 optimizer.zero_grad()
---> 14 outputs = model(images)
15
16 # measure loss
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
323 for hook in self._forward_pre_hooks.values():
324 hook(self, input)
--> 325 result = self.forward(*input, **kwargs)
326 for hook in self._forward_hooks.values():
327 hook_result = hook(self, input, result)
<ipython-input-332-5c12062f256d> in forward(self, x)
66
67 def forward(self, x):
---> 68 block1 = self.conv_block1_64(x)
69 pool1 = self.pool1(block1)
70
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
323 for hook in self._forward_pre_hooks.values():
324 hook(self, input)
--> 325 result = self.forward(*input, **kwargs)
26 for hook in self._forward_hooks.values():
32 7 hook_result = hook(self, input, result)
<ipython-input-332-5c12062f256d> in forward(self, x)
10
11 def forward(self, x):
---> 12 out = self.activation(self.conv(x))
13 out = self.activation(self.conv2(out))
14
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
323 for hook in self._forward_pre_hooks.values():
324 hook(self, input)
--> 325 result = self.forward(*input, **kwargs)
326 for hook in self._forward_hooks.values():
327 hook_result = hook(self, input, result)
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/conv.py in forward(self, input)
275 def forward(self, input):
276 return F.conv2d(input, self.weight, self.bias, self.stride,
--> 277 self.padding, self.dilation, self.groups)
278
279
/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py in conv2d(input, weight, bias, stride, padding, dilation, groups)
88 _pair(0), groups, torch.backends.cudnn.benchmark,
89 torch.backends.cudnn.deterministic, torch.backends.cudnn.enabled)
---> 90 return f(input, weight, bias)
91
92
RuntimeError: Given groups=1, weight[64, 1, 3, 3], so expected input[8, 4, 256, 256] to have 1 channels,but got 4 channels instead
Any suggestions would be helpful,
If you need the code,kindly let me know