Closed liudong315 closed 3 years ago
Hello, we are still sorting out this part of the code, you can simply use the following code to implement it.
_, cd_preds = torch.max(cd_preds, 1)
cd_preds = cd_preds.data.cpu().numpy()
cd_preds = cd_preds.squeeze() * 255
cv2.imwrite(file_path + '.png', cd_preds)
And note the batch size should be set to 1 when using this.
Okay, thank you for your advice. Looking forward to your later update of the relevant code.
Hello, after I added the code to save the picture, the accuracy of the val set I got was very low. What is the situation? INFO:root:EPOCH 40 VALIDATION METRICS{'cd_losses': 3.6140425014567423, 'cd_corrects': 90.64542682589175, 'cd_precisions': 0.491048978484091, 'cd_recalls': 0.1381559313391155, 'cd_f1scores': 0.17627280467674486, 'learning_rate': 1.5625000000000007e-05}
Could you provide more configuration information? How did it perform before adding this code? I suggest that you separate the training and testing/saving processes. It is difficult to make the model converge if the batch size is set to 1 during training.
Hello, I directly put the code you gave into the verification code, and set the batchsize to 1. Is there a better way to save it? Also, is it convenient to add a contact method.
I think you can temporarily refer to the relevant code in train.py and write a testing/saving .py file. You can contact me at liky1215@163.com.
OK,thank you!
Hello, author! Thank you for the code, I would like to ask if you have written a visualization module and a saving result image module in the code.