Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
132 Views

linux openvino2019R3 transform yoloV3-tiny failed

Hello!

I trained Yolov3-tiny with my own data set and got the corresponding weight file。

Then I tried to translate my weight file to IR files according to the introduction of the guidelines:

Converting YOLO* Models to the Intermediate Representation (IR)

My environment:

  • ubuntu 18.04
  • openvino_toolkit_p_<2019.3.334>
  • tensorflow1.12.0

 

1. My self-trained yoloV3-tiny only has 1 classes, here is my yoloV3_tiny.cfg:

[net]
# Testing
#batch=1
#subdivisions=1
# Training
batch=64
subdivisions=64
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.001
burn_in=1000
max_batches = 500200
policy=steps
steps=400000,450000
scales=.1,.1

[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=1

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky

###########

[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=18 ####
activation=linear

 

[yolo]
mask = 3,4,5
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=1 ####
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=0 ####

[route]
layers = -4

[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky

[upsample]
stride=2

[route]
layers = -1, 8

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=18 ####3*(class+5)
activation=linear

[yolo]
mask = 0,1,2
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=1 ####
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=0 ####shutdown randow

 

2. So I change classes number to 1 of the <OPENVINO_INSTALL_DIR>/deployment_tools/model_optimizer/extensions/front/tf/yolo_v3_tiny.json file:

[
{
"id": "TFYOLOV3",
"match_kind": "general",
"custom_attributes": {
"classes": 1,
"anchors": [10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319],
"coords": 4,
"num": 6,
"masks": [[3, 4, 5], [0, 1, 2]],
"entry_points": ["detector/yolo-v3-tiny/Reshape", "detector/yolo-v3-tiny/Reshape_4"]
}
}
]

 

3. I trained yoloV3-tiny just to detected one classes: Tire. Here is my lable name file : tire.names

Tire

 

4.  Here is the command line I used:

     4.1 >>python ./tensorflow-yolo-v3/convert_weights_pb.py --class_names ./tire.names --data_format NHWC --weights_file ./yolov3-tiny_10000.weights --tiny

here was the following output:

/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
2020-07-31 17:24:01.571024: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-31 17:24:01.581549: E tensorflow/stream_executor/cuda/cuda_driver.cc:300] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error
2020-07-31 17:24:01.582221: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] retrieving CUDA diagnostic information for host: auto410-pc
2020-07-31 17:24:01.582233: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:170] hostname: auto410-pc
2020-07-31 17:24:01.582264: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:194] libcuda reported version is: 415.27.0
2020-07-31 17:24:01.582285: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:198] kernel reported version is: 415.27.0
2020-07-31 17:24:01.582292: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:305] kernel version seems to match DSO: 415.27.0
321 ops written to frozen_darknet_yolov3_model.pb.

           Then I get a "frozen_darknet_yolov3_model.pb"

 

     4.2  continue 

      >>python mo_tf.py --input_model /home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config ./extensions/front/tf/yolo_v3_tiny.json --batch 1 --data_type FP16 --output_dir /home/auto410/cxx/YOLOv3tinyOpenVINO/output/900fp162019r3

here was the following output:

