-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
convert this project's .pth to darknet's .weights #292
Comments
maybe onnx? |
Here is the answer. |
create a new python file, import all requirements and copy the following lines in them model = Darknet("your .cfg file") model.load_state_dict(torch.load("your_ckpt.pth", map_location=torch.device('cpu'))) # for loading model on cpu model.save_weights(savedfile='your_ckpt.weights', cutoff=0) Hope it helps you |
Create a new python file, import all requirements and copy the following lines in them model = Darknet("your .cfg file") model.load_state_dict(torch.load("your_ckpt.pth", map_location=torch.device('cpu'))) # for loading model on cpu model.save_weights(savedfile='your_ckpt.weights', cutoff=0) Hope it helps you |
Create a new python file, import all requirements and copy the following lines in them model = Darknet("your .cfg file") model.load_state_dict(torch.load("your_ckpt.pth", map_location=torch.device('cpu'))) # for loading model on cpu model.save_weights(savedfile='your_ckpt.weights', cutoff=0) Hope it helps you |
We should add this file as a script to this git. With some command-line arguments. |
I think you mean that the Darknet python module import fails right? Make sure you ran Afterward, you should be able to import it like this: from pytorchyolo.models import Darknet |
I want to convert this project's .pth to darknet's .weights ,anyone else have some advice?
I try to load .pth to model, and then save modle's para to .weights , but I use it in darknet's get None detect result.
The text was updated successfully, but these errors were encountered: