Community
cancel
Showing results for 
Search instead for 
Did you mean: 
pang__pih
Beginner
558 Views

Example of having a webcam as live video stream as input instead of mp4 file or an image?

Jump to solution

Hi,

I have some trained YOLOv3 models and weights. I expect it will be easy to convert them to IR format.

But how do I setup OpenVino live image pipeline and apply the Inference Engine(NCS2) with object detection.

I would be happy someone could direct me to a working example project, that have a webcam as image input.( and are using

a RPI4 with Raspian 10 + NCS2). I am currently using openvino 2019 R3.1 since I have heard 2020.1 have an issue reading mp4 files,

but maybe more robost handeling YOLOv3 Darknet models.

 

Appreciate any feedback!

Cheers,

Pih Lung

0 Kudos
1 Solution
JAIVIN_J_Intel
Employee
558 Views

Hi Pih,

The axis error is caused by the new IR v10 format, on the latest OpenVINO™ toolkit version (2020.1)

Could you please generate the IR files of the model with the following parameter: 

--generate_deprecated_IR_V7

Please try running the demo using the model generated by adding the mentioned parameter with Model Optimzer command.

Hope this helps.

Regards,

Jaivin

View solution in original post

13 Replies
JAIVIN_J_Intel
Employee
558 Views

Hi Pih,

Thanks for reaching out.

Please refer the step-by-step instructions to Convert YOLOv3 Model to IR

It is recommended to refer Object Detection YOLO* V3 Python* Demo on which you can use camera and NCS2 as target device.

Feel free to ask if you have any other questions.

Regards,

Jaivin

pang__pih
Beginner
558 Views

 

Thanks Jalvin for your reply,

I was a little confused regarding different YOLOv3 models. I have trained with darknet-YOLOv3 (https://pjreddie.com/darknet/yolo/)

your link are using headings "Dump YOLOv3 TensorFlow* Model" and "Convert YOLOv3 TensorFlow Model to the IR".

"YOLOv3 has several implementations. This tutorial uses a TensorFlow implementation of YOLOv3 model, which can be directly converted to the IR."

So I can assume my Darknet-YOLOv3 classes.names, plp2.cfg and plp2.weights files are TensorFlow-YOLOv3 models files?

 Is this the correct way to convert my YOLOv3 files to IR files?

python3 convert_weights_pb.py --class_names classes.names --data_format NHWC --weights_file plp2.weights --size 320(I am using 320x320 pixel)

? I had expected to use plp2.cfg file?

When running Model Optimizer, how do I get the yolo_v3.pb file and I don't have a system variable $MO_ROOT or .json file?

python3 mo_tf.py

--input_model /path/to/yolo_v3.pb

--tensorflow_use_custom_operations_config $MO_ROOT/extensions/front/tf/yolo_v3.json

--batch 1

 

 

To run the program, I run the command with the following arguments?

/opt/intel/openvino_2019.3.376/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py  -m plp2.xml -i cam (or /dev/video2?) -d MYRIAD -t 0.7(only detect object if threshold over 70%)

Please advise if I got it wrong!

Thanks for your help!

 

JAIVIN_J_Intel
Employee
558 Views

Hi Pih,

You can directly follow the mentioned tutorial as the link you have mentioned to train your model is same as that used in the tutorial.

Please refer to the GitHub repository mentioned in the documentation.

By running the converter (convert_weights_pb.py) with the specified parameters, the required .pb file can be generated.

$MO_ROOT is the path to Model Optimizer directory ( <OpenVINO_install_directory>/deployment_tools/model_optimizer/ )

Also, after generating the IR files you can run the demo using the following command:

python3 <OpenVINO_install_directory>/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py -m <path-to-xml-file> -i cam -d MYRIAD

Hope this helps.

Regards,

Jaivin

 

pang__pih
Beginner
558 Views

Thanks Jalvin,

Regarding this YOLOv3, Rpi4, webcamera example. Should I use openvino 2020.1 or 2019R3.1 ( I have read there are some bugs in openvino 2020.1 release ) ?

 

 

pang__pih
Beginner
558 Views

Hi All,

I have trouble installing tf.contrib.slim. Tried many ways to install it on laptop with Nvidia GPU without luck.

Can I run "convert_weights_pb.py" on board without GPU? It shouldn't be a requirement anyway.

Hope somebody can help me out!

 

 

 

 

(venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolo3.weights
2020-04-02 10:08:34.562372: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer.so.6
2020-04-02 10:08:34.563785: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer_plugin.so.6
Traceback (most recent call last):
  File "convert_weights_pb.py", line 5, in <module>
    import yolo_v3
  File "/home/plp/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3/yolo_v3.py", line 6, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
(venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$

 

 

 

/////////

 

How I tried to fix the error:

Install the missing library:

apt install libnvinfer-plugin6=6.0.1-1+cuda10.1 (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ sudo apt install libnvinfer-plugin6=6.0.1-1+cuda10.1 [sudo] password for plp: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libnvinfer-plugin6 (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ // (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ sudo apt-get install --no-install-recommends \ > cuda-10-1 \ > libcudnn7=7.6.4.38-1+cuda10.1 \ > libcudnn7-dev=7.6.4.38-1+cuda10.1 Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: cuda-10-1 : Depends: cuda-runtime-10-1 (>= 10.1.243) but 10.1.105-1 is to be installed E: Unable to correct problems, you have held broken packages. (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ ////// (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ sudo apt-get install -y --no-install-recommends libnvinfer6=6.0.1-1+cuda10.1 \ > libnvinfer-dev=6.0.1-1+cuda10.1 \ > libnvinfer-plugin6=6.0.1-1+cuda10.1 Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: python-rosdep Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: libcudnn7 libcudnn7-dev The following NEW packages will be installed: libcudnn7 libcudnn7-dev libnvinfer-dev libnvinfer-plugin6 libnvinfer6 0 upgraded, 5 newly installed, 0 to remove and 27 not upgraded. Need to get 500 MB of archives. After this operation, 1,362 MB of additional disk space will be used. Get:1 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 libcudnn7 7.6.5.32-1+cuda10.2 [189 MB] Get:2 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 libcudnn7-dev 7.6.5.32-1+cuda10.2 [165 MB] Get:3 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 libnvinfer6 6.0.1-1+cuda10.1 [71.2 MB] Get:4 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 libnvinfer-dev 6.0.1-1+cuda10.1 [72.2 MB] Get:5 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 libnvinfer-plugin6 6.0.1-1+cuda10.1 [1,751 kB] Fetched 500 MB in 1min 11s (7,053 kB/s) Selecting previously unselected package libcudnn7. (Reading database ... 321197 files and directories currently installed.) Preparing to unpack .../libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb ... Unpacking libcudnn7 (7.6.5.32-1+cuda10.2) ... Selecting previously unselected package libcudnn7-dev. Preparing to unpack .../libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb ... Unpacking libcudnn7-dev (7.6.5.32-1+cuda10.2) ... Selecting previously unselected package libnvinfer6. Preparing to unpack .../libnvinfer6_6.0.1-1+cuda10.1_amd64.deb ... Unpacking libnvinfer6 (6.0.1-1+cuda10.1) ... Selecting previously unselected package libnvinfer-dev. Preparing to unpack .../libnvinfer-dev_6.0.1-1+cuda10.1_amd64.deb ... Unpacking libnvinfer-dev (6.0.1-1+cuda10.1) ... Selecting previously unselected package libnvinfer-plugin6. Preparing to unpack .../libnvinfer-plugin6_6.0.1-1+cuda10.1_amd64.deb ... Unpacking libnvinfer-plugin6 (6.0.1-1+cuda10.1) ... Setting up libcudnn7 (7.6.5.32-1+cuda10.2) ... Setting up libcudnn7-dev (7.6.5.32-1+cuda10.2) ... update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v7.h to provide /usr/include/cudnn.h (libcudnn) in auto mode Setting up libnvinfer6 (6.0.1-1+cuda10.1) ... Setting up libnvinfer-plugin6 (6.0.1-1+cuda10.1) ... Setting up libnvinfer-dev (6.0.1-1+cuda10.1) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... /sbin/ldconfig.real: /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link (venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$ //////

 

JAIVIN_J_Intel
Employee
558 Views

Which version of Tensorflow are you using? Try installing Tensorflow version 1.14.0.

It is recommended to use the latest version of OpenVINO (2020.1)

Also, GPU is not required to run the converter ( convert_weights_pb.py)

pang__pih
Beginner
558 Views

I resolved this error, by started all over with unzip code in new directory, create a new virtual env to run it in.

 

Hi Jalvin,
I am still pretty new to openVINO and Tensorflow, so please include details in how to do it.

Yesterday I ran "pip3 install tensorflow-gpu" to try to solve the 'contrib' problem, It is causing errors now when I installed Tensorflow version 1.14.0!

pip3 install tensorflow==1.14.0 

=>

ERROR: tensorflow-gpu 2.1.0 has requirement tensorboard<2.2.0,>=2.1.0, but you'll have tensorboard 1.14.0 which is incompatible.

ERROR: tensorflow-gpu 2.1.0 has requirement tensorflow-estimator<2.2.0,>=2.1.0rc0, but you'll have tensorflow-estimator 1.14.0 which is incompatible.

I am afraid trying to solve the 'contrib' problem, have left me with a messy environment!

So can you tell how do I run the converter without using the GPU?

or what is the easiest way to do the conversion?

Suggestions appreciated. Thanks

Pih Lung

 

 

 

 

complete install log:

(venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$

pip3 install tensorflow==1.14.0

Collecting tensorflow==1.14.0

Downloading tensorflow-1.14.0-cp37-cp37m-manylinux1_x86_64.whl (109.3 MB)

|████████████████████████████████| 109.3 MB 57 kB/s

Requirement already satisfied: astor>=0.6.0 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (0.8.1)

Requirement already satisfied: protobuf>=3.6.1 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (3.11.3)

Requirement already satisfied: numpy<2.0,>=1.14.5 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.18.2)

Requirement already satisfied: grpcio>=1.8.6 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.27.2)

Requirement already satisfied: keras-applications>=1.0.6 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.0.8)

Requirement already satisfied: google-pasta>=0.1.6 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (0.2.0)

Collecting tensorflow-estimator<1.15.0rc0,>=1.14.0rc0

Downloading tensorflow_estimator-1.14.0-py2.py3-none-any.whl (488 kB)

|████████████████████████████████| 488 kB 7.2 MB/s

Requirement already satisfied: termcolor>=1.1.0 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.1.0)

Requirement already satisfied: wheel>=0.26 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (0.34.2)

Requirement already satisfied: wrapt>=1.11.1 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.12.1)

Collecting tensorboard<1.15.0,>=1.14.0

Downloading tensorboard-1.14.0-py3-none-any.whl (3.1 MB)

|████████████████████████████████| 3.1 MB 10.8 MB/s

Requirement already satisfied: absl-py>=0.7.0 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (0.9.0)

Requirement already satisfied: gast>=0.2.0 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (0.2.2)

Requirement already satisfied: six>=1.10.0 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.14.0)

Requirement already satisfied: keras-preprocessing>=1.0.5 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorflow==1.14.0) (1.1.0)

Requirement already satisfied: setuptools in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from protobuf>=3.6.1->tensorflow==1.14.0) (46.1.3)

Requirement already satisfied: h5py in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from keras-applications>=1.0.6->tensorflow==1.14.0) (2.10.0)

Requirement already satisfied: werkzeug>=0.11.15 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0) (1.0.1)

Requirement already satisfied: markdown>=2.6.8 in /home/plp/Documents/code/OpenVINOtoolkit/venv/lib/python3.7/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0) (3.2.1)

ERROR: tensorflow-gpu 2.1.0 has requirement tensorboard<2.2.0,>=2.1.0, but you'll have tensorboard 1.14.0 which is incompatible.

ERROR: tensorflow-gpu 2.1.0 has requirement tensorflow-estimator<2.2.0,>=2.1.0rc0, but you'll have tensorflow-estimator 1.14.0 which is incompatible.

Installing collected packages: tensorflow-estimator, tensorboard, tensorflow

Attempting uninstall: tensorflow-estimator

Found existing installation: tensorflow-estimator 2.1.0

Uninstalling tensorflow-estimator-2.1.0:

Successfully uninstalled tensorflow-estimator-2.1.0

Attempting uninstall: tensorboard

Found existing installation: tensorboard 2.1.1

Uninstalling tensorboard-2.1.1:

Successfully uninstalled tensorboard-2.1.1

Attempting uninstall: tensorflow

Found existing installation: tensorflow 2.1.0

Uninstalling tensorflow-2.1.0:

(venv) (base) plp@pihlungs-laptop:~/Documents/code/OpenVINOtoolkit/tensorflow-yolo-v3$

 

 

 

 

 

 

 

 

 

 

 

pang__pih
Beginner
558 Views

I resolved this error:)

pang__pih
Beginner
558 Views

 

Ok, I was able to produce the frozen_darknet_yolov3_model.pb file.

Next step is to "Convert YOLOv3 TensorFlow Model to the IR"

Running Model Optimizer command:

python3 mo_tf.py

--input_model frozen_darknet_yolov3_model.pb

--tensorflow_use_custom_operations_config $MO_ROOT/extensions/front/tf/yolo_v3.json

--batch 1

 

Ok, I was able to generate the IR files. 

frozen_darknet_yolov3_model.bin

frozen_darknet_yolov3_model.xml

and copied them over to the Rpi4B :)

 

pang__pih
Beginner
558 Views

Hi,

Moved IR .xml and .bin to ~/code/tensorflow-yolo-v3  on Raspberry Pi 4B, to run demo "Object Detection YOLO* V3 Python* Demo, Async API Performance Showcase."

https://docs.openvinotoolkit.org/2020.1/_demos_python_demos_object_detection_demo_yolov3_async_READM...

For some reason it can't find the IR .xml file??

Can some one see why I am getting that error, since the frozen_darknet_yolo3_model.xml is located in /home/pi/code/tensorflow-yolo-v3/  ??

Thanks

Pih Lung

 

pi@raspberrypi:~/code/tensorflow-yolo-v3 $ ls
coco.names             frozen_darknet_yolov3_model.bin      mo_run.sh                                  utils.py
CODE_OF_CONDUCT.md     frozen_darknet_yolov3_model.mapping  __pycache__                                yolo_v3.py
convert_weights_pb.py  frozen_darknet_yolov3_model.pb       README.md                                  yolo_v3_tiny.py
convert_weights.py     frozen_darknet_yolov3_model.xml      run_mo.py                                  yolov3.weights
demo.py                LICENSE                              run_object_detection_demo_yolov3_async.sh
 

pi@raspberrypi:~/code/tensorflow-yolo-v3 $ cat run_object_detection_demo_yolov3_async.sh 
python3 /opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py -i cam -m /home/pi/code/tensorflow-yolo-v3/frozen_darknet_yolov3_model.xml -d MYRIAD -t 0.7

pi@raspberrypi:~/code/tensorflow-yolo-v3 $ ./run_object_detection_demo_yolov3_async.sh 

[ INFO ] Creating Inference Engine...

[ INFO ] Loading network files:

/home/pi/code/tensorflow-yolo-v3/frozen_darknet_yolov3_model.xml

/home/pi/code/tensorflow-yolo-v3/frozen_darknet_yolov3_model.bin

Traceback (most recent call last):

File "/opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py", line 359, in <module>

sys.exit(main() or 0)

File "/opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py", line 182, in main

net = IENetwork(model=model_xml, weights=model_bin)

File "ie_api.pyx", line 980, in openvino.inference_engine.ie_api.IENetwork.__cinit__

RuntimeError: Check 'axis < static_cast<size_t>(input_rank)' failed at /teamcity/work/scoring_engine_build/releases_2020_1/ngraph/src/ngraph/op/gather.cpp:140:

While validating node 'Gather[Gather_5109](patternLabel_5105: float{10,20,30}, patternLabel_5106: int64_t{5}, patternLabel_5108: int64_t{1}) -> (??)':

The axis must => 0 and <= input_rank (axis: 4294967295).

pi@raspberrypi:~/code/tensorflow-yolo-v3 $

What is axis and how do I set axis to a valid number??

Question: Besides installing Openvino toolkit and python 3.5, are there other requirements to run Inference Engine on Rpi with a NCS2?

 

Appreciate your help :)

 

 

 


 

 

 

 

JAIVIN_J_Intel
Employee
559 Views

Hi Pih,

The axis error is caused by the new IR v10 format, on the latest OpenVINO™ toolkit version (2020.1)

Could you please generate the IR files of the model with the following parameter: 

--generate_deprecated_IR_V7

Please try running the demo using the model generated by adding the mentioned parameter with Model Optimzer command.

