pytorch-YOLOv4
pytorch-YOLOv4 copied to clipboard
tool/darknet2pytorch.py 不执行任何代码
大佬你好,在你的readme 文件中说明用darknet2pytoech 转化原有权重模型。但是这个py文件只有几个类,并不会执行任何代码,而且还有tool import 错误。请教一下大佬原本的思路是什么呢?
需要自己存一下:新建一个 .py file: from tool import darknet2pytorch import torch
model = darknet2pytorch.Darknet('./cfg/yolov4.cfg', inference=True) model.load_weights('./weights/yolov4.weights')
torch.save(model.state_dict(), './weights/yolov4-pytorch.pth')
Actually this shows the error as Convalution haven't activation layer.
by the way to How to convert yolov4.conv.137.weights into the .pth format?
需要自己存一下:新建一个 .py file: from tool import darknet2pytorch import torch
model = darknet2pytorch.Darknet('./cfg/yolov4.cfg', inference=True) model.load_weights('./weights/yolov4.weights')
torch.save(model.state_dict(), './weights/yolov4-pytorch.pth')
你好,我使用这段代码将yolov4.weights转化为pth文件,但运行时出现了如下错误 in load_state_dict RuntimeError: Error(s) in loading state_dict for Yolov4: Missing key(s) in state_dict : "dow1.conv1.conv.0.weight", "down1.con1.conv.1.weight", "down1.conv1.conv.1.bias" ....... Unexpected Key(s) in state_dict: "models.0.conv1.weight", "models.0.bnl.weight", "models.0.bnl.bias"
@myrzx 你好,我也出现了该问题,请问解决了吗
需要自己存一下:新建一个 .py file: from tool import darknet2pytorch import torch model = darknet2pytorch.Darknet('./cfg/yolov4.cfg', inference=True) model.load_weights('./weights/yolov4.weights') torch.save(model.state_dict(), './weights/yolov4-pytorch.pth')
你好,我使用这段代码将yolov4.weights转化为pth文件,但运行时出现了如下错误 in load_state_dict RuntimeError: Error(s) in loading state_dict for Yolov4: Missing key(s) in state_dict : "dow1.conv1.conv.0.weight", "down1.con1.conv.1.weight", "down1.conv1.conv.1.bias" ....... Unexpected Key(s) in state_dict: "models.0.conv1.weight", "models.0.bnl.weight", "models.0.bnl.bias"
I am facing exactly the same issue when converting darknet weights on a yolov4 model with 2 classes to pytorch weights. All the key names seem to be different @Tianxiaomo
@shuuny-matrix Convalution haven't activation layer merely a warning, meaning no layer named as activation this issue has been discussion before, search in this git should find it