It seems that the validation function is related to the problem of saving weights in 2d tasks......
Medical-sam2 is a great work in the field of medical segmentation. I trained the model on a certain 2D dataset, and both the convergence and validation results were very good. However, when I loaded the saved checkpoint, the model degenerated into random predictions (it seems that the saved checkpoint is exactly the same as the untrained sam2 original checkpoint). I noticed that similar issues have been raised before (#9), but currently, there seems to be no clear solution or code update. Is there any way for me to correctly save the trained weights for further use?
It seems that the validation function is full of magic… I admit that removing it before training (epoch==0) brought catastrophic consequences to weight saving, namely the chaos in weight saving… Obviously, the lesson I learned from this is that I must strictly adhere to the original code, but I am still curious why this magical validation_sam function would have an impact on weight saving…