I have modified a resnet18 network as follows:
model = torchvision.models.resnet18()
model.conv1 = nn.Conv2d(num_input_channel, 64, kernel_size=7, stride=2, padding=3,bias=False)
model.avgpool = nn.AdaptiveAvgPool2d(1)
model.fc = nn.Linear(512 * torchvision.models.resnet.BasicBlock.expansion,2)

and I use nn.CrossEntropyLoss() as the loss function and I provide the labels just as class numbers (0 or 1), but the performance is very poor (worse than a dummy classifier). I would like to make sure if the resnet modification is correct for binary classification.