My training code can be seen here:

  
    
    
    Model Accuracy stuck at 0.5 though Loss is consistently decreasing vision
  
  
    This is using PyTorch 
I have been trying to implement UNet model on my images, however, my model accuracy is always exact 0.5. Loss does decrease. 
I have also checked for class imbalance. I have also tried playing with learning rate. Learning rate affects loss but not the accuracy. 
My architecture below ( from here ) 
""" `UNet` class is based on https://arxiv.org/abs/1505.04597

The U-Net is a convolutional encoder-decoder neural network.
Contextual spatial information (from the decoding,
ex…
  


I am able to train the model now.
However, when I test it on validation dataset (15 epocs), it gives me different results everytime I train it again for same input data (images). How can I get a stable good value?
    model = torch.load(model_path)
    model.eval()
    total_acc = 0
    
    for idx in range(len(data_test)):        
        with torch.no_grad():
#             chips_x, chips_y = data_test.get_item_xarray(idx)
            X, y = data_test[idx]  

            image_t = Variable(torch.from_numpy(X)).to(device) # [batch, channel, H, W]
            input_cloud = Variable(torch.from_numpy(y)).to(device) # [batch, channel, H, W]

            output_t = model(image_t)
            preds = output_t > 0
#             print("preds in loop:", preds)
            acc = accuracy_check_for_batch(input_cloud, preds, image_t.size()[0])
            total_acc = total_acc + acc

P.S. I am saving the entire model and not just the weights.