- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am following openvino documentation for converting YoloV4 model to IR. In the process given, the 3rd step is that where i am getting error while loading yolov4 darknet model. I am using YoloV4 darknet custom model to do tensorflow conversion.
Pl explain me how to properly execute the 3rd step of the process ?
Here is a link to docs content : https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vk_007,
Thanks for reaching out.
Would you share the error that you see? Are you getting errors when running the converter.py script? Please share your models and all the relevant files(.weights file,.cfg file,.h5) for us to test it on our end.
Regards,
Aznie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @IntelSupport , thanks for the response,
I am actually getting error while converting my yolov4 darknet model to keras format.
Error is "TypeError: buffer is too small for requested array"
Here is a screenshot of error:
I am using this github repo to convert yolov4 darknet to keras format which is given in the steps of docs.
Github repo link : https://github.com/Ma-Dan/keras-yolo4
And where should i share weights & cfg files?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vk_001,
The error is caused by the mismatch between the config file and weights file. I have tried the same workaround and got the same error as you.
To solve that, I just skip the convert.py step and download the yolov4_weight.h5 file directly from this repository:
https://github.com/bubbliiiing/yolov4-keras/releases/
The yolov4.weight file you can get from the repo before at their first step. Then, proceed to run the converter.py with some code editing as below:
from yolo4.model import Mish
import tensorflow as tf
model = tf.keras.models.load_model('yolo4_weight.h5', custom_objects={'Mish': Mish})
tf.saved_model.save(model, 'yolov4')
Make sure the weights file,.h5 file and converter.py are in the same folder(Keras-yolo4). After running converter.py, a saved_model_dir (assets, variables,saved_model.pb) is generated and successfully converts to Intermediate Representation(IR) of OpenVINO.
Command to convert .pb into IR format:
python mo.py --saved_model_dir yolov4 --input_shape [1,608,608,3] --output_dir yolov4
Regards,
Aznie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @IntelSupport ,
FYI, I am using custom Yolov4 darknet weights file, Then how can i generate it in .h5 format ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi VK_001,
It seems like there is a missing python module from the script in the repository. There are many users who encountered the same error:
https://github.com/Ma-Dan/keras-yolo4/issues/21
Unfortunately, the repository is out of our control. However, there are some folks that able to get the .pb file using this link: git clone https://github.com/Runist/YOLOv4/
Then, save the code below to the converter.py file in the same folder of your yolov4.weights and run it to get the .pb file.
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')
I hope this will help you.
Regards,
Aznie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi VK_007,
This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.
Regards,
Aznie
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page