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

Train_C2FViT_pairwise #2

Closed gaucijean closed 2 years ago

gaucijean commented 2 years ago

I am trying to train a C2FViT model using OASIS dataset 2D only. I set up everything fine, however, when I run the training an error crops up during the interpolate.

C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\nn\functional.py:4311: UserWarning: Since version 1.3.0, affine_grid behavior has changed for unit-size grids when align_corners=True. This is not an intended use case of affine_grid. See the documentation of affine_grid for details. warnings.warn( Traceback (most recent call last): File "C:\Users\User\Desktop\Jean Gauci\C2FViT\Code\Train_C2FViT_pairwise.py", line 219, in train() File "C:\Users\User\Desktop\Jean Gauci\C2FViT\Code\Train_C2FViT_pairwise.py", line 89, in train X = F.interpolate(X, scale_factor=0.5, mode="trilinear", align_corners=True) File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\nn\functional.py", line 3941, in interpolate return torch._C._nn.upsample_trilinear3d(input, output_size, align_corners, scale_factors) RuntimeError: Input and output sizes should be greater than 0, but got input (D: 160, H: 192, W: 1) output (D: 80, H: 96, W: 0)

cwmok commented 2 years ago

Hi @gaucijean,

Currently, this repository only supports 3D registration. For 2D registration, you may easily use a convex optimization algorithm to find the global optimal solution, e.g., using ANTs.

gaucijean commented 2 years ago

Thank you for your answer!