Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]openvino2022 compile_tool failed. Failed to allocate graph: MYRIAD device is not opened. #11807

Closed
3 tasks done
changewOw opened this issue Jun 7, 2022 · 16 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working category: tools OpenVINO C++ / Python tools PSE support_request

Comments

@changewOw
Copy link

changewOw commented Jun 7, 2022

System information (version)
  • OpenVINO=> 2022.1.0-7019-cdb9bec7210-releases/2022/1
  • Operating System / Platform => ubunt18.04
  • Compiler => ❔
  • Problem classification => MYRAID compile tool
Detailed description

When I use the compile_tool for conversion, I meet an error.
[setupvars.sh] OpenVINO environment initialized
/home/zyb/2661
OpenVINO Runtime version ......... 2022.1.0
Build ........... 2022.1.0-7019-cdb9bec7210-releases/2022/1
Network inputs:
image : u8 / [N,C,H,W]
Network outputs:
detection_out/sink_port_0 : f16 / [...]
Failed to allocate graph: MYRIAD device is not opened.

Steps to reproduce
  1. Download openvino model. omz_downloader --name face-detection-0200 -o ./omz/
  2. Source openvino env. source setupvars.sh
  3. Invoke compile_tool for converting face-detection model. ./compile_tool -m ./omz/intel/face-detection-0200/FP32/face-detection-0200.xml -d MYRIAD -ip U8
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
  • There is reproducer code and related data files: images, videos, models, etc.
@changewOw changewOw added bug Something isn't working support_request labels Jun 7, 2022
@brmarkus
Copy link

brmarkus commented Jun 7, 2022

Have you installed a pre-built version of OpenVINO (contains the MyriadX-device plugin) or have you compiled it from source-code (doesn't contain the plugin)?
Have you installed the udev-rule?
Do you have a MyriadX (NCS2) device connected? Connected via an USB3 (SuperSpeed) capable connector? Connected via USB3 capable USB-hub (ideally with external power)?
Do you see the MyriadX (NCS2) device via lsusb?

@changewOw
Copy link
Author

changewOw commented Jun 7, 2022

I just want to convert the IR model into a blob. I don't want to run the model in the real-world here.
So I don't understand why "compile_tool" wanna try to open a myraid device

@jgespino jgespino added category: VPU and removed bug Something isn't working labels Jun 7, 2022
@Luxonis-Vlad
Copy link

@brmarkus I have the same problem (tried in openvino docker container and also in openvino compiled from source code).

@jgespino
Copy link
Contributor

@changewOw @Luxonis-Vlad Thank you for reporting, I am able to reproduce the issue on 2022.1 release. The compile tool should not require the Neural Compute Stick 2 to be connected. I confirmed the compile tool works as expected in 2021.4.2 release and I reported this issue to the development team.

2022.1:
image

2021.4.2:
image

Regards,
Jesus

Ref. 86400

@jgespino jgespino self-assigned this Jun 15, 2022
@jgespino jgespino added bug Something isn't working category: tools OpenVINO C++ / Python tools PSE labels Jun 15, 2022
@kamegbor
Copy link

having same issue here as well

@SzabolcsGergely
Copy link

Any update @jgespino ?
Is this addressed in a branch, so we can compile from source?

@jgespino
Copy link
Contributor

jgespino commented Jul 13, 2022

@szabi-luxonis Not yet, I will link the pull request once we have a fix.

@alexk-ede
Copy link

Same issue here. I just want to convert the IR model into a blob.
Any updates ?

@DariaMityagina
Copy link
Contributor

Hi all!

This can be worked around by using the following config option:
MYRIAD_ENABLE_MX_BOOT NO

As soon as there is a proper fix, I will let you know.

@jgespino
Copy link
Contributor

Thanks @DariaMityagina for the workaround, looking forward to the proper fix.

@alexk-ede @szabi-luxonis @kamegbor @changewOw @Luxonis-Vlad Can you try the workaround provided by @DariaMityagina ? It worked for me using the following steps.

  1. Created myriad.conf file with the following content:
    MYRIAD_ENABLE_MX_BOOT NO
  2. Ran compile_tool using the following command:
> compile_tool.exe -m intel\face-detection-0200\FP16\face-detection-0200.xml -d MYRIAD -c myriad.conf

OpenVINO Runtime version ......... 2022.1.0
Build ........... 2022.1.0-7019-cdb9bec7210-releases/2022/1
Network inputs:
    image : f16 / [N,C,H,W]
Network outputs:
    detection_out/sink_port_0 : f16 / [...]
Done. LoadNetwork time elapsed: 707 ms

@alexk-ede
Copy link

Indeed, it worked.
Thank you for notifying us.

@jgespino jgespino closed this as completed Aug 9, 2022
@Veereshdammur
Copy link

Hi, I am facing the same issue in the docker container running on ubuntu 20.04.

`openvino@4582fb921620:/opt/intel/openvino_2022.2.0.7713$ /bin/bash -c "omz_downloader --name googlenet-v1 --precisions FP16 && omz_converter --name googlenet-v1 --precision FP16 && curl -O https://storage.openvinotoolkit.org/data/test_data/images/car_1.bmp && python3 samples/python/hello_classification/hello_classification.py public/googlenet-v1/FP16/googlenet-v1.xml car_1.bmp MYRIAD"
################|| Downloading googlenet-v1 ||################

========== Downloading /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt
... 100%, 35 KB, 217121 KB/s, 0 seconds passed

========== Downloading /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel
... 100%, 52279 KB, 82691 KB/s, 0 seconds passed

========== Replacing text in /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt

========== Converting googlenet-v1 to IR (FP16)
Conversion command: /usr/bin/python3.8 -- /usr/local/bin/mo --framework=caffe --data_type=FP16 --output_dir=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16 --model_name=googlenet-v1 --input=data '--mean_values=data[104.0,117.0,123.0]' --output=prob --input_model=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel --input_proto=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt '--layout=data(NCHW)' '--input_shape=[1, 3, 224, 224]'

Model Optimizer arguments:
Common parameters:
- Path to the Input Model: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel
- Path for generated IR: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16
- IR output name: googlenet-v1
- Log level: ERROR
- Batch: Not specified, inherited from the model
- Input layers: data
- Output layers: prob
- Input shapes: [1, 3, 224, 224]
- Source layout: Not specified
- Target layout: Not specified
- Layout: data(NCHW)
- Mean values: data[104.0,117.0,123.0]
- 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
Caffe specific parameters:
- Path to Python Caffe* parser generated from caffe.proto: /usr/local/lib/python3.8/dist-packages/openvino/tools/mo/utils/../front/caffe/proto
- Enable resnet optimization: True
- Path to the Input prototxt: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt
- Path to CustomLayersMapping.xml: /usr/local/lib/python3.8/dist-packages/openvino/tools/mo/utils/../../extensions/front/caffe/CustomLayersMapping.xml
- Path to a mean file: Not specified
- Offsets for a mean file: Not specified
OpenVINO runtime found in: /opt/intel/openvino/python/python3.8/openvino
OpenVINO runtime version: 2022.2.0-7713-af16ea1d79a-releases/2022/2
Model Optimizer version: 2022.2.0-7713-af16ea1d79a-releases/2022/2
[ WARNING ]
Detected not satisfied dependencies:
protobuf: not installed, required: < 4.0.0

Please install required versions of components or run pip installation
pip install openvino-dev[caffe]
[ SUCCESS ] Generated IR version 11 model.
[ SUCCESS ] XML file: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16/googlenet-v1.xml
[ SUCCESS ] BIN file: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16/googlenet-v1.bin
[ SUCCESS ] Total execution time: 7.41 seconds.
[ SUCCESS ] Memory consumed: 191 MB.
[ INFO ] The model was converted to IR v11, the latest model format that corresponds to the source DL framework input/output format. While IR v11 is backwards compatible with OpenVINO Inference Engine API v1.0, please use API v2.0 (as of 2022.1) to take advantage of the latest improvements in IR v11.
Find more information about API v2.0 and IR v11 at https://docs.openvino.ai

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1398k 100 1398k 0 0 3632k 0 --:--:-- --:--:-- --:--:-- 3632k
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: public/googlenet-v1/FP16/googlenet-v1.xml
[ INFO ] Loading the model to the plugin
E: [ncAPI] [ 516767] [python3] ncDeviceOpen:1013 Failed to find booted device after boot
Traceback (most recent call last):
File "samples/python/hello_classification/hello_classification.py", line 114, in
sys.exit(main())
File "samples/python/hello_classification/hello_classification.py", line 80, in main
compiled_model = core.compile_model(model, device_name)
File "/opt/intel/openvino/python/python3.8/openvino/runtime/ie_api.py", line 387, in compile_model
super().compile_model(model, device_name, {} if config is None else config),
RuntimeError: Failed to allocate graph: MYRIAD device is not opened.
openvino@4582fb921620:/opt/intel/openvino_2022.2.0.7713$ ls
`
In which directory should we create myriad.conf file?

@brmarkus
Copy link

brmarkus commented Dec 5, 2022

@Veereshdammur this looks like a different topic; when only compiling an IR-model to a blob (e.g. compiling a model on a HOST-machine, then deploying the compiled model to a production environment) it should not be required to have a Myriad-X/NCS2 device connected.

Your topic sounds like MyriadX was not set-up properly on your HOST-machine (like UDEV-rule not installed) and/or the way you started your Docker container is missing USB-related information and/or you have created your own Docker container but missed the usb-udev-event-related information (see the note under "https://docs.openvino.ai/latest/openvino_docs_install_guides_installing_openvino_docker_linux.html#known-limitations").

Which OS are you running on, have you installed OpenVINO on the HOST, i.e. outside the container? Can you use a pre-built OpenVINO Docker container (see "https://hub.docker.com/u/openvino") and then try the command line as shown under "https://docs.openvino.ai/latest/openvino_docs_install_guides_installing_openvino_docker_linux.html#running-the-image-on-intel-neural-compute-stick-2"?

@Veereshdammur
Copy link

Hi, Thanks for the quick response. I am actually trying to configure the NCS2 on my ubuntu machine. So far I have been attempting to install openvino-dev via PIP but couldn't succeed.

I also made an attempt to run the docker image in a container as specified in the documentation (link).

The setup details are mentioned below,

OS version: Ubuntu 20.04.5 LTS

Docker version: Docker version 20.10.21, build baeda1f

The NCS 2 device is plugged into a USB3.0 slot and it's getting detected within the system :

veeresh@veeresh-ubuntu:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 1532:0526 Razer USA, Ltd Razer Kraken X USB
Bus 001 Device 005: ID 03e7:2485 Intel Movidius MyriadX
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 0bda:b812 Realtek Semiconductor Corp. 802.11ac NIC
Bus 001 Device 007: ID 1b1c:0c08 Corsair H80i v2
Bus 001 Device 002: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I have pulled the ubuntu20_dev image from the remote hub:

sudo docker images
[sudo] password for veeresh: 
REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
openvino/ubuntu20_dev        latest    4d74f6183540   2 months ago    5.93GB
openvino/ubuntu20_data_dev   latest    e3c789f3a797   12 months ago   6.89GB
hello-world                  latest    feb5d9fea6a5   14 months ago   13.3kB

And then I issued this command from the documentation of NCS2, but it was failed due to invalid argument.

veeresh@veeresh-ubuntu:~$ sudo docker run -it --rm --device-cgroup-rule='c 189:\* rmw' -v /dev/bus/usb:/dev/bus/usb openvino/ubuntu20_dev
invalid argument "c 189:\\* rmw" for "--device-cgroup-rule" flag: invalid device cgroup format 'c 189:\* rmw'
See 'docker run --help'.

Then I tried issuing the second command (uses the privilege mode) and it worked.

sudo docker run -it --rm --privileged -v /dev:/dev --network=host openvino/ubuntu20_dev

When I tried running the same example which is given in the documentation (link), I was encountered with the error RuntimeError: Failed to allocate graph: MYRIAD device is not opened.

openvino@veeresh-ubuntu:/opt/intel/openvino_2022.2.0.7713$ /bin/bash -c "omz_downloader --name googlenet-v1 --precisions FP16 && omz_converter --name googlenet-v1 --precision FP16 && curl -O https://storage.openvinotoolkit.org/data/test_data/images/car_1.bmp && python3 samples/python/hello_classification/hello_classification.py public/googlenet-v1/FP16/googlenet-v1.xml car_1.bmp MYRIAD"
################|| Downloading googlenet-v1 ||################

========== Downloading /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt
... 100%, 35 KB, 40610 KB/s, 0 seconds passed

========== Downloading /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel
... 100%, 52279 KB, 38632 KB/s, 1 seconds passed

========== Replacing text in /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt

========== Converting googlenet-v1 to IR (FP16)
Conversion command: /usr/bin/python3.8 -- /usr/local/bin/mo --framework=caffe --data_type=FP16 --output_dir=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16 --model_name=googlenet-v1 --input=data '--mean_values=data[104.0,117.0,123.0]' --output=prob --input_model=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel --input_proto=/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt '--layout=data(NCHW)' '--input_shape=[1, 3, 224, 224]'

Model Optimizer arguments:
Common parameters:
	- Path to the Input Model: 	/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.caffemodel
	- Path for generated IR: 	/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16
	- IR output name: 	googlenet-v1
	- Log level: 	ERROR
	- Batch: 	Not specified, inherited from the model
	- Input layers: 	data
	- Output layers: 	prob
	- Input shapes: 	[1, 3, 224, 224]
	- Source layout: 	Not specified
	- Target layout: 	Not specified
	- Layout: 	data(NCHW)
	- Mean values: 	data[104.0,117.0,123.0]
	- 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
Caffe specific parameters:
	- Path to Python Caffe* parser generated from caffe.proto: 	/usr/local/lib/python3.8/dist-packages/openvino/tools/mo/utils/../front/caffe/proto
	- Enable resnet optimization: 	True
	- Path to the Input prototxt: 	/opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/googlenet-v1.prototxt
	- Path to CustomLayersMapping.xml: 	/usr/local/lib/python3.8/dist-packages/openvino/tools/mo/utils/../../extensions/front/caffe/CustomLayersMapping.xml
	- Path to a mean file: 	Not specified
	- Offsets for a mean file: 	Not specified
OpenVINO runtime found in: 	/opt/intel/openvino/python/python3.8/openvino
OpenVINO runtime version: 	2022.2.0-7713-af16ea1d79a-releases/2022/2
Model Optimizer version: 	2022.2.0-7713-af16ea1d79a-releases/2022/2
[ WARNING ]  
Detected not satisfied dependencies:
	protobuf: not installed, required: < 4.0.0

Please install required versions of components or run pip installation
pip install openvino-dev[caffe]
[ SUCCESS ] Generated IR version 11 model.
[ SUCCESS ] XML file: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16/googlenet-v1.xml
[ SUCCESS ] BIN file: /opt/intel/openvino_2022.2.0.7713/public/googlenet-v1/FP16/googlenet-v1.bin
[ SUCCESS ] Total execution time: 5.91 seconds. 
[ SUCCESS ] Memory consumed: 190 MB. 
[ INFO ] The model was converted to IR v11, the latest model format that corresponds to the source DL framework input/output format. While IR v11 is backwards compatible with OpenVINO Inference Engine API v1.0, please use API v2.0 (as of 2022.1) to take advantage of the latest improvements in IR v11.
Find more information about API v2.0 and IR v11 at https://docs.openvino.ai

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1398k  100 1398k    0     0  3709k      0 --:--:-- --:--:-- --:--:-- 3699k
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: public/googlenet-v1/FP16/googlenet-v1.xml
[ INFO ] Loading the model to the plugin
E: [ncAPI] [    501146] [python3] ncDeviceOpen:1013	Failed to find booted device after boot
Traceback (most recent call last):
  File "samples/python/hello_classification/hello_classification.py", line 114, in <module>
    sys.exit(main())
  File "samples/python/hello_classification/hello_classification.py", line 80, in main
    compiled_model = core.compile_model(model, device_name)
  File "/opt/intel/openvino/python/python3.8/openvino/runtime/ie_api.py", line 387, in compile_model
    super().compile_model(model, device_name, {} if config is None else config),
RuntimeError: Failed to allocate graph: MYRIAD device is not opened.
openvino@veeresh-ubuntu:/opt/intel/openvino_2022.2.0.7713$ exit

So, it seems like Udev rules are not updated while running the command. How do we solve this problem?

@DariaMityagina
Copy link
Contributor

So, it seems like Udev rules are not updated while running the command. How do we solve this problem?

Hi!
To update the Udev rules, please try the following:

cat <<EOF > 97-myriad-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF

sudo cp 97-myriad-usbboot.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig

@Veereshdammur
Copy link

Thanks a lot for your answer. It worked!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: tools OpenVINO C++ / Python tools PSE support_request
Projects
None yet
Development

No branches or pull requests

9 participants