Community
cancel
Showing results for 
Search instead for 
Did you mean: 
andrewchyn
Novice
418 Views

Fix NCS1/2 not being detected on boot

Background info:

 

https://stackoverflow.com/questions/60431499/cant-import-openvino-on-raspberry-pi-startup

 

I am using a Raspberry Pi 3 Model B Rev 1.2 running Raspbian 10 (Buster). My project is additionally using a USB Webcam

 

I have a python project that displays an OpenCV GUI which I wanted to run on boot. I couldn't find a great way to initialize the OpenVINO environment properly on boot after many searches and different methods so I currently have my pi launch an instance of LXTerminal on boot and my .bashrc does the rest.

 

Issue:

Every time the pi is booted, it can't seem to detect my NCS. This never seemed to be an issue before. I've tried both the NCS1 and 2 but the results are the same. The only way for them to be detected is to simply plug/unplug them after boot, which is impractical for my project.

 

What could be the issue? I'm not very experienced with working on the Raspberry Pi so I'm assuming I've made some sort of mistake along the way.

 

Edit: The behaviour is even stranger than I initially thought. When booting then plugging in the NCS causes it to not be recognized, but after a few attempts at starting the script it suddenly detects (it wasn't a time based fix).

 

Any help is appreciated, and if there's a better way to do the auto-run python script + initialize OpenVINO please let me know.

Thanks.

 

Tags (1)
9 Replies
MAURICIOAL_R_Intel
Moderator
193 Views

Thank you for reaching out.

 

Please make sure that you added the USB Rules using:

sudo usermod -a -G users "$(whoami)"

Please note that after this, you will need to log out and log in for it to take effect.

 

You can check all the steps to install OpenVINO™ toolkit for Raspbian* OS here.

 

Regards,

Mauricio R.

andrewchyn
Novice
193 Views

Hi Mauricio,

 

I followed the steps for installing the toolkit the first time, but redid them just now.

 

Unfortunately this did not resolve my issues. I've tried running the script normally and I still get the NC_ERROR. Additionally, after getting the script to run (often through a series of plugging/unplugging and rerunning the script) and quitting, a subsequent run does not guarantee a connection. I can't seem to find a pattern for when the NCS connects, I'll update this reply if I do

 

edit: After further inspection I've come to realize that this seems to be a timing issue, the NCS is detected, but as ID 03e7:f63b Intel for a while before changing to ID 03e7:2485 Intel Movidius MyriadX.

 

I'm now hoping that there's a way to speed up this process, as this ~30 second delay is undesirable for my use case. Thanks

MAURICIOAL_R_Intel
Moderator
193 Views

Thank you for your response.

 

Which version of OpenVINO™ toolkit are you using?

 

The NCS should be detected as 03e7:2485 (NCS 2) or 03e7:2150 (NCS) when you plug it in. It should be available ready to use. When the device is detected as 03e7:f63b, the device is running inference.

Having this in mind, can you check if your program finished running or is not running a second instance in the background?

 

Also, you can check this article on how to start one of the sample demos on boot

 

Regards,

Mauricio R.

andrewchyn
Novice
193 Views

I just updated to the newest release of OpenVINO™ for Raspbian.

 

I previously followed the article you linked, but I don't believe it is suited for my program, as I need to access a webcam and display a GUI. I'll try it again in the meantime.

 

As for the chance the program is running in the background, I have checked my crontab, autostart, and previous attempts at using system services and don't see any possibility for there to be a background instance. I'll continue looking for now.

MAURICIOAL_R_Intel
Moderator
193 Views

Hello, can you try the following, please:

 

on_reboot.service:

[Unit]

Description=Init OpenVINO env and run python interactive face demo

 

After=network.target

 

[Service]

Environment="DISPLAY=:0"

Environment="XAUTHORITY=/home/pi/.Xauthority"

ExecStart=/home/pi/app/on_reboot.sh

WorkingDirectory=/home/pi

StandardOutput=inherit

StandardError=inherit

Restart=on-failure

User=pi

 

[Install]

WantedBy=graphical.target

 

on_reboot.sh:

#!/bin/bash

 

source /opt/intel/openvino/bin/setupvars.sh

/home/pi/app/interactive_face_detection_demo -i cam -d MYRIAD -m /home/pi/app/face-detection-adas-0001.xml

andrewchyn
Novice
193 Views

Thanks for your help so far, sorry for the staggered response time, our time zones are likely far apart.

 

I wasn't able to follow your exact instructions, I couldn't find the "interactive_face_detection_demo" in python, so I followed with my own.

 

I added `on_reboot.sh` to my /home/pi/app folder with contents:

 

#!/bin/bash source /opt/intel/openvino/bin/setupvars.sh /usr/bin/python3 /home/pi/app/run.py  

and changed the permissions with

chmod u+x on_reboot.sh

then created the service file under /etc/systemd/system with the content you posted.

 

When running :

sudo systemctl enable openvino-benchmark-app.service

and rebooting, the status initially showed:

 

Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

 

which I was able to fix by installing the 'at-spi2-core' package.

 

Currently, when rebooting and checking the status, I see:

 

  systemd[1]: on_reboot.service: Failed with result 'exit-code'. systemd[1]: on_reboot.service: Service RestartSec=100ms expired, scheduling restart systemd[1]: on_reboot.service: Scheduled restart job, restart counter is at 5 systemd[1]: Stopped Initialize OpenVINO environment and run python script systemd[1]: on_reboot.service: Start request repeated too quickly. systemd[1]: on_reboot.service: Failed with result 'exit-code'. systemd[1]: Failed to start Initialize OpenVINO environment and run python script

 I'll update this if I make any progress.

 

 

MAURICIOAL_R_Intel
Moderator
193 Views

Thank you for your response.

 

Could you please test the service when the Pi boots and GUI interface is up, following the next steps:

 

  1. Open Terminal
  2. sudo systemctl start openvino-benchmark-app.service
  3. sudo systemctl status openvino-benchmark-app.service

 

Regards,

Mauricio R.

andrewchyn
Novice
193 Views

Thanks for all the help, I was able to get the system service working this time, although I'm not sure what exactly I did differently.

 

These are the steps I took on Buster in case anyone has the same issues:

 

  1. Created script that initializes OpenVINO and launches my script using:
nano ~/openvino-app-script

 

with contents:

#!/bin/bash source /opt/intel/openvino/bin/setupvars.sh /usr/bin/python3 /path/to/script/run.py

2. Changed bash script permissions and ownership:

chmod u+x ~/openvino-app-script

3. Created service file using:

sudo nano /etc/systemd/system/openvino-app.service

with contents:

[Unit] Description=OpenVINO Python Script After=network.target   [Service] Environment="DISPLAY=:0" Environment="XAUTHORITY=/home/pi/.Xauthority" ExecStart=/home/pi/openvino-app-script WorkingDirectory=/home/pi StandardOutput=inherit StandardError=inherit Restart=on-failure User=pi   [Install] WantedBy=graphical.target

6. Then lastly activated the service with:

sudo systemctl enable openvino-app.service

Works perfectly with a stream from a USB webcam, no issues with the NCS not being detected.

MAURICIOAL_R_Intel
Moderator
193 Views

I'm glad that you were able to get the system service working. Thank you for sharing the steps you did.

 

Regards,

Mauricio R.

Reply