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.

Converting yolo v3 weights

goh__richard
Beginner
819 Views

Hi

When I try to convert I got the following errors

Advise much appreciated

 

>python2 convert_weights_pb.py --class_names voc.names --data_format NHWC --weights_file latest.weights
Traceback (most recent call last):
  File "convert_weights_pb.py", line 5, in <module>
    import yolo_v3
  File "/deeplearning/tensorflow-yolo-v3/yolo_v3.py", line 75
    def _fixed_padding(inputs, kernel_size, *args, mode='CONSTANT', **kwargs):
                                                      ^
SyntaxError: invalid syntax
stratton:root:/deep/tensorflow-yolo-v3           

         * USING PYTHON3 *                                                                                                                                               

>python3 convert_weights_pb.py --class_names voc.names --data_format NHWC --weights_file latest.weights
Traceback (most recent call last):
  File "convert_weights_pb.py", line 5, in <module>
    import yolo_v3
  File "/deeplearning/tensorflow-yolo-v3/yolo_v3.py", line 6, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

 

0 Kudos
5 Replies
JAIVIN_J_Intel
Employee
819 Views

Hi Richard,

Which version of Tensorflow are you using? Try installing Tensorflow version 1.14.0. and then run the converter (convert_weights_pb.py) using Python3

Regards,

Jaivin

0 Kudos
goh__richard
Beginner
819 Views

Hi Jaivin

Thanks.

Did try to downgrade tensorflow but could not.

How can I install version 1.14.0

Pardon my ignorance, newbie to this different versions

================================

pip install tensorflow==1.14.1
ERROR: Could not find a version that satisfies the requirement tensorflow==1.14.1 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2)
ERROR: No matching distribution found for tensorflow==1.14.1
WARNING: You are using pip version 20.0.1; however, version 20.0.2 is available.
You should consider upgrading via the '/deeplearning/openvino_training_extensions/tensorflow_toolkit/ssd_detector/venv/bin/python3 -m pip install --upgrade pip' command.

0 Kudos
goh__richard
Beginner
819 Views

Sorry

installed 1.14.0

now the error is

No module named 'PIL'?

 

Thanks

Update: solve it by

pip install image

 

thanks

0 Kudos
goh__richard
Beginner
819 Views

exporting failed

my cfg file is this format

mask = 6,7,8
anchors = 10,13,  16,30,  33,23,  30,61,  62,45,  59,119,  116,90,  156,198,  373,326
classes=1
num=9
jitter=.3
ignore_thresh = .5
truth_thresh = 1
random=1

==

what is wanted is this format

      "anchors": [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326],
      "coords": 4,
      "num": 9,
      "masks":[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
      "entry_points": ["detector/yolo-v3/Reshape", "detector/yolo-v3/Reshape_4", "detector/yolo-v3/Reshape_8"

 

Appreciate greatly any advise.

Coffee too

 

0 Kudos
JAIVIN_J_Intel
Employee
819 Views

Hi Richard,

I assume that you are following the documentation to Convert YOLOv3 Model to the IR

Please refer to this and this which are discussions on this forum regarding replacing the values in custom_attributes with the parameters in the configuration file.

Hope this helps.

Regards,

Jaivin

0 Kudos
Reply