I am attaching the url of the jupyter notebook. I can’t seem to figure out why my loss is not decreasing. I have been stuck on this for 3 days, any help is very much appreciated. The command to download the data is in the jupyter notebook.

  
      
      Google Docs
  
  
    

Nuclei Detection Keras.ipynb 11

Colaboratory notebook


  
  
    
    
  
  


Labels shape: (batch_size, 1, 256, 256)
Prediction shape: (batch_size, 1, 256, 256)
Is something wrong with how I calculate loss?
for epoch in range(15):
    for i, data in enumerate(trainloader):
        inputs, labels = data
        inputs = Variable(inputs.cuda())
        labels = Variable(labels.cuda())
        
        # forward + backward + optimize
        
        # zeroes the gradient buffers of all parameters
        optimizer.zero_grad()
        #forward pass
        outputs = model_pytorch(inputs)
        # calculate the loss
        loss = loss_function(outputs, labels)
        # backpropagation
        loss.backward()
        # Does the update after calculating the gradients
        optimizer.step()
        
        if (i+1) % 5 == 0:
            print('[%d, %5d] loss: %.4f' % (epoch, i+1, loss.data[0]))

Image of loss values

loss.png1366×768 173 KB