cwmok / C2FViT

This is the official Pytorch implementation of "Affine Medical Image Registration with Coarse-to-Fine Vision Transformer" (CVPR 2022), written by Tony C. W. Mok and Albert C. S. Chung.
MIT License
132 stars 4 forks source link

Model training problem #3

Closed Yongxin1120 closed 2 years ago

Yongxin1120 commented 2 years ago

Hi,

I encountered a problem when running the source code. Training loss is always negative, Sim_ NCC has always been a negative number. I have not changed any structure of the code and the data is correct. What is the problem and how can I solve it.

image

Best, Yongxin

cwmok commented 2 years ago

Hi Yongxin,

Negative loss is normal since we are using negative NCC for loss function. See https://github.com/cwmok/C2FViT/blob/6f5ce870b53c712e930675e5399790860fe2a48a/Code/C2FViT_model.py#L724.