junyuchen245 / TransMorph_Transformer_for_Medical_Image_Registration

TransMorph: Transformer for Unsupervised Medical Image Registration (PyTorch)
MIT License
453 stars 76 forks source link

Loss do not decrease. #55

Closed GuoLiting closed 1 year ago

GuoLiting commented 1 year ago

Hi, I have some problems with affine model training. I use the affine model for skull registration, but the loss does not decrease during training. What parameters do I need to adjust to solve this problem? Thanks for your reply.

junyuchen245 commented 1 year ago

I've come across a similar problem before. It's probably related to the NCC loss from VoxelMorph: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/9c34ac92ec4626c88714fd2336aaff59c163e626/TransMorph/losses.py#L211C7-L211C14 , which doesn't seem to descrease with Pytorch versions later than 1.9.1. Try exploring alternative loss functions or take a look at my implementation of NCC using a Gaussian kernel, available here: https://github.com/junyuchen245/TransMorph_DCA/blob/09e32758e5788a358c8543ca61fe0cc76e75b0dc/OASIS/losses.py#L9C7-L9C16