Model Optimizer arguments:
Common parameters:
- Path to the Input Model: /home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb
- Path for generated IR: /home/auto410/cxx/YOLOv3tinyOpenVINO/output/900fp162019r3
- IR output name: frozen_darknet_yolov3_model
- Log level: ERROR
- Batch: 1
- Input layers: Not specified, inherited from the model
- Output layers: Not specified, inherited from the model
- Input shapes: Not specified, inherited from the model
- Mean values: Not specified
- Scale values: Not specified
- Scale factor: Not specified
- Precision of IR: FP16
- Enable fusing: True
- Enable grouped convolutions fusing: True
- Move mean values to preprocess section: False
- Reverse input channels: False
TensorFlow specific parameters:
- Input model in text protobuf format: False
- Path to model dump for TensorBoard: None
- List of shared libraries with TensorFlow custom layers implementation: None
- Update the configuration file with input/output node names: None
- Use configuration file used to generate the model with Object Detection API: None
- Operations to offload: None
- Patterns to offload: None
- Use the config file: /opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/./extensions/front/tf/yolo_v3_tiny.json
Model Optimizer version: 2019.3.0-375-g332562022
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
[ ERROR ] 'Graph' object has no attribute 'node'
Cannot pre-process TensorFlow graph after reading from model file "/home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb". File is corrupt or has unsupported format. Details: 'Graph' object has no attribute 'node'.
For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #44.
(tf) auto410@auto410-pc:/opt/intel/openvino/deployment_tools/model_optimizer$ python mo_tf.py --input_model /home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config ./extensions/front/tf/yolo_v3_tiny.json --batch 1 --output_dir /home/auto410/cxx/YOLOv3tinyOpenVINO/output/900fp162019r3
Model Optimizer arguments:
Common parameters:
- Path to the Input Model: /home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb
- Path for generated IR: /home/auto410/cxx/YOLOv3tinyOpenVINO/output/900fp162019r3
- IR output name: frozen_darknet_yolov3_model
- Log level: ERROR
- Batch: 1
- Input layers: Not specified, inherited from the model
- Output layers: Not specified, inherited from the model
- Input shapes: Not specified, inherited from the model
- Mean values: Not specified
- Scale values: Not specified
- Scale factor: Not specified
- Precision of IR: FP32
- Enable fusing: True
- Enable grouped convolutions fusing: True
- Move mean values to preprocess section: False
- Reverse input channels: False
TensorFlow specific parameters:
- Input model in text protobuf format: False
- Path to model dump for TensorBoard: None
- List of shared libraries with TensorFlow custom layers implementation: None
- Update the configuration file with input/output node names: None
- Use configuration file used to generate the model with Object Detection API: None
- Operations to offload: None
- Patterns to offload: None
- Use the config file: /opt/intel/openvino_2019.3.334/deployment_tools/model_optimizer/./extensions/front/tf/yolo_v3_tiny.json
Model Optimizer version: 2019.3.0-375-g332562022
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/auto410/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
[ ERROR ] 'Graph' object has no attribute 'node'
Cannot pre-process TensorFlow graph after reading from model file "/home/auto410/cxx/YOLOv3tinyOpenVINO/frozen_darknet_yolov3_model.pb". File is corrupt or has unsupported format. Details: 'Graph' object has no attribute 'node'.
For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #44.

    And I failed to get .xml&.bin files. But when I use the openvino_toolkit_p_<2020.2.120> to transfer this weight file(and I didn't  change the yolo_v3_tiny.json with other step were same) , it will success! So I don't kown how to successfully get the IR using openvino_toolkit_p_<2019.3.334>.

Please help me to solve this problem. Thanks!!!!!! 

 

 

0 Kudos
4 Replies
Highlighted
111 Views

Hi JasmyChen,

Thanks for reaching out.

Is there a reason you are using the OpenVINO toolkit 2019.3?

We recommend you to use OpenVINO toolkit 2020.4 (Latest release). Please, try it again using the latest version and let us know if the issue persists.

Regards,

Javier A.

0 Kudos
Highlighted
Beginner
106 Views

The premise of my development was to be able to use the model optimizer to convert.pb files to IR files and deploy them to raspberry PI4B for neural network inference acceleration using OpenVino Toolkit and NCS2, which is given that raspberry PI4B currently only supports IRv7 format files.


If I successfully get the IR file using version 2020.2 of the model optimizer and deploy it to my raspberry pi, then I would be prompted an error of using future models to make inferences.

The Yolov3-tiny weight file that has been trained on its own dataset is not available from open model zoo 2019R3.

Can model optimizer2020.4 will support IRv7 format files conversion ? And Is it will success running the detction on raspberry PI4B with openvino toolkit on raspberry OS 2020.4 or other version?What's the correspondence between them?

0 Kudos
Highlighted
94 Views

Hi JasmyChen,

 

The OpenVINO Toolkit 2020.4 version for Raspbian OS is currently supporting IRv7 and IRv10 format files as well. However, IRv7 is deprecated and support for this version will be removed in the next major version. It means IRv7 and older version cannot be read using the Core::ReadNetwork function.

We recommend you to migrate to the latest version (IRv10) to prevent incompatibility issues in the next release.

 

Regards,

Javier A.

0 Kudos
Highlighted
75 Views

Hi JasmyChen,

 

Intel will no longer monitor this thread since we have provided a solution.  If you need any additional information from Intel, please submit a new question.

 

Regards,

Javier A.

0 Kudos