Giter Club home page Giter Club logo

blobconverter's People

Contributors

cafemoloko avatar daniilpastukhov avatar erol444 avatar honzacuhel avatar jakaskerl avatar luxonis-vlad avatar szabolcsgergely avatar tersekmatija avatar vandavv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blobconverter's Issues

URL was not found on the server

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
When following the port 0.0.0.0:8080

It would be great more information about the requirements and steps to convert the models.

[BUG]

Good day! im trying to convert onnx model to IR representation and get this error!
i will glad to get feedback!

[ ERROR ] -------------------------------------------------
[ ERROR ] ----------------- INTERNAL ERROR ----------------
[ ERROR ] Unexpected exception happened.
[ ERROR ] Please contact Model Optimizer developers and forward the following information:
[ ERROR ] While validating ONNX node '<Node(Resize): /model.13/Resize>':
/model.13/Resize_input_cast_0 node not found in graph cache
[ ERROR ] Traceback (most recent call last):
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 533, in main
ret_code = driver(argv)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 489, in driver
graph, ngraph_function = prepare_ir(argv)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 394, in prepare_ir
ngraph_function = moc_pipeline(argv, moc_front_end)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/moc_frontend/pipeline.py", line 147, in moc_pipeline
ngraph_function = moc_front_end.convert(input_model)
RuntimeError: While validating ONNX node '<Node(Resize): /model.13/Resize>':
/model.13/Resize_input_cast_0 node not found in graph cache

[ ERROR ] ---------------- END OF BUG REPORT --------------
[ ERROR ] -------------------------------------------------

ONNX to Blob: Broadcast shape rank must be 1, but has 0

I'm getting this error when trying to convert a custom .onnx to .blob:

Command failed with exit code 1, command: /app/venvs/venv2022_1/bin/python /app/model_compiler/openvino_2022.1/converter.py --precisions FP16 --output_dir /tmp/blobconverter/6d616109005a4cef9ef6da961548085b --download_dir /tmp/blobconverter/6d616109005a4cef9ef6da961548085b --name maskrcnn_30 --model_root /tmp/blobconverter/6d616109005a4cef9ef6da961548085b

This is the full console output:

========== Converting maskrcnn_30 to IR (FP16)
Conversion command: /app/venvs/venv2022_1/bin/python -- /app/venvs/venv2022_1/bin/mo --framework=onnx --data_type=FP16 --output_dir=/tmp/blobconverter/6d616109005a4cef9ef6da961548085b/maskrcnn_30/FP16 --model_name=maskrcnn_30 --input= --input_model=/tmp/blobconverter/6d616109005a4cef9ef6da961548085b/maskrcnn_30/FP16/maskrcnn_30.onnx

Model Optimizer arguments:
Common parameters:
- Path to the Input Model: /tmp/blobconverter/6d616109005a4cef9ef6da961548085b/maskrcnn_30/FP16/maskrcnn_30.onnx
- Path for generated IR: /tmp/blobconverter/6d616109005a4cef9ef6da961548085b/maskrcnn_30/FP16
- IR output name: maskrcnn_30
- Log level: ERROR
- Batch: Not specified, inherited from the model
- Input layers: Not specified, inherited from the model
- Output layers: Not specified, inherited from the model
- Input shapes: Not specified, inherited from the model
- Source layout: Not specified
- Target layout: Not specified
- Layout: Not specified
- Mean values: Not specified
- Scale values: Not specified
- Scale factor: Not specified
- Precision of IR: FP16
- Enable fusing: True
- User transformations: Not specified
- Reverse input channels: False
- Enable IR generation for fixed input shape: False
- Use the transformations config file: None
Advanced parameters:
- Force the usage of legacy Frontend of Model Optimizer for model conversion into IR: False
- Force the usage of new Frontend of Model Optimizer for model conversion into IR: False
OpenVINO runtime found in: /opt/intel/openvino2022_1/python/python3.8/openvino
OpenVINO runtime version: 2022.1.0-7019-cdb9bec7210-releases/2022/1
Model Optimizer version: 2022.1.0-7019-cdb9bec7210-releases/2022/1
FAILED:
maskrcnn_30
Error output (stderr)
[ ERROR ] -------------------------------------------------
[ ERROR ] ----------------- INTERNAL ERROR ----------------
[ ERROR ] Unexpected exception happened.
[ ERROR ] Please contact Model Optimizer developers and forward the following information:
[ ERROR ] While validating ONNX node '<Node(ConstantOfShape): /rpn/anchor_generator/ConstantOfShape>':
Check 'broadcast_shape_rank.compatible(1)' failed at core/shape_inference/include/broadcast_shape_inference.hpp:171:
While validating node 'v3::Broadcast Broadcast_2895 (Constant_2894[0]:i64{}, /rpn/anchor_generator/Constant_12_output_0[0]:i64{}) -> (dynamic...)' with friendly_name 'Broadcast_2895':
Broadcast shape rank must be 1, but has 0

[ ERROR ] Traceback (most recent call last):
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 533, in main
ret_code = driver(argv)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 489, in driver
graph, ngraph_function = prepare_ir(argv)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 394, in prepare_ir
ngraph_function = moc_pipeline(argv, moc_front_end)
File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/moc_frontend/pipeline.py", line 147, in moc_pipeline
ngraph_function = moc_front_end.convert(input_model)
RuntimeError: While validating ONNX node '<Node(ConstantOfShape): /rpn/anchor_generator/ConstantOfShape>':
Check 'broadcast_shape_rank.compatible(1)' failed at core/shape_inference/include/broadcast_shape_inference.hpp:171:
While validating node 'v3::Broadcast Broadcast_2895 (Constant_2894[0]:i64{}, /rpn/anchor_generator/Constant_12_output_0[0]:i64{}) -> (dynamic...)' with friendly_name 'Broadcast_2895':
Broadcast shape rank must be 1, but has 0

[ ERROR ] ---------------- END OF BUG REPORT --------------
[ ERROR ] -------------------------------------------------

I used this configuration when trying to convert:

image

My maskrcnn_30.onnx was converted from a custom pytorch .pt with the following function call:

image

Is this an internal issue with my original model?

Conversion of ONNX model error

I am converting an ONNX model and I get the following error:

python3 -m blobconverter --onnx-model /home/dso-dat-dev6/dso/mde.onnx --shaves 6 Downloading /home/dso-dat-dev6/.cache/blobconverter/mde_openvino_2021.4_6shave.blob... { "exit_code": 1, "message": "Command failed with exit code 1, command: /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/myriad_compile -m /tmp/blobconverter/c7d2ecf91d79439fbc8597d42516336d/mde/FP16/mde.xml -o /tmp/blobconverter/c7d2ecf91d79439fbc8597d42516336d/mde/FP16/mde.blob -c /tmp/blobconverter/c7d2ecf91d79439fbc8597d42516336d/myriad_compile_config.txt -ip U8", "stderr": "Unsupported pad value\n", "stdout": "Inference Engine: \n\tIE version ......... 2021.4.0\n\tBuild ........... 2021.4.0-3839-cd81789d294-releases/2021/4\n\u001b[1;33m[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM\u001b[0m\n" }

How should i go about debugging this issue?

Thanks

Support for yolo-v4-tf conversion

Some models in OpenVINO model zoo contain custom instructions how to compile them - https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/yolo-v4-tf/model.yml

Downloading one of these - yolo-v4-tf - results in a following error

Command failed with exit code 1, command: /usr/bin/python3 model_compiler/openvino_2021.3/converter.py --precisions FP16 --output_dir /tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9 --download_dir /tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9 --name yolo-v4-tf --model_root /tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9
========== Converting yolo-v4-tf to IR (FP16)
Conversion command: /usr/bin/python3 -- /opt/intel/openvino/deployment_tools/model_optimizer/mo.py --framework=tf --data_type=FP16 --output_dir=/tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9/yolo-v4-tf/FP16 --model_name=yolo-v4-tf '--input_shape=[1,608,608,3]' --input=image_input '--scale_values=image_input[255]' --reverse_input_channels --input_model=/tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9/yolo-v4-tf/yolo-v4.pb

FAILED:
yolo-v4-tf
[ ERROR ]  The "/tmp/blobconverter/02caa580d62c4f0eb06328ffbd9f32f9/yolo-v4-tf/yolo-v4.pb" is not existing file

The downloaded files contain python scripts, but no actual .pb file, so it's up to investigation how to use these to produce the required file

[BUG]

Hi.
I'm trying to convert a custom trained YOLOv8 model to Myriad X format for edge inference on OAK cameras. I converted the .pt model to .onnx format and got this error while running the conversion script:
{ "exit_code": 1, "message": "Command failed with exit code 1, command: /app/venvs/venv2022_1/bin/python /app/model_compiler/openvino_2022.1/converter.py --precisions FP16 --output_dir /tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b --download_dir /tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b --name latest --model_root /tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b", "stderr": "[ ERROR ] -------------------------------------------------\n[ ERROR ] ----------------- INTERNAL ERROR ----------------\n[ ERROR ] Unexpected exception happened.\n[ ERROR ] Please contact Model Optimizer developers and forward the following information:\n[ ERROR ] While validating ONNX node '<Node(Slice): /model.22/Slice>':\nbad_weak_ptr\n[ ERROR ] Traceback (most recent call last):\n File \"/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py\", line 533, in main\n ret_code = driver(argv)\n File \"/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py\", line 489, in driver\n graph, ngraph_function = prepare_ir(argv)\n File \"/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py\", line 394, in prepare_ir\n ngraph_function = moc_pipeline(argv, moc_front_end)\n File \"/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/moc_frontend/pipeline.py\", line 147, in moc_pipeline\n ngraph_function = moc_front_end.convert(input_model)\nRuntimeError: While validating ONNX node '<Node(Slice): /model.22/Slice>':\nbad_weak_ptr\n\n[ ERROR ] ---------------- END OF BUG REPORT --------------\n[ ERROR ] -------------------------------------------------\n", "stdout": "========== Converting latest to IR (FP16)\nConversion command: /app/venvs/venv2022_1/bin/python -- /app/venvs/venv2022_1/bin/mo --framework=onnx --data_type=FP16 --output_dir=/tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b/latest/FP16 --model_name=latest --input= '--mean_values=[127.5,127.5,127.5]' '--scale_values=[255,255,255]' --data_type=FP16 --input_model=/tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b/latest/FP16/latest.onnx\n\nModel Optimizer arguments:\nCommon parameters:\n\t- Path to the Input Model: \t/tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b/latest/FP16/latest.onnx\n\t- Path for generated IR: \t/tmp/blobconverter/969015cb9def47e5ae6af1ef9c91112b/latest/FP16\n\t- IR output name: \tlatest\n\t- Log level: \tERROR\n\t- Batch: \tNot specified, inherited from the model\n\t- Input layers: \tNot specified, inherited from the model\n\t- Output layers: \tNot specified, inherited from the model\n\t- Input shapes: \tNot specified, inherited from the model\n\t- Source layout: \tNot specified\n\t- Target layout: \tNot specified\n\t- Layout: \tNot specified\n\t- Mean values: \t[127.5,127.5,127.5]\n\t- Scale values: \t[255,255,255]\n\t- Scale factor: \tNot specified\n\t- Precision of IR: \tFP16\n\t- Enable fusing: \tTrue\n\t- User transformations: \tNot specified\n\t- Reverse input channels: \tFalse\n\t- Enable IR generation for fixed input shape: \tFalse\n\t- Use the transformations config file: \tNone\nAdvanced parameters:\n\t- Force the usage of legacy Frontend of Model Optimizer for model conversion into IR: \tFalse\n\t- Force the usage of new Frontend of Model Optimizer for model conversion into IR: \tFalse\nOpenVINO runtime found in: \t/opt/intel/openvino2022_1/python/python3.8/openvino\nOpenVINO runtime version: \t2022.1.0-7019-cdb9bec7210-releases/2022/1\nModel Optimizer version: \t2022.1.0-7019-cdb9bec7210-releases/2022/1\n[WARN] 2023-05-25T09:00:19z frontends/onnx/frontend/src/ops_bridge.cpp 240\tCurrently ONNX operator set version: 17 is unsupported. Falling back to: 15\nFAILED:\nlatest\n" }

Unable to convert .vino files into .blob files with the online converter tool

Hello,
I downloaded .xml and .bin files, from the notebook:
https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/001-hello-world/model

I then tried to convert these .vino files using the online .blob converter and it failed with this error message:
Model file /tmp/blobconverter/a01bbd1648354a0cba721a7c41afb93b/v3-small_224_1/FP16/v3-small_224_1.xml cannot be opened!

I was able to load and run the .vino models in a python script to do classification and it worked.
Something is very wrong with the online converter, if it can't handle these .vino files directly from the .openvino website.

I am busy integrating vision into a robotics, project, i did not expect this Luxonis stack to be this troublesome. Really sad.

Can't reach "continue" button

On smaller screen sizes (eg laptop), you can't reach "continue" button after selection openvino version/model source. You have to zoom out so you can see the button and proceed to next steps. Solution would be to make the site scrollable or, preferably, make css so that it fits.
@cafemoloko would you mind looking into this?

OpenVINO IR conversion fail - HTTPError: 502

Hi

I'm trying to convert an OpenVINO IR of the EfficientDet d0 network that I in turn converted from TensorFlow using OpenVINO's model optimizer (version 2021.4.689) without any issues. But when I use blobconverter on the .bin and .xml files i get the following problem:

