原文地址:https://blog.csdn.net/heiheiya/article/details/91437196
感謝 heiheiya 。
做個學習筆記
一、下載源碼
git clone https://github.com/mystic123/tensorflow-yolo-v3.git cd tensorflow-yolo-v3
1. 轉換成ckpt文件格式
YOLOv3:
python convert_weights.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights
默認在當前文件夾下新建一個saved_model文件夾,里面是轉換生成的文件
2. 轉換成pb文件格式
YOLOv3:
python convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights
默認在當前文件夾下生成一個pb文件
YOLOv3-tiny:
python convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3-tiny.weights --tiny
如果是轉換自己訓練的數據集,則將coco.names和yolov3.weights替換成自己相應的文件就可以了。