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

about loss and batchsize #17

Closed havecats closed 4 months ago

havecats commented 6 months ago

Hello there! Thank you for your excellent work! I have a few questions I'd like to ask you:

I'm curious about the behavior of the loss function. Does it typically converge gradually towards -1? I've noticed that when applying C2FViT on my dataset, the loss increases from around -0.5 to approximately -0.05, which seems unusual.

I've noticed that you've set the batch_size to 1. Have you considered experimenting with larger batch sizes? In similar tasks, what is the typical approach to setting the batch size?

Thank you for your time and assistance.

cwmok commented 6 months ago

Hi @havecats,

Thanks for your interest in our work!

Does it typically converge gradually towards -1?

Yes, it should converge gradually towards -1. (because of the negative NCC loss)

I've noticed that when applying C2FViT on my dataset, the loss increases from around -0.5 to approximately -0.05, which seems unusual.

This is unusual. Which dataset are you using?

I've noticed that you've set the batch_size to 1. Have you considered experimenting with larger batch sizes? In similar tasks, what is the typical approach to setting the batch size?

I haven't tried batch_size > 1. I think you have to modify the NCC loss a little bit in order to make it work. Typically, for brain registration, batch_size = 1 is sufficient because brain MR is relatively easy and clean for registration.