I’m trying to use per-trained ResNet-18 model for binary classification with modification in input channel and kernel size of 1st Conv layer. What is the best way to do this? Also does this approach uses pretrained weight for conv1 layer?Currently I’m trying like this
import torch
from torchvision.models import resnet18
net = resnet18(pretrained=False) # You should put 'True' here
net.conv1 = torch.nn.Conv1d(1, 64, (7, 7), (2, 2), (3, 3), bias=False)
batch = torch.rand(4, 1, 224, 224) # in the NCHW format
net(batch).size()