-
Notifications
You must be signed in to change notification settings - Fork 421
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
HELP!How can I retrieve the best_model? #2651
Comments
This is more of a PyTorch Lightning question than a TorchGeo question. If you are using the Python interface, you can use: trainer.test(model=model, datamodule=datamodule, ckpt_path='best') See the Trainer docs for more details. If you are using the command-line interface, I actually don't know of an automatic way to obtain the best-performing model. The models are saved in default_root_dir, which defaults to the current directory. You should find a |
Thank you so much for your answer—it was incredibly helpful! I'm still a beginner in this field, so to clarify: does using YAML config files for training mean I cannot retrieve the best_model? If that’s the case, I’ll find it very challenging, as there might be overfitting during training, and I wouldn’t even realize it. |
You can, it's just not automatic. I would recommend using something like TensorBoard to view all training runs and select the best model that seems to avoid overfitting. The filename in TensorBoard can then be found on your filesystem. To be honest, TorchGeo is not as easy to use as I would like if you aren't already familiar with PyTorch/torchvision/Lightning. If you are a beginner, I would highly recommend reading the documentation for those libraries, as TorchGeo basically builds on top of PyTorch/Lightning with a similar API as torchvision. Of course, that's no excuse, and I hope to improve the docs in the future. If you find anything unclear and would like to submit a PR to add additional hints to the docs, I would be happy to review! At the very least, you could add |
Thank you so much for your prompt responses! Your guidance is incredibly valuable as I navigate learning deep learning. I’ve encountered numerous challenges while using TorchGeo, but there’s no one around me to provide timely and accurate answers. Once again, I deeply appreciate your support! |
You can also join our Slack workspace, there are hundreds of other TorchGeo users who can answer your questions and an entire |
Oof, the Great (Fire)Wall of China strikes again. I would definitely not recommend using a VPN to make an account 😉. It seems like creating a new account is blocked, but using an existing account is not? |
Thank you for your guidance! If possible, I’d like to ask one more question: 1.My dataset format is similar to LandcoverAI, so I chose the LandcoverAI dataset format for training. This is the issue I’m facing. It might be a bit tedious, but I sincerely hope you can guide me on how to fix this and successfully train my model. |
What does your YAML file look like? Can you share the full stack trace from your error message? That error doesn't appear to come from TorchGeo, so I don't know how to reproduce it. |
Issue
How can I retrieve the best_model? Where are the models saved after each training session? Additionally, how do I obtain the best-performing model from this training run?
Fix
No response
The text was updated successfully, but these errors were encountered: