[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
This commit is contained in:
Pavel Esir 2021-06-30 15:22:31 +03:00 committed by GitHub
parent 9d93c09e24
commit 50a9ea0b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,11 +174,24 @@ cd darkflow
#### <a name="yolov1-v2-to-tf"></a>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:<br>
For Yolo V1:
```sh
python3 ./flow --model <path_to_model>/<model_name>.cfg --load <path_to_model>/<model_name>.weights --savepb
python3 flow --model yolov1.cfg --load yolov1.weights --savepb
```
If the model was successfully converted, you can find the `<model_name>.meta` and `<model_name>.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 <path_to_model>/<model_name>.cfg --load <path_to_model>/<model_name>.weights --labels <path_to_dataset_labels_file> --savepb
```
Where argument `--labels` for Yolo V1 can be skipped. If the model was successfully converted, you can find the `<model_name>.meta` and `<model_name>.pb` files
in `built_graph` subdirectory of the cloned DarkFlow repository.
File `<model_name>.pb` is a TensorFlow representation of the YOLO model.