Hope this helps.

Regards,

Jaivin

View solution in original post

pang__pih
Beginner
558 Views

Hi Jaivin,

Thanks a lot,  It's now running :) 

python3 /opt/intel/openvino/deployment_tools/open_model_zoo/demos/python_demos/object_detection_demo_yolov3_async/object_detection_demo_yolov3_async.py -i cam -m /home/pi/code/tensorflow-yolo-v3/frozen_darknet_yolov3_model.xml -d MYRIAD -t 0.7

only thing left is to add classes.names! I am detected as #0 100% and books is shown as #73 item.

What is the syntax to include the class.names?

Answer: --labels ./coco.names

Appreciate your help Jaivin.

Pih Lung

 

 

 

pang__pih
Beginner
558 Views

Hi Jaivin,

I have issues with first step in converting YOLO model weights to IR. Using function "convert_weights_pb".

Can still convert pre-trained model COCO using command "python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights".

But when I want to convert my custom trained YOLOv3 model, it says wrong format.

"python3 convert_weights_pb.py --class_names classes.names --data_format NHWC --weights_file asl_2class_1800.weights"

=> "

output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf860>>: AssertionError: Bad argument number for Name: 3, expecting 4
W0411 18:32:45.249504 140411498170176 ag_logging.py:145] Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf860>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf860>>: AssertionError: Bad argument number for Name: 3, expecting 4
WARNING:tensorflow:Entity <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd373e10>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd373e10>>: AssertionError: Bad argument number for Name: 3, expecting 4
W0411 18:32:45.276548 140411498170176 ag_logging.py:145] Entity <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd373e10>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd373e10>>: AssertionError: Bad argument number for Name: 3, expecting 4
WARNING:tensorflow:Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf5c0>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf5c0>>: AssertionError: Bad argument number for Name: 3, expecting 4
W0411 18:32:45.334221 140411498170176 ag_logging.py:145] Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf5c0>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd4bf5c0>>: AssertionError: Bad argument number for Name: 3, expecting 4
WARNING:tensorflow:Entity <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd650710>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd650710>>: AssertionError: Bad argument number for Name: 3, expecting 4
W0411 18:32:45.361309 140411498170176 ag_logging.py:145] Entity <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd650710>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fb3dd650710>>: AssertionError: Bad argument number for Name: 3, expecting 4
WARNING:tensorflow:Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd52cc50>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd52cc50>>: AssertionError: Bad argument number for Name: 3, expecting 4
W0411 18:32:45.422889 140411498170176 ag_logging.py:145] Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd52cc50>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x7fb3dd52cc50>>: AssertionError: Bad argument number for Name: 3, expecting 4
WARNING:tensorflow:From convert_weights_pb.py:49: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

W0411 18:32:45.452037 140411498170176 deprecation_wrapper.py:119] From convert_weights_pb.py:49: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

WARNING:tensorflow:From /home/plp/Documents/code/tensorflow-yolo-v3/utils.py:93: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.

W0411 18:32:45.506139 140411498170176 deprecation_wrapper.py:119] From /home/plp/Documents/code/tensorflow-yolo-v3/utils.py:93: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.

Traceback (most recent call last):
  File "convert_weights_pb.py", line 59, in <module>
    tf.app.run()
  File "/home/plp/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "convert_weights_pb.py", line 49, in main
    load_ops = load_weights(tf.global_variables(scope='detector'), FLAGS.weights_file)
  File "/home/plp/Documents/code/tensorflow-yolo-v3/utils.py", line 115, in load_weights
    (shape[3], shape[2], shape[0], shape[1]))
ValueError: cannot reshape array of size 177803 into shape (256,128,3,3)

plp@pihlungs-laptop:~/Documents/code/tensorflow-yolo-v3$

"

Please see: https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/816623#comment-...

I have tried to find a solution without luck.

Since I can convert_weights_pb the COCO YOLOv3 model and get a working pb file. Am I training a different kind of YOLOv3 Model? And what changes do I need to do to my custom yolov3.cfg in order to create the same as the COCO model?

I attached my current cfg file. 

What params in the my asl_2class.cfg file do I need to change so it can be reshaped "into shape (256,128,3,3)"

in order to get the "convert_weights_pb.py" to work??

Hope you can help!

Thanks

Pih Lung

Reply