【Tensorflow】Darknet的yolov3.weights文件转换成tensorflow的ckpt或者pb文件

1、下载源码

git clone https://github.com/mystic123/tensorflow-yolo-v3.git
cd tensorflow-yolo-v3

2、转换

以coco数据集训练的权重文件为例。python

下载coco.namesgit

下载yolov3.weights或者yolov3-tiny.weightsgithub

1. 转换成ckpt文件格式

YOLOv3:bash

python convert_weights.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights

默认在当前文件夹下新建一个saved_model文件夹,里面是转换生成的文件:code

YOLOv3-tiny:orm

python convert_weights.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

2. 转换成pb文件格式

YOLOv3:blog

python convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights

默认在当前文件夹下生成一个pb文件:get

YOLOv3-tiny:源码

python convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny

若是是转换本身训练的数据集,则将coco.names和yolov3.weights替换成本身相应的文件就能够了。it