voxelmorph / voxelmorph

Unsupervised Learning for Image Registration
Apache License 2.0
2.32k stars 583 forks source link

Mutual information loss in Pytorch. #477

Open jw4hv opened 2 years ago

jw4hv commented 2 years ago

Can we have the loss library for mutual information in PyTorch as well? It seems this part of the calculation is wrapped in Tenserflow and cannot be plugged into PyTorch-based programs.

adalca commented 2 years ago

Sorry we haven't had much time to build new tools, but if you are familiar with pytorch perhaps you could do a line by line translation from the tensorflow code? It should be quite doable?

jw4hv commented 2 years ago

Yes, this is total fine by me! Could you share me the code of mutual information in tensorflow if you have? In current version, I see this package is wrapped but cannot see the source code.

adalca commented 2 years ago

Great! which part do you not see? it should all be there in neurite.

adalca commented 2 years ago

top-level class: https://github.com/adalca/neurite/blob/249d4978c706fc21c87e192bb11a4d20169cafc5/neurite/tf/metrics.py#L41

Of course, if you translate this it would be great if you can push it to neurite or vxm :)