My training code can be seen here:
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.