From 50a9ea0b144983ad1a252699b3976d0aa177f328 Mon Sep 17 00:00:00 2001 From: Pavel Esir Date: Wed, 30 Jun 2021 15:22:31 +0300 Subject: [PATCH] [doc] Corrections for Yolo V1 and V2 conversion (#6283) * added corrections for Yolo V1 and V2 * changed order of conversion commands : v1 goes first general last * aligned line endings * added commit hash --- .../tf_specific/Convert_YOLO_From_Tensorflow.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_YOLO_From_Tensorflow.md b/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_YOLO_From_Tensorflow.md index eb2a1611e02..60674b1c768 100644 --- a/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_YOLO_From_Tensorflow.md +++ b/docs/MO_DG/prepare_model/convert_model/tf_specific/Convert_YOLO_From_Tensorflow.md @@ -174,11 +174,24 @@ cd darkflow #### Convert DarkNet\* YOLOv1 or YOLOv2 Model to TensorFlow\* To convert YOLOv1 or YOLOv2 model to TensorFlow, go to the root directory of the cloned DarkFlow repository and run the following command:
+For Yolo V1: ```sh -python3 ./flow --model /.cfg --load /.weights --savepb +python3 flow --model yolov1.cfg --load yolov1.weights --savepb ``` -If the model was successfully converted, you can find the `.meta` and `.pb` files +For Yolo V2 with VOC dataset `--labels` argument should be specified and additional changes in the original exporting script are required. +In the file [https://github.com/thtrieu/darkflow/blob/b187c65/darkflow/utils/loader.py#L121](https://github.com/thtrieu/darkflow/blob/b187c65630f9aa1bb8b809c33ec67c8cc5d60124/darkflow/utils/loader.py#L121) +change line 121 from `self.offset = 16` to `self.offset = 20`. Then run: +```sh +python3 flow --model yolov2-voc.cfg --load yolov2-voc.weights --labels voc-labels.txt --savepb +``` +voc-labels can be found by the following link https://raw.githubusercontent.com/szaza/android-yolo-v2/master/assets/tiny-yolo-voc-labels.txt + +General conversion command is: +```sh +python3 flow --model /.cfg --load /.weights --labels --savepb +``` +Where argument `--labels` for Yolo V1 can be skipped. If the model was successfully converted, you can find the `.meta` and `.pb` files in `built_graph` subdirectory of the cloned DarkFlow repository. File `.pb` is a TensorFlow representation of the YOLO model.