-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The use of the checkpoint file in inference #14
Comments
Hi, Currently, we only support the original weights in the extractor, but I agree it would be useful to allow initialization from a custom checkpoint. I’ll work on implementing this feature as soon as possible. In the meantime, you can try the following workaround: import torch
from geocalib import GeoCalib
model = GeoCalib()
# Load the model from the checkpoint
checkpoint_path = "path/to/checkpoint" # should be something like 'outputs/training/<run name>'
state_dict = torch.load(f"{checkpoint_path}/checkpoint_best.tar", map_location="cpu")
model.model.flexible_load(state_dict["model"]) Note: This method will work only if there are no architectural changes in your configuration. Let me know if you run into any issues! |
You can now load your custom weights by passing the path to the corresponding checkpoint. If you’ve made changes to the architecture, make sure to use the extractor from siclib: from siclib.models.extractor import GeoCalib
checkpoint_path = "path/to/checkpoint" # usually something like 'outputs/training/<run name>/checkpoint_best.tar'
model = GeoCalib(weights=checkpoint_path) |
Thank you very much for your answers and help!!! I will use your method and keep in touch with you in the future! |
Hello,
First of all, I would like to sincerely thank you for your work and for providing the code. I have a question to ask: if I create a custom dataset and train it, is the resulting ‘’checkpoint‘’ file only usable for evaluation? I used inference and noticed that the model options are set to "pinhole," "simple_radial," etc., but I didn't see my custom dataset-trained ''checkpoint'' file being used in the inference. Also, I didn't see how to specify the custom-trained checkpoint file in the inference process.
The text was updated successfully, but these errors were encountered: