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 cac5a80a4d7..23557aa2ce1 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 @@ -12,25 +12,25 @@ Depending on a YOLO model version, the Model Optimizer converts it differently: ## 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 /yolov4.cfg /yolov4.weights +``` +- for YOLOv4-tiny: +```sh +python keras-YOLOv3-model-set/tools/model_converter/convert.py /yolov4-tiny.cfg /yolov4-tiny.weights ``` 4. Run Model Optimizer to converter the model from the TensorFlow 2 format to an IR: