Rafiur
Rafiur

Reputation: 1

How to convert yolov4 weights.wt to pytorch weights .pt?

I was trying out the yolov4 from https://github.com/theAIGuysCode/YOLOv4-Cloud-Tutorial and I wanted to convert the weights from .wt files to .pt files for pytorch Is there a way I can do that?

Upvotes: 0

Views: 7592

Answers (1)

Stanley
Stanley

Reputation: 839

Pytorch YOLOv4 (I am biased as I am a maintainer) has the ability to do this with darknet2pytorch. The following is an example snippet

from tool.darknet2pytorch import Darknet
WEIGHTS = Darknet(cfgfile)
WEIGHTS.load_weights(weightfile)

Where cfgfile is your darknet config.cfg file, and weightfile is your darknet .wt weights.

WEIGHTS is now an ordinary PyTorch model, which you can save however you'd like.

Upvotes: 2

Related Questions