yolov4 conversion documentation is incorrect (#9143)

* Rewrite doc

* added addition info abot weights and cfg files

* fix path to cfg and weights

* fix description

* fix description

* fix description

* fix description

* fix description

* fix description
This commit is contained in:
Eugeny Volosenkov 2022-01-17 12:32:18 +03:00 committed by GitHub
parent a76483ddb2
commit 0948a54f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 13 deletions

View File

@ -12,25 +12,25 @@ Depending on a YOLO model version, the Model Optimizer converts it differently:
## <a name="yolov4-to-ir"></a>Convert YOLOv4 Model to IR
This section explains how to convert the YOLOv4 Keras\* model from the [https://github.com/Ma-Dan/keras-yolo4](https://github.com/Ma-Dan/keras-yolo4]) repository to an IR. To convert the YOLOv4 model, follow the instructions below:
This section explains how to convert the YOLOv4 Keras\* model from the [https://github.com/david8862/keras-YOLOv3-model-set](https://github.com/david8862/keras-YOLOv3-model-set) repository to an IR. To convert the YOLOv4 model, follow the instructions below:
1. Download YOLOv4 weights from [yolov4.weights](https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT).
1. Download YOLOv4 weights and associated with it cfg file:
- for YOLOv4 ([weights](https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights)/[config file](https://github.com/david8862/keras-YOLOv3-model-set/raw/6c9aff7bb0c1660704ad07c85739e95885676e5b/cfg/yolov4.cfg))
- for YOLOv4-tiny ([weights](https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights)/[config file](https://raw.githubusercontent.com/david8862/keras-YOLOv3-model-set/6b4a0ee63771262363e8224b0ee915cad6c5e93e/cfg/yolov4-tiny.cfg))
2. Clone the repository with the YOLOv4 model.
2. Clone the repository with the YOLOv4 model:
```sh
git clone https://github.com/Ma-Dan/keras-yolo4.git
```
3. Convert the model to the TensorFlow 2\* format. Save the code below to the `converter.py` file in the same folder as you downloaded `yolov4.weights` and run it.
```python
from keras-yolo4.model import Mish
model = tf.keras.models.load_model('yolo4_weight.h5', custom_objects={'Mish': Mish})
tf.saved_model.save(model, 'yolov4')
git clone https://github.com/david8862/keras-YOLOv3-model-set
```
3. Convert the model to the TensorFlow 2\* format:
- for YOLOv4:
```sh
python converter.py
python keras-YOLOv3-model-set/tools/model_converter/convert.py <path_to_cfg_file>/yolov4.cfg <path_to_weights>/yolov4.weights <saved_model_dir>
```
- for YOLOv4-tiny:
```sh
python keras-YOLOv3-model-set/tools/model_converter/convert.py <path_to_cfg_file>/yolov4-tiny.cfg <path_to_weights>/yolov4-tiny.weights <saved_model_dir>
```
4. Run Model Optimizer to converter the model from the TensorFlow 2 format to an IR: