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.
6392 Discussions

BlobReader error: The magic number imported blob doesn't match graph_transformer Traceback

Narsi
Novice
2,576 Views

Hello, 

I tried to compile a simple single layer onnx model into a blob using compile_tool and ran into  "BlobReader error: The magic number imported blob doesn't match graph_transformer
Traceback".

Few points: 

  1. Model Optimization ran without any problem. I obtained .XML file.
  2. When I run the benchmark on .XML file, the benchmark_app.py runs without any error.

 

_________________________________________________________________________

Model:

dummy_input = torch.randn(1, 2, 256, 256, device='cpu')

layer = nn.Sequential(nn.Conv2d(in_channels = 2, out_channels = 32, kernel_size = 3, stride=2, padding=1, dilation=1, groups=1, bias=True, padding_mode='zeros'),
nn.BatchNorm2d(32),
nn.ReLU())

torch.onnx.export(layer, dummy_input, "test.onnx", verbose=True)

___________________________________________________________________________

compile_tool.exe -m test_fp16_myriadx.xml -d MYRIAD -VPU_NUMBER_OF_SHAVES 2 -VPU_NUMBER_OF_CMX_SLICES 2
Inference Engine:
API version ............ 2.1
Build .................. 2021.2.0-1877-176bdf51370-releases/2021/2
Description ....... API

Network inputs:
input.1 : FP16 / NCHW
Network outputs:
10 : FP16 / NCHW

[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM
[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM
[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM
[Warning][VPU][Config] Deprecated option was used : VPU_MYRIAD_PLATFORM
Done. LoadNetwork time elapsed: 5052 ms

_________________________________________________________________________

Benchmark_app.py with blob input:

 

python benchmark_app.py -m test_fp16_myriadx.blob -d MYRIAD -api async -niter 10
[Step 1/11] Parsing and validating input arguments
C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\main.py:29: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
logger.warn(" -nstreams default value is determined automatically for a device. "
[ WARNING ] -nstreams default value is determined automatically for a device. Although the automatic selection usually provides a reasonable performance, but it still may be non-optimal for some cases, for more information look at README.
Network is compiled
[Step 2/11] Loading Inference Engine
[ INFO ] InferenceEngine:
API version............. 2.1.2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Device info
MYRIAD
myriadPlugin............ version 2.1
Build................... 2021.2.0-1877-176bdf51370-releases/2021/2

[Step 3/11] Setting device configuration
[Step 4/11] Reading network files
Skipping the step for compiled network
[Step 5/11] Resizing network to match image sizes and given batch
Skipping the step for compiled network
[Step 6/11] Configuring input of the model
Skipping the step for compiled network
[Step 7/11] Loading the model to the device
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:925 ncDeviceOpen() XLinkBootRemote is running for 1.2-ma2480...
←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:944 ncDeviceOpen() XLinkBootRemote returned success X_LINK_SUCCESS for 1.2-ma2480←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:1051 XLinkConnect done - link Id 0
←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:1082 Booted 1.2-ma2480 (1.18-) -> VSC
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1279 Device attributes
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1281 Device FW version: 444c4454.2480.0.0
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1282 Maximum graphs: 10
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1283 Maximum fifos: 20
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1284 Device memory capacity: 507510776
←[0m
[Info ][VPU][MyriadPlugin] Device #0 MYRIAD-X (USB protocol) allocated
[ ERROR ] BlobReader error: The magic number imported blob doesn't match graph_transformer
Traceback (most recent call last):
File "C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\main.py", line 246, in run
exe_network = benchmark.import_network(args.path_to_model)
File "C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\benchmark.py", line 83, in import_network
num_requests=1 if self.api_type == 'sync' else self.nireq or 0)
File "ie_api.pyx", line 336, in openvino.inference_engine.ie_api.IECore.import_network
File "ie_api.pyx", line 345, in openvino.inference_engine.ie_api.IECore.import_network
RuntimeError: BlobReader error: The magic number imported blob doesn't match graph_transformer
←[36mI: [ncAPI] [ 0] [] ncDeviceClose:1712 Removing device...←[0m
←[36mI: [ncAPI] [ 0] [] destroyDeviceHandle:1655 Destroying device handler←[0m

Labels (2)
0 Kudos
1 Solution
Narsi
Novice
2,304 Views

Just to add an update to this thread:

  • I was unable to run the model using the above solutions on my PC.
  • I was able to create a simple benchmark app using the IECore python module, which worked well. 

 

View solution in original post

0 Kudos
10 Replies
IntelSupport
Community Manager
2,544 Views

 

Hi Narsi,

Thanks for reaching out. Could you share your model so that we can test it on our machine?Thanks

 

Regards,

Aznie


0 Kudos
Narsi
Novice
2,535 Views

I am attaching .onnx, .xml, .bin, .mapping, and .blob files for the below pytorch model. 

Model:

dummy_input = torch.randn(1, 2, 256, 256, device='cpu')

layer = nn.Sequential(nn.Conv2d(in_channels = 2, out_channels = 32, kernel_size = 3, stride=2, padding=1, dilation=1, groups=1, bias=True, padding_mode='zeros'),
nn.BatchNorm2d(32),
nn.ReLU())

torch.onnx.export(layer, dummy_input, "test.onnx", verbose=True)

0 Kudos
IntelSupport
Community Manager
2,489 Views

Hi Narsi,

Greetings to you. I apologize for the delay in replying to you. We are still investigating the blob file as we are facing different errors when executing the benchmark on the blob file. Could you please recheck the files in the zip is it the same that you are tested on your side?

Thanks


Regards,

Aznie



0 Kudos
Narsi
Novice
2,476 Views

So, when I try first time It am getting the following error:

←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:925 ncDeviceOpen() XLinkBootRemote is running for 1.1-ma2480...
←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:944 ncDeviceOpen() XLinkBootRemote returned success X_LINK_SUCCESS for 1.1-ma2480←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:1051 XLinkConnect done - link Id 0
←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceOpen:1082 Booted 1.1-ma2480 (1.17-) -> VSC
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1279 Device attributes
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1281 Device FW version: 444c4454.2480.0.0
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1282 Maximum graphs: 10
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1283 Maximum fifos: 20
←[0m
←[36mI: [ncAPI] [ 0] [] getDevAttributes:1284 Device memory capacity: 507510776
←[0m
[Info ][VPU][MyriadPlugin] Device #0 MYRIAD-X (USB protocol) allocated
←[36mI: [ncAPI] [ 0] [] ncGraphAllocate:1976 Starting Graph allocation sequence
←[0m
←[36mI: [ncAPI] [ 0] [] ncGraphAllocate:2062 Sent graph←[0m
←[31mF: [global] [ 0] [EventRead00Thr] dispatcherEventReceive:91 Duplicate id detected.
←[0m
←[31mF: [xLink] [ 0] [Scheduler00Thr] dispatcherResponseServe:740 no request for this response: XLINK_WRITE_RESP 1
←[0m
←[35mE: [global] [ 0] [EventRead00Thr] handleIncomingEvent:543 Assertion Failed: event->header.type >= XLINK_WRITE_REQ && event->header.type != XLINK_REQUEST_LAST && event->header.type < XLINK_RESP_LAST
←[0m
←[35mE: [global] [ 0] [] addEvent:264 Condition failed: event->header.flags.bitField.ack != 1←[0m
←[35mE: [global] [ 0] [] addEventWithPerf:276 addEvent(event) method call failed with an error: 3←[0m
←[35mE: [global] [ 0] [EventRead00Thr] handleIncomingEvent:543 Assertion Failed: event->header.type >= XLINK_WRITE_REQ && event->header.type != XLINK_REQUEST_LAST && event->header.type < XLINK_RESP_LAST
←[0m
←[35mE: [global] [ 0] [] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime))←[0m
←[35mE: [global] [ 0] [EventRead00Thr] handleIncomingEvent:543 Assertion Failed: event->header.type >= XLINK_WRITE_REQ && event->header.type != XLINK_REQUEST_LAST && event->header.type < XLINK_RESP_LAST
←[0m
←[35mE: [ncAPI] [ 0] [] ncGraphAllocate:2070 Can't read input tensor descriptors of the graph, rc: X_LINK_ERROR←[0m
←[35mE: [global] [ 0] [EventRead00Thr] handleIncomingEvent:552 [ ERROR ] Failed to allocate graph: NC_ERROR
Traceback (most recent call last):
File "C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\main.py", line 246, in run
exe_network = benchmark.import_network(args.path_to_model)
File "C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\benchmark.py", line 83, in import_network
num_requests=1 if self.api_type == 'sync' else self.nireq or 0)
File "ie_api.pyx", line 336, in openvino.inference_engine.ie_api.IECore.import_network
File "ie_api.pyx", line 345, in openvino.inference_engine.ie_api.IECore.import_network
RuntimeError: Failed to allocate graph: NC_ERROR
Assertion Failed: stream
[ INFO ] Statistics report is stored to benchmark_report.csv
←[0m
←[36mI: [ncAPI] [ 0] [] ncDeviceClose:1712 Removing device...←[0m
←[35mE: [xLinkWinUsb] [ 0] [Scheduler00Thr] usb_bulk_write:467
WinUsb_WritePipe failed with error:=22
←[0m
←[35mE: [global] [ 0] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -2) | event XLINK_CLOSE_STREAM_REQ
←[0m
←[35mE: [xLink] [ 0] [Scheduler00Thr] sendEvents:998 Event sending failed←[0m
←[35mE: [xLinkWinUsb] [ 0] [Scheduler00Thr] usb_bulk_write:467
WinUsb_WritePipe failed with error:=22
←[0m
←[35mE: [global] [ 0] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -2) | event XLINK_RESET_REQ
←[0m
←[35mE: [xLink] [ 0] [Scheduler00Thr] sendEvents:998 Event sending failed←[0m
←[35mE: [ncAPI] [ 0] [] ncDeviceClose:1855 Device didn't appear after reboot←[0m
←[36mI: [ncAPI] [ 0] [] destroyDeviceHandle:1655 Destroying device handler←[0m

---------------------------------------------------------------------------------------------

However, when I try to repeat the experiment, I am getting the first reported blob error. 

BlobReader error: The magic number imported blob doesn't match graph_transformer Traceback

 

0 Kudos
IntelSupport
Community Manager
2,456 Views

Hi Narsi,

Thank you for your patience. From our finding, using the compile_tool to generate blob file from the model will lead to some issues when using the benchmark app. Therefore, we have tested using myriad_compile (<openvino_2021.2.185>)\deployment_tools\inference_engine\bin\intel64\Release) and the issue is resolved. Benchmark app able to show the report after executing with the blob file generated using myriad_compile.

 

I would suggest you use myriad_compile with the following command line:

Myriad_compile.exe -m test_fp16_myriad.xml -VPU_NUMBER_OF_SHAVES 2 -VPU_NUMBER_OF_CMX_SLICES 2

 

Basically, myriad_compile is designed for MYRIAD only, so -d MYRIAD is not required.

 

Finally, run the benchmark app to test the blob file.

 

Regards,

Aznie


0 Kudos
Narsi
Novice
2,450 Views

Hi,

I was able to compile the model using myriad_compile.exe. However, when I use benchmark_app.py to benchmark the model performance, I am getting the following error:

--------------------------------------------------------------------------------

Step 1/11] Parsing and validating input arguments
Network is compiled
[Step 2/11] Loading Inference Engine
[ INFO ] InferenceEngine:
API version............. 2.1.2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Device info
MYRIAD
myriadPlugin............ version 2.1
Build................... 2021.2.0-1877-176bdf51370-releases/2021/2

[Step 3/11] Setting device configuration
[Step 4/11] Reading network files
Skipping the step for compiled network
[Step 5/11] Resizing network to match image sizes and given batch
Skipping the step for compiled network
[Step 6/11] Configuring input of the model
Skipping the step for compiled network
[Step 7/11] Loading the model to the device
I: [ncAPI] [ 0] [] ncDeviceOpen:925 ncDeviceOpen() XLinkBootRemote is running for 1.1-ma2480...

I: [ncAPI] [ 0] [] ncDeviceOpen:944 ncDeviceOpen() XLinkBootRemote returned success X_LINK_SUCCESS for 1.1-ma2480
I: [ncAPI] [ 0] [] ncDeviceOpen:1051 XLinkConnect done - link Id 0

I: [ncAPI] [ 0] [] ncDeviceOpen:1082 Booted 1.1-ma2480 (1.17-) -> VSC

I: [ncAPI] [ 0] [] getDevAttributes:1279 Device attributes

I: [ncAPI] [ 0] [] getDevAttributes:1281 Device FW version: 444c4454.2480.0.0

I: [ncAPI] [ 0] [] getDevAttributes:1282 Maximum graphs: 10

I: [ncAPI] [ 0] [] getDevAttributes:1283 Maximum fifos: 20

I: [ncAPI] [ 0] [] getDevAttributes:1284 Device memory capacity: 507510776

[Info ][VPU][MyriadPlugin] Device #0 MYRIAD-X (USB protocol) allocated
I: [ncAPI] [ 0] [] ncGraphAllocate:1976 Starting Graph allocation sequence

I: [ncAPI] [ 0] [] ncGraphAllocate:2062 Sent graph
I: [ncAPI] [ 0] [] ncGraphAllocate:2184 Graph allocation completed successfully

I: [ncAPI] [ 0] [] ncFifoCreate:2859 Init fifo
I: [ncAPI] [ 0] [] ncFifoAllocate:2960 Creating fifo
I: [ncAPI] [ 0] [] ncFifoCreate:2859 Init fifo
I: [ncAPI] [ 0] [] ncFifoAllocate:2960 Creating fifo
[ INFO ] Import network took 1428.97 ms
[Step 8/11] Setting optimal runtime parameters
[Step 9/11] Creating infer requests and filling input blobs with images
[ INFO ] Network input 'input.1' precision FP16, dimensions (NCHW): 1 2 256 256
C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\utils\inputs_filling.py:71: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
logger.warn("No input files were given: all inputs will be filled with random values!")
[ WARNING ] No input files were given: all inputs will be filled with random values!
[ INFO ] Infer Request 0 filling
[ INFO ] Fill input 'input.1' with random values (some binary data is expected)
[ ERROR ] local variable 'ie_network' referenced before assignment
Traceback (most recent call last):
File "C:\Program Files (x86)\Intel\openvino_2021.2.185\python\python3.7\openvino\tools\benchmark\main.py", line 283, in run
('topology', ie_network.name),
UnboundLocalError: local variable 'ie_network' referenced before assignment
[ INFO ] Statistics report is stored to benchmark_report.csv
I: [ncAPI] [ 0] [] ncDeviceClose:1712 Removing device...
I: [ncAPI] [ 0] [] destroyDeviceHandle:1655 Destroying device handler

--------------------------------------------------------------------------------

 

Is there any other app that we need to use for benchmarking blob files?

 

Thank you,

Narsi

0 Kudos
IntelSupport
Community Manager
2,418 Views

 

Hi Narsi,

Your error might be due to some problem with python. I'll provide the blob file that I generated and please test it on the following environments.

  1. Using the blob file shared and test on benchmark_app.py.
  2. Using the blob file shared and test on benchmark_app.exe (need to compile the cpp from inference_engine/demo)
  3. If items 1 & 2 still fails, then you need to verify the NCS2 by running the demo scripts (demo_squeezenent_download_convert_run.sh -d MYRIAD)

Regards,

Aznie

 

0 Kudos
IntelSupport
Community Manager
2,377 Views

Hi Narsi,

Some update for you, we have tested the compile_tool.exe with your model using OpenVINO 2021.3 which our latest version. The .blob file generated by compile_tool.exe successfully generates report when executing with the benchmark app.

 

Regards,

Aznie


0 Kudos
IntelSupport
Community Manager
2,339 Views

Hi Narsi,

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


Regards,

Aznie


0 Kudos
Narsi
Novice
2,305 Views

Just to add an update to this thread:

  • I was unable to run the model using the above solutions on my PC.
  • I was able to create a simple benchmark app using the IECore python module, which worked well. 

 

0 Kudos
Reply