ArjunNarayanan / LinFlo-Net

Diffeomorphic whole heart mesh generation
MIT License
3 stars 0 forks source link

"pretrained_linear_transform" in /config/flow_deformation.yml #3

Open shijinjin12 opened 1 month ago

ArjunNarayanan commented 1 month ago

This should be the path to the linear transformation model that you trained. See "Training the model" section in the ReadMe.

shijinjin12 commented 1 month ago

This should be the path to the linear transformation model that you trained. See "Training the model" section in the ReadMe. We have completed the "Training LinearnTransformation module" step according to the readme documentation and have generated the following file under the output folder, But we don't know which file is required for "pretrained_linear_transform" Screenshot from 2024-05-24 11-14-47

ArjunNarayanan commented 1 month ago

It’s the path to the file best_model.pth

shijinjin12 commented 1 month ago

Thank you very much for your answer. I'll have a try!

shijinjin12 commented 1 month ago

It’s the path to the file best_model.pth

We placed best_model.pth generated in the previous step according to your method, but the following error occurred. We are not sure what the problem is, and would like to ask you for advice afb0bb5554fc5158fb75a13e118c56b cf3abbbff687663510de13d28bc8b35

ArjunNarayanan commented 1 month ago

Ah I see. best_model.pth contains the model as well as the optimizer and other information required to restart training if necessary. Try doing this in a python console:

checkpoint_path = <set this as the path to best_model.pth from the linear transformation training>
model = torch.load(checkpoint_path, map_location=torch.device("cpu"))["model"]
save_path = <set this as the path where you would like to save the linear transform>
torch.save(model, save_path)

This should extract just the trained model and save it at save_path. When you are training the flow module, set pretrained_linear_transform to save_path that you used above.

shijinjin12 commented 1 month ago

Ah I see. best_model.pth contains the model as well as the optimizer and other information required to restart training if necessary. Try doing this in a python console:

checkpoint_path = <set this as the path to best_model.pth from the linear transformation training>
model = torch.load(checkpoint_path, map_location=torch.device("cpu"))["model"]
save_path = <set this as the path where you would like to save the linear transform>
torch.save(model, save_path)

This should extract just the trained model and save it at save_path. When you are training the flow module, set pretrained_linear_transform to save_path that you used above. It really works. Thank you very much!

ArjunNarayanan commented 1 month ago

Glad it works!

Arjun Narayanan

On Tue, May 28, 2024 at 6:34 PM shijinjin12 @.***> wrote:

Ah I see. best_model.pth contains the model as well as the optimizer and other information required to restart training if necessary. Try doing this in a python console:

checkpoint_path = model = torch.load(checkpoint_path, map_location=torch.device("cpu"))["model"] save_path = torch.save(model, save_path)

This should extract just the trained model and save it at save_path. When you are training the flow module, set pretrained_linear_transform to save_path that you used above. It really works. Thank you very much!

— Reply to this email directly, view it on GitHub https://github.com/ArjunNarayanan/LinFlo-Net/issues/3#issuecomment-2136359050, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSMYZPVQHVP5QW5IBWOVHDZEUWD5AVCNFSM6AAAAABIGXXHRGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZWGM2TSMBVGA . You are receiving this because you commented.Message ID: @.***>