PyTorch-YOLOv3
PyTorch-YOLOv3 copied to clipboard
convert this project's .pth to darknet's .weights
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.
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.
maybe onnx?
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.
Here is the answer. https://kevin970401.github.io/etc/2018/12/26/converting-models.html
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) print("successfully converted .pth to .weights")
Hope it helps you
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.
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) print("successfully converted .pth to .weights")
Hope it helps you
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.
maybe onnx?
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) print("successfully converted .pth to .weights")
Hope it helps you
We should add this file as a script to this git. With some command-line arguments.
Hi, which model to import while doing this? Can anyone guide me on this? I am unable to import Darknet, is there anything else, i can try? @Flova @aarkey81
I think you mean that the Darknet python module import fails right?
Make sure you ran poetry shell
in your terminal if you use poetry.
Afterward, you should be able to import it like this:
from pytorchyolo.models import Darknet