Mukesh1729:

I am using the MSELoss() as my loss function with an Unet architecture. Basically, my model learns well but my inference turns out to be bad.


Are you training both models (Keras and PyTorch) from scratch and do both converge to approx. the same training loss? Afterwards, when trying to evaluate the model using the validation dataset you are seeing a worse validation loss in PyTorch only? If so, did you call model.eval() and made sure to use the same preprocessing on the validation samples in both approaches?



 Mukesh1729:

I have checked my code but I am not able to reproduce the same result while keeping all the parameters the same.


Does this mean that you are loading the trained parameters from Keras into the PyTorch model, but the output is still different?