(venv) ljosefs@UTVPOOL-SE-LL02:~/Desktop/AI-KIT/depthai-tutorials-practice$ ./blob_convert.sh 
Downloading /home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/efficientdet_d0_coco17_tpu-32/saved_model_openvino_2021.4.1_4shave.blob...
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/venv/lib/python3.8/site-packages/blobconverter/__main__.py", line 3, in <module>
    __run_cli__()
  File "/home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/venv/lib/python3.8/site-packages/blobconverter/__init__.py", line 483, in __run_cli__
    return from_openvino(
  File "/home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/venv/lib/python3.8/site-packages/blobconverter/__init__.py", line 388, in from_openvino
    return compile_blob(blob_name=xml_path.stem, req_data=body, req_files=files, **kwargs)
  File "/home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/venv/lib/python3.8/site-packages/blobconverter/__init__.py", line 263, in compile_blob
    response.raise_for_status()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://blobconverter.luxonis.com/compile?version=2021.4.1

calling blobconverter using this command:

python3 -m blobconverter --openvino-xml /home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/efficientdet_d0_coco17_tpu-32/saved_model.xml --openvino-bin /home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/efficientdet_d0_coco17_tpu-32/saved_model.bin --output-dir /home/ljosefs/Desktop/AI-KIT/depthai-tutorials-practice/efficientdet_d0_coco17_tpu-32 --shaves 4

Any idea of as to why this issue arises?

Error when run docker-compose build?

After install and run Docker, I run docker-compose build as your guide but it raise an error:

=> CACHED [stage-1 10/16] RUN python3 -m pip install --upgrade tensorboa 0.0s
=> CACHED [stage-1 11/16] WORKDIR /app 0.0s
=> CACHED [stage-1 12/16] ADD requirements.txt . 0.0s
=> ERROR [stage-1 13/16] ADD depthai/model_compiler depthai/model_compil 0.0s

[stage-1 13/16] ADD depthai/model_compiler depthai/model_compiler:


ERROR: Service 'api' failed to build

Can you help me fix this error?

\n[ ERROR ] While validating ONNX node '<Node(Concat): /roi_heads/box_pooler/Concat_2>':\nCheck 'concat_axis < this_input_rank.get_length() && concat_axis >= 0'

Hi,

I tried to convert my pretrained detectron2 model to blob format for inference which is used for Instance Segmentation.

Initially converted the detectron2 pytorch model to torchscript format using the following lines:

        wrapper= TracingAdapter(model, example, inference_func)
        wrapper.eval()
        traced_script_module= torch.jit.trace(wrapper, (example,))

Then converted the traced_script_module to onnx format using:

        !pip install onnx
        # Save the TorchScript model to an ONNX file
        onnx_file = "detectron2_model.onnx"
        torch.onnx.export(
            traced_script_module,
            example,
            onnx_file,
            export_params=True,
            opset_version=11,  # Choose the desired ONNX opset version
            do_constant_folding=True,
            input_names=["input"],  # Set the names for input and output nodes
            output_names=["output"],
            dynamic_axes={"input": {0: "batch_size"}, "output": {0: "batch_size"}},
        )

Then tried to convert the onnx model to blob format using:

import blobconverter

blob_path = blobconverter.from_onnx(
model="/content/drive/MyDrive/ComputerVision/detectron2_model.onnx",
data_type="FP32",
shaves=5,
)

And got the below Error Report. I'm not sure whether the layers in the model are not supported for conversion or is there any other issue with the model.

\n[ ERROR ] ----------------- INTERNAL ERROR ----------------\n[ ERROR ] Unexpected exception happened.\n[ ERROR ] Please contact Model Optimizer developers and forward the following information:\n[ ERROR ] While validating ONNX node '<Node(Concat): /roi_heads/box_pooler/Concat_2>':\nCheck 'concat_axis < this_input_rank.get_length() && concat_axis >= 0' failed at core/src/op/concat.cpp:50:\nWhile validating node 'v0::Concat Concat_9882 (/roi_heads/box_pooler/Constant_6_output_0[0]:i64{1}, /roi_heads/box_pooler/Split_output_0[0]:i64{1}, /roi_heads/box_pooler/Constant_7_output_0[0]:i64{}) -> (dynamic...)' with friendly_name 'Concat_9882':\nConcatenation axis (0) is out of bounds [0, -1] for argument 2, which has shape {}.\n\n[ ERROR ] Traceback (most recent call last):\n File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 533, in main\n ret_code = driver(argv)\n File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 489, in driver\n graph, ngraph_function = prepare_ir(argv)\n File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 394, in prepare_ir\n ngraph_function = moc_pipeline(argv, moc_front_end)\n File "/app/venvs/venv2022_1/lib/python3.8/site-packages/openvino/tools/mo/moc_frontend/pipeline.py", line 147, in moc_pipeline\n ngraph_function = moc_front_end.convert(input_model)\nRuntimeError: While validating ONNX node '<Node(Concat): /roi_heads/box_pooler/Concat_2>':\nCheck 'concat_axis < this_input_rank.get_length() && concat_axis >= 0' failed at core/src/op/concat.cpp:50:\nWhile validating node 'v0::Concat Concat_9882 (/roi_heads/box_pooler/Constant_6_output_0[0]:i64{1}, /roi_heads/box_pooler/Split_output_0[0]:i64{1}, /roi_heads/box_pooler/Constant_7_output_0[0]:i64{}) -> (dynamic...)' with friendly_name 'Concat_9882':\nConcatenation axis (0) is out of bounds [0, -1] for argument 2, which has shape {}.\n\n\n[ ERROR ] ---------------- END OF BUG REPORT --------------\n[ ERROR ] -------------------------------------------------\n",

Feature request: Custom blob modification

This tool being capable of creating blobs with a known OpenVINO version, I propose the following change:
Modify the blobs major and minor version to selected OpenVINO version. Eg: major: 2021 & minor: 3
While we keep backwards compatibility in FW & core, by checking if major < 2000

Support for downloading model in IR format

When converting a model from TensorFlow or Caffe, some of our users would like to download not just the compiled blob file, but also .xml and .bin files (the OpenVINO IR representation).

There should be an option to specify this additional output, both via UI and API

[FeatureRequest] Update available zoo models faster

Start with Why

For faster development, so you don't need to wait to push a new demo app after uploading the model to the DepthAI model Zoo.

Move to What

Make updating of available models on depthai-model-zoo faster. I have uploaded face-recognition model and after +40h it was still not available on blobconverter;

Downloading /home/erik/.cache/blobconverter/face-recognition-arcface-112x112_openvino_2021.4_6shave.blob...
Model face-recognition-arcface-112x112 not found in model zoo
Conversion failed due to 400 Client Error: BAD REQUEST for url: https://blobconverter.luxonis.com/compile?version=2021.4&no_cache=False
Trying to find backup... (model="face-recognition-arcface-112x112", shaves="6", version="2021.4")
Unable to fetch model from backup server due to: 404 Client Error: Not Found for url: http://artifacts.luxonis.com/artifactory/blobconverter-backup/blobs/face-recognition-arcface-112x112_openvino_2021.4_6shave.blob

How

Decrease this delay to eg. 30 minutes, or maybe trigger an update event whenever a new commit is pushed to master branch on depthai-model-zoo.

Using OpenVINO 2022.1 causes re-download of cached blob every time

Hi there,

I updated my code to use OpenVINO 2022.1 and now every time I run the script it says "Cached blob is invalid, will download a new one from API."

I am using the following code (essentially a modified version of the gen2-mjpeg-streaming demo):


    # Start defining a pipeline
    pipeline = dai.Pipeline()
    pipeline.setOpenVINOVersion(version=dai.OpenVINO.Version.VERSION_2022_1)
    # Define a source - color camera
    colorCam = pipeline.create(dai.node.ColorCamera)

    if depth:
        mobilenet = pipeline.create(dai.node.MobileNetSpatialDetectionNetwork)
        monoLeft = pipeline.create(dai.node.MonoCamera)
        monoRight = pipeline.create(dai.node.MonoCamera)
        stereo = pipeline.create(dai.node.StereoDepth)
    else:
        mobilenet = pipeline.create(dai.node.MobileNetDetectionNetwork)

    colorCam.setPreviewSize(512, 512)
    colorCam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
    colorCam.setInterleaved(False)
    colorCam.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)

    mobilenet.setBlobPath(blobconverter.from_zoo("person-vehicle-bike-detection-crossroad-1016", shaves=6, version="2022.1"))
    mobilenet.setConfidenceThreshold(0.5)
    mobilenet.input.setBlocking(False)

Let me know if helpful to provide any other details!

cannot convert model

Hi,
I used tensorflow object detection API to to fine-tune and train SSD MobileNet V1 FPN 640x640 with tensorflow 2.
Then using openvino I generated xml and bin file. But I cannot covert it to blob as it gives this error:
Cannot create NonMaxSuppression layer StatefulPartitionedCall/Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/non_max_suppression_with_scores/NonMaxSuppressionV5 id:2842 from unsupported opset: opset9

What can I do?

[FeatureRequest] Add function arguments/return type

Start with why

For the ease of development - so engineers can easier find out which type and argument accepts - instead of having to read documentation, they can see that in code suggestions (in IDEs).

Move to What

Add argument types and function return types to blobconverter python package.

blobconverter cannot read Tensorflow model file

Problem:
I can't get blobconverter to read my Tensorflow model file.

Model file graph freeze and export built using:
python Tensorflow\models\research\object_detection\exporter_main_v2.py --input_type=image_tensor --pipeline_config_path=Tensorflow\workspace\models\my_ssd_mobnet\pipeline.config --trained_checkpoint_dir=Tensorflow\workspace\models\my_ssd_mobnet --output_directory=Tensorflow\workspace\models\my_ssd_mobnet\export

blobconverter command:
py -m blobconverter --tensorflow-pb C:\Users\jonsc\OneDrive\Documents\PYTHON\MachineLearning\TFODCourse-main\Tensorflow\workspace\models\my_ssd_mobnet\export\saved_model\saved_model.pb --shaves 6

Errors:
Downloading C:\Users\jonsc.cache\blobconverter\saved_model_openvino_2021.3_6shave.blob...
{
"exit_code": 1,
"message": "Command failed with exit code 1, command: /usr/bin/python3 model_compiler/openvino_2021.3/converter.py --precisions FP16 --output_dir /tmp/blobconverter/a642629270b8432f837a3716efaec82e --download_dir /tmp/blobconverter/a642629270b8432f837a3716efaec82e --name saved_model --model_root /tmp/blobconverter/a642629270b8432f837a3716efaec82e",
"stderr": "[ FRAMEWORK ERROR ] Cannot load input model: TensorFlow cannot read the model file: "/tmp/blobconverter/a642629270b8432f837a3716efaec82e/saved_model/FP16/saved_model.pb" is incorrect TensorFlow model file. \nThe file should contain one of the following TensorFlow graphs:\n1. frozen graph in text or binary format\n2. inference graph for freezing with checkpoint (--input_checkpoint) in text or binary format\n3. meta graph\n\nMake sure that --input_model_is_text is provided for a model in text format. By default, a model is interpreted in binary format. Framework error details: Error parsing message. \n For more information please refer to Model Optimizer FAQ, question #43. (https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html?question=43#question-43)\n",
"stdout": "========== Converting saved_model to IR (FP16)\nConversion command: /usr/bin/python3 -- /opt/intel/openvino/deployment_tools/model_optimizer/mo.py --framework=tf --data_type=FP16 --output_dir=/tmp/blobconverter/a642629270b8432f837a3716efaec82e/saved_model/FP16 --model_name=saved_model --data_type=FP16 --input_model=/tmp/blobconverter/a642629270b8432f837a3716efaec82e/saved_model/FP16/saved_model.pb\n\nModel Optimizer arguments:\nCommon parameters:\n\t- Path to the Input Model: \t/tmp/blobconverter/a642629270b8432f837a3716efaec82e/saved_model/FP16/saved_model.pb\n\t- Path for generated IR: \t/tmp/blobconverter/a642629270b8432f837a3716efaec82e/saved_model/FP16\n\t- IR output name: \tsaved_model\n\t- Log level: \tERROR\n\t- Batch: \tNot specified, inherited from the model\n\t- Input layers: \tNot specified, inherited from the model\n\t- Output layers: \tNot specified, inherited from the model\n\t- Input shapes: \tNot specified, inherited from the model\n\t- Mean values: \tNot specified\n\t- Scale values: \tNot specified\n\t- Scale factor: \tNot specified\n\t- Precision of IR: \tFP16\n\t- Enable fusing: \tTrue\n\t- Enable grouped convolutions fusing: \tTrue\n\t- Move mean values to preprocess section: \tNone\n\t- Reverse input channels: \tFalse\nTensorFlow specific parameters:\n\t- Input model in text protobuf format: \tFalse\n\t- Path to model dump for TensorBoard: \tNone\n\t- List of shared libraries with TensorFlow custom layers implementation: \tNone\n\t- Update the configuration file with input/output node names: \tNone\n\t- Use configuration file used to generate the model with Object Detection API: \tNone\n\t- Use the config file: \tNone\n\t- Inference Engine found in: \t/opt/intel/openvino/python/python3.6/openvino\nInference Engine version: \t2.1.2021.3.0-2787-60059f2c755-releases/2021/3\nModel Optimizer version: \t 2021.3.0-2787-60059f2c755-releases/2021/3\nFAILED:\nsaved_model\n"
}

I would very much appreciate it if someone would summarize the core issues addressed in the error messages and suggest how to fix them.

Conversion error while converting yolov8n.ONNX model

OS: Windows 10
Openvino version:2022.3.0

This is the error i get.
Unknown model format! Cannot find reader for model format: xml and read the model: /tmp/blobconverter/148c418a26bc4ac598f8702157228fe1/yolov8n/FP16/yolov8n.xml. Please check that reader library exists in your PATH.

anyway to solve this

thanks,

OpenVINO conversion failure

I have a Tensorflow model that I've been able to compile using OpenVINO 2021.3 mo_tf.py. I've been trying every method of compilation for MyriadX. I've tried both the CLI and Python script route, which returned:
requests.exceptions.HTTPError: 400 Client Error: BAD REQUEST for url: http://luxonis.com:8080/compile?version=2021.3

Trying with the online converter, I get the following error:
Encountered unknown input type of a loop v5::Loop StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/while (StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/strided_slice[0]:i32{}, StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/while/ExecutionConditionValue/Output_0/Data__const[0]:boolean{}, StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/time/Output_0/Data__const[0]:i32{}, StatefulPartitionedCall/sequential_1/lstm/zeros/Broadcast[0]:f16{1,30}, StatefulPartitionedCall/sequential_1/lstm/zeros_1/Broadcast[0]:f16{1,30}, StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/strided_slice[0]:i32{}, StatefulPartitionedCall/sequential_1/lstm/PartitionedCall/transpose[0]:f16{30,1,12800}) -> (f16{30,1,30}) at index 0

Additionally, the console output consistently generates the same message in a long loop from all methods:
[myriad_compile] usb_find_device_with_bcd:266\tLibrary has not been initialized when loaded\u001b[0m\n\u001b[35mE: [xLinkUsb] [ 939705] [myriad_compile] usb_find_device_with_bcd:266\tLibrary has not been initialized when loaded\u001b[0m\n\u001b[35mE: [xLinkUsb] [ 939705]

Is there anything that I'm missing in this process? The model is a VGG19 for transfer learning with a trained CNN and an input shape of [1, 30, 160, 160, 3].

Converting tensorflow model to blob

Hi,
I am trying to convert a model with input shape [1,224,224,3].
But I am getting a blob with input shape [3,224,244,1] which is not suitable to pass camera output to.
Is there a way to convert the model and keep the original input shape?

Unable to convert caffemodel and prototxt files to .blob file using the blob converter for QR code models

I was trying to follow the QR code model on the Luxonis depthai documentation. However upon using the blob converter to convert the caffemodel and prototxt files to .blob file, it gave me a conversion error. So i tried 2 other methods that managed to load the QR code model from opencv zoo and WeChatQRcode repos.

Luxonis QR code model (Old weights):
https://docs.luxonis.com/en/latest/pages/tutorials/deploying-custom-model/#qr-code-detector
New weights:
https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode

Issue downloading blobs from Asia regions

or one at least. I ran the basic demo for an Oak-D which required checking out https://github.com/luxonis/depthai.git and running depthai_demo.py after installing dependencies including blobconverter. This failed downloading the model with the error

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://blobconverter.s3.asia-southeast1.amazonaws.com/0a63afdfadf54974f7c890295c9c2b64f493980804133abbe2c0d29227ba1320.blob"

The host blobconverter.s3.asia-southeast1.amazonaws.com does not exist. I figured that it's very likely that the S3 buckets haven't been replicated or it's some region/multi-region thing as boto3 tries to automagically determine the closest region to download from.

The fix is to simply specify the region when creating the boto3 resource in cli/blobconverter/init.py

from

bucket = boto3.resource('s3', config=botocore.client.Config(signature_version=botocore.UNSIGNED))\
    .Bucket('blobconverter')

to

# region must be pinned to prevent boto3 specifying a bucket/region that doesn't exist
bucket = boto3.resource('s3', 
    region_name = 'us-east-1', 
    config=botocore.client.Config(signature_version=botocore.UNSIGNED))\
    .Bucket('blobconverter')

requests.exceptions.SSLError: HTTPSConnectionPool error

I tried to convert from openvino to xml but I keeo getting this error :
What should be the cause of this requests.exceptions.SSLError: HTTPSConnectionPool error ?

Downloading C:\Users\mahdi.mseddi.cache\blobconverter\best_openvino_2021.4_4shave.blob...
Traceback (most recent call last):
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 1042, in validate_conn
conn.connect()
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='blobconverter.luxonis.com', port=443): Max retries exceeded with url: /compile?version=2021.4&no_cache=False (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\blobconverter_main
.py", line 3, in
run_cli()
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\blobconverter_init
.py", line 574, in run_cli
return from_openvino(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\blobconverter_init
.py", line 477, in from_openvino
return compile_blob(blob_name=Path(xml_name).stem, req_data={"name": Path(xml_name).stem}, req_files=files, **kwargs)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\blobconverter_init_.py", line 311, in compile_blob
response = requests.post(
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\mahdi.mseddi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='blobconverter.luxonis.com', port=443): Max retries exceeded with url: /compile?version=2021.4&no_cache=False (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))

"Check 'backward_compatible_check || in_out_elements_equal' failed at core/src/op/reshape.cpp:395:\nWhile validating node '

Hello!
I have successfully converted a Yolo v3 pytorch model to OpenVINO format. However, when trying to convert it to MyriadX blob format, I get the following error:

python -m blobconverter --openvino-xml YOLO_V3.xml --openvino-bin YOLO_V3.bin
Downloading C:\Users\user\.cache\blobconverter\YOLO_V3_openvino_2021.4_4shave.blob...

{
    "exit_code": 1,
    "message": "Command failed with exit code 1, command: /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/myriad_compile -m /tmp/blobconverter/244035adc43c4988ba896476578c106e/YOLO_V3/FP16/YOLO_V3.xml -o /tmp/blobconverter/244035adc43c4988ba896476578c106e/YOLO_V3/FP16/YOLO_V3.blob -c /tmp/blobconverter/244035adc43c4988ba896476578c106e/myriad_compile_config.txt -ip U8",
    "stderr": "Check 'backward_compatible_check || in_out_elements_equal' failed at core/src/op/reshape.cpp:395:\nWhile validating node 'v1::Reshape Reshape_145 (LeakyRelu_143[0]:f32{1,256,4,2}, Constant_144[0]:i64{6}) -> (f32{?,?,?,?,?,?})' with friendly_name 'Reshape_145':\nRequested output shape {4,256,4,1,2,1} is incompatible with input shape Shape{1, 256, 4, 2}\n\n",
    "stdout": "Inference Engine: \n\tIE version ......... 2021.4.0\n\tBuild ........... 2021.4.0-3839-cd81789d294-releases/2021/4\n\u001b[1;33m[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM\u001b[0m\n"
}

Could you please tell me how to fix it? I have successfully converted another OpenVINO model into MyriadX, but I'm having a lot of troubles with this model...

Thank you!! :)

To Update pytorch_to_onnx.py in blobconverter 8080

While downloading ctdet_coco_dlav0_384 model from Luxonis:8080 port, it gives -

/usr/bin/python3: can't open file '/app/model_compiler/openvino_2021.3/pytorch_to_onnx.py': [Errno 2] No such file or directory

Also, to update Report a Bug link to correct link. Currently redirects to - https://gitlab.com/luxonis/blobconverter/-/issues/new

Seems like some public models in the Open_model_zoo in luxonis weren't available.
Eg -

[ ERROR ]  The "/tmp/blobconverter/f55d9a46a61a41ef9c7d380c6709caf2/efficientdet-d0-tf/efficientdet-d0_saved_model/efficientdet-d0_frozen.pb" is not existing file

Feature request: ONNX support

Start with the why:

It would be valuable to our users (and the team as well). One of the issues is here.

Move to the what:

Add ONNX support to BlobConverter (packet/CLI/webapp), the same we have for Caffe/TensorFlow. ONNX is supported out of the box by the OpenVINO so I believe this won't be a great challenge (compared to, say, PyTorch).

Move to the how:

A little bit of code:)

[FeatureRequest] Only use MO - convert model to IR format (xml/bin)

Start with why

Our depthai-model-zoo (DMZ) requires models to be in IR format (xml/bin), so blobconverter can compile the model for a different number of shave cores. So if you want to upload a model to DMZ, you need to install openvino locally.

Move to What

Add an option to blobconverter (webapp) to use download_ir argument and download IR (bin/xml) along with the blob. This is already supported by the CLI/python package/backend, so it just needs to be added to the frontend.

Error message when xml name != bin name

Currently, if name of .bin isn't the same as name of .xml, blobconverter will return no useful error message, which can lead to frustration. We should either support different names or return useful error message saying bin and XML has to have the same name.
image

Yet another TF conversion issue

I am trying to convert TF frozen graph to blob using online blob converter. I am receiving message below.

Error message

Command failed with exit code 1, command: /opt/intel/openvino2022_1/tools/compile_tool/compile_tool -m /tmp/blobconverter/600c78fcd1a541aa8d2ce540912eefd4/simple_frozen_graph/FP16/simple_frozen_graph.xml -o /tmp/blobconverter/600c78fcd1a541aa8d2ce540912eefd4/simple_frozen_graph/FP16/simple_frozen_graph.blob -c /tmp/blobconverter/600c78fcd1a541aa8d2ce540912eefd4/myriad_compile_config.txt -d MYRIAD -ip U8

Console output (stdout)

OpenVINO Runtime version ......... 2022.1.0
Build ........... 2022.1.0-7019-cdb9bec7210-releases/2022/1
Network inputs:
x : u8 / [...]
Network outputs:
Identity_1:0 : f16 / [...]
Identity:0 : f16 / [...]

Error output (stderr)

Cannot get length of dynamic dimension

I would appreciate it if you advise what to do.

Best regards.
Tugrul

onnx to blob conversion fails

I converted a detectron 2 model to onnx and then tried to use the blob converter to converter the model to blob format. I tried locally but facing the 400 Client Error: BAD REQUEST issue #34. while using the online conversion tool I am facing this error:

Error message
Command failed with exit code 1, command: /opt/intel/openvino2022_1/tools/compile_tool/compile_tool -m /tmp/blobconverter/0800e36bb6d64fe0bb9a98f679bbf476/model/FP16/model.xml -o /tmp/blobconverter/0800e36bb6d64fe0bb9a98f679bbf476/model/FP16/model.blob -c /tmp/blobconverter/0800e36bb6d64fe0bb9a98f679bbf476/myriad_compile_config.txt -d MYRIAD -ip U8
Console output (stdout)
OpenVINO Runtime version ......... 2022.1.0
Build ........... 2022.1.0-7019-cdb9bec7210-releases/2022/1
Network inputs:
x.1 : u8 / [...]
Network outputs:
boxes.35/sink_port_0 : f16 / [...]
value.3/sink_port_0 : i64 / [...]
value.7/sink_port_0 : f16 / [...]
value/sink_port_0 : f16 / [...]
onnx::Split_315/sink_port_0 : i64 / [...]
Error output (stderr)
[ GENERAL_ERROR ]
/home/jenkins/agent/workspace/private-ci/ie/build-linux-ubuntu20/b/repos/openvino/src/plugins/intel_myriad/common/src/ngraph/transformations/dynamic_to_static_shape_split.cpp:23 There is Split operation "/roi_heads/box_pooler/Split_output_0" by dynamic dimension, but only split by static dimension is supported: shape = "{?,?}", axis = "1"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.