Fine-tuning Reset50

I am new to Pytorch and CNN and am currently working on this network but as I increase the batch size or change the learning rate it doesn’t seem to improve. I have been reading about changing the last layers. I am not sure how to implement that in my current model, though. Any ideas on how I could do that? Thanks.

transformations = transforms.Compose([
    #transforms.Resize((800,600),interpolation=Image.BICUBIC),
    transforms.Resize(256),
    transforms.RandomHorizontalFlip(),
    transforms.RandomVerticalFlip(),
    transforms.ColorJitter(brightness=0.1,saturation=10,contrast=30,hue=0.1),
    #transforms.CenterCrop(224),
    transforms.ToTensor()])

resnet50=models.resnet50()

# Change the last layer
num_ftrs = resnet50.fc.in_features
resnet50.fc = nn.Linear(num_ftrs, 17)

model =resnet50.to(device)
print(model)
optimizer = torch.optim.SGD(model.parameters(), lr=LR)
criterion = nn.BCEWithLogitsLoss()

@ptrblck Any guide you can give me? Please :pray:

Are you finetuning Resnet50 on any custom dataset? Can you give more info about the loss/accuracy values?

Is this a multi-label classification problem? Also make sure there is no nn.Sigmoid module at the end of the network output since you are using nn.BCEWithLogitsLoss().