Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Convert custom YOLOV3 to IR

huang__kuang_chieh
363 Views

As shown in the title, Could you tell me maybe some step is wrong in my process ?

  1. I have trained a YOLOV3 model for defect detection by keras and convert .h5 to .weights file.(just modify the file name)
  2. Following the code convert  to .pb file.

           python3 convert_weights_pb.py --class_names voc_C1.txt --data_format NHWC --weights_file trained_weights_final.weights

       3.Following the code convert .pb to IR.

     python3 mo_tf.py
     --input_model /path/to/frozen_darknet_yolov3_model.pb
     --tensorflow_use_custom_operations_config data.json
     --batch 1

        4.data.json I just modify classes from 80 to 2(number of my classes)

        5.Attachments are my trained_weights_final.h5, voc_C1.txt and data.json.

Thanks for your help,hope to get the news soon.

Colin.

0 Kudos
1 Reply
Shubha_R_Intel
Employee
363 Views

Dear huang, kuang chieh, 

you left off "anchors" in your *.json file - which will probably cause Model Optimizer to produce incorrect IR.

 "anchors": [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326],

Here is the Official Model Optimizer Yolo document you should follow. I see that you are starting with a keras model (*.h5 extension) but you must convert that to a frozen Tensorflow pb first. Model Optimizer doesn't work with Keras directly.

Hope it helps,

Thanks,

Shubha

0 Kudos
Reply