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

OAK-D not found #36

Open
kurisutofu opened this issue Jan 11, 2021 · 11 comments
Open

OAK-D not found #36

kurisutofu opened this issue Jan 11, 2021 · 11 comments

Comments

@kurisutofu
Copy link

kurisutofu commented Jan 11, 2021

I installed the requirements and plugged the OAK-D depthAI camera.
When running main.py with parameter -cam, I get the message below:

Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 104, in __init__
    self.start_pipeline()
  File "main.py", line 176, in start_pipeline
    self.device = depthai.Device()
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

The depthAi_demo script from Luxonis works fine with the camera.

[Update]
In fact, the depathAi demo worked fine before I installed the requirements for the gaze detection.
Now, it was broken due to a version conflict and I re-installed the depthAI requirements for the demo.

Now the demo works fine but I get a different error for the gaze detection:

Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 103, in __init__
    self.create_pipeline()
  File "main.py", line 108, in create_pipeline
    self.pipeline = depthai.Pipeline()
TypeError: depthai.Pipeline: No constructor defined!

What do I need to do to resolve this?

@themarpe
Copy link
Contributor

Hi @kurisutofu .
We currently have 2 incompatible depthai versions. Gen1 and upcoming gen2 (which will be versioned as > 0.5)
I suggest using virtual environment in case of trying out depthai-demo and old vs new (gen2) examples.

As for the error, it seems like you are running an older (gen1) depthai library. Can you try installing the requirements as specified in gaze-estimation

python3 -m pip install -r requirements.txt

@drojf
Copy link

drojf commented Jan 14, 2021

So, I was initially not using a virtual environment, and originally had the v0.4.0.0 installed to run the depthai_demp.py, and got the same issue "X_LINK_DEVICE_NOT_FOUND" even after installing the requirements.txt.

I don't understand how, but I managed to get it working after switching between versions by editing the requirements.txt, then
switching back to the same version that was originally listed in the requirements.txt (see below log). I did the following:

  • originally had 0.4.0.0 installed to run the depthai_demp.py (got by running install_requirements.py in the main repo). (this isn't recorded in the log)
  • installed 0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a (this isn't recorded in the log)
  • installed 0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a (start of log)
  • installed 0.0.2.1+57205e4dad905895090ef51237deea0905390e66
  • installed 0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
  • installed 0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a again, which "fixed" it (end of log)

I also tried it in a virtual environment just now and that seems to work just fine, but I'm not sure if accidentally "fixed" something earlier when I was messing around, rather than the virtual environment fixing it.

I'm on Windows 10, and just cloned the repo today.

Click to show log
Microsoft Windows [Version 10.0.19041.685]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python -m pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Ignoring opencv-python: markers 'platform_machine == "armv7l"' don't match your environment
Collecting depthai==0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a
  Downloading https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/depthai/depthai-0.0.2.1%2Bb9918c481abaaeac51dd1d2b80fe6a150612f90a-cp38-cp38-win_amd64.whl (4.1 MB)
     |████████████████████████████████| 4.1 MB 6.4 MB/s
Collecting opencv-python==4.2.0.34
  Using cached opencv_python-4.2.0.34-cp38-cp38-win_amd64.whl (33.1 MB)
Requirement already satisfied: numpy>=1.17.3 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from opencv-python==4.2.0.34->-r requirements.txt (line 1)) (1.19.3)
Installing collected packages: opencv-python, depthai
  Attempting uninstall: opencv-python
    Found existing installation: opencv-python 4.4.0.46
    Uninstalling opencv-python-4.4.0.46:
      Successfully uninstalled opencv-python-4.4.0.46
  Attempting uninstall: depthai
    Found existing installation: depthai 0.4.0.0
    Uninstalling depthai-0.4.0.0:
      Successfully uninstalled depthai-0.4.0.0
Successfully installed depthai-0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a opencv-python-4.2.0.34

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py
Traceback (most recent call last):
  File "main.py", line 20, in <module>
    raise ValueError("Missing inference source! Either use \"-cam\" to run on DepthAI camera or \"-vid <path>\" to run on video file")
ValueError: Missing inference source! Either use "-cam" to run on DepthAI camera or "-vid <path>" to run on video file

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py -cam
Loading pipeline...
Creating pipeline...
Creating Color Camera...
Creating Face Detection Neural Network...
Creating Landmarks Detection Neural Network...
Creating Head Pose Neural Network...
Creating Gaze Estimation Neural Network...
Pipeline created.
Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 104, in __init__
    self.start_pipeline()
  File "main.py", line 176, in start_pipeline
    self.device = depthai.Device(self.pipeline)
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python -m pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Ignoring opencv-python: markers 'platform_machine == "armv7l"' don't match your environment
Requirement already satisfied: opencv-python==4.2.0.34 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 1)) (4.2.0.34)
Collecting depthai==0.0.2.1+57205e4dad905895090ef51237deea0905390e66
  Downloading https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/depthai/depthai-0.0.2.1%2B57205e4dad905895090ef51237deea0905390e66-cp38-cp38-win_amd64.whl (4.1 MB)
     |████████████████████████████████| 4.1 MB 6.8 MB/s
Requirement already satisfied: numpy>=1.17.3 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from opencv-python==4.2.0.34->-r requirements.txt (line 1)) (1.19.3)
Installing collected packages: depthai
  Attempting uninstall: depthai
    Found existing installation: depthai 0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a
    Uninstalling depthai-0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a:
      Successfully uninstalled depthai-0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a
Successfully installed depthai-0.0.2.1+57205e4dad905895090ef51237deea0905390e66

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py -cam
Loading pipeline...
Creating pipeline...
Creating Color Camera...
Creating Face Detection Neural Network...
Creating Landmarks Detection Neural Network...
Creating Head Pose Neural Network...
Creating Gaze Estimation Neural Network...
Pipeline created.
Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 104, in __init__
    self.start_pipeline()
  File "main.py", line 176, in start_pipeline
    self.device = depthai.Device(self.pipeline)
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python -m pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Ignoring opencv-python: markers 'platform_machine == "armv7l"' don't match your environment
Requirement already satisfied: opencv-python==4.2.0.34 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 1)) (4.2.0.34)
Collecting depthai==0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
  Downloading https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/depthai/depthai-0.0.2.1%2B6974a181509ca15bfb4fbb57bffbdecf87ff2448-cp38-cp38-win_amd64.whl (3.4 MB)
     |████████████████████████████████| 3.4 MB 6.4 MB/s
Requirement already satisfied: numpy>=1.17.3 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from opencv-python==4.2.0.34->-r requirements.txt (line 1)) (1.19.3)
Installing collected packages: depthai
  Attempting uninstall: depthai
    Found existing installation: depthai 0.0.2.1+57205e4dad905895090ef51237deea0905390e66
    Uninstalling depthai-0.0.2.1+57205e4dad905895090ef51237deea0905390e66:
      Successfully uninstalled depthai-0.0.2.1+57205e4dad905895090ef51237deea0905390e66
Successfully installed depthai-0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py -cam
Loading pipeline...
Creating pipeline...
Creating Color Camera...
Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 103, in __init__
    self.create_pipeline()
  File "main.py", line 117, in create_pipeline
    cam.setBoardSocket(depthai.CameraBoardSocket.RGB)
AttributeError: 'depthai.ColorCamera' object has no attribute 'setBoardSocket'

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py -cam
Loading pipeline...
Creating pipeline...
Creating Color Camera...
Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 103, in __init__
    self.create_pipeline()
  File "main.py", line 117, in create_pipeline
    cam.setBoardSocket(depthai.CameraBoardSocket.RGB)
AttributeError: 'depthai.ColorCamera' object has no attribute 'setBoardSocket'

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py
Traceback (most recent call last):
  File "main.py", line 20, in <module>
    raise ValueError("Missing inference source! Either use \"-cam\" to run on DepthAI camera or \"-vid <path>\" to run on video file")
ValueError: Missing inference source! Either use "-cam" to run on DepthAI camera or "-vid <path>" to run on video file

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python -m pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Ignoring opencv-python: markers 'platform_machine == "armv7l"' don't match your environment
Requirement already satisfied: opencv-python==4.2.0.34 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 1)) (4.2.0.34)
Collecting depthai==0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a
  Using cached https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/depthai/depthai-0.0.2.1%2Bb9918c481abaaeac51dd1d2b80fe6a150612f90a-cp38-cp38-win_amd64.whl (4.1 MB)
Requirement already satisfied: numpy>=1.17.3 in c:\users\drojf\appdata\local\programs\python\python38\lib\site-packages (from opencv-python==4.2.0.34->-r requirements.txt (line 1)) (1.19.3)
Installing collected packages: depthai
  Attempting uninstall: depthai
    Found existing installation: depthai 0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
    Uninstalling depthai-0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448:
      Successfully uninstalled depthai-0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
Successfully installed depthai-0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py
Traceback (most recent call last):
  File "main.py", line 20, in <module>
    raise ValueError("Missing inference source! Either use \"-cam\" to run on DepthAI camera or \"-vid <path>\" to run on video file")
ValueError: Missing inference source! Either use "-cam" to run on DepthAI camera or "-vid <path>" to run on video file

C:\drojf\large_projects\depthai-experiments\gaze-estimation>python main.py -cam
Loading pipeline...
Creating pipeline...
Creating Color Camera...
Creating Face Detection Neural Network...
Creating Landmarks Detection Neural Network...
Creating Head Pose Neural Network...
Creating Gaze Estimation Neural Network...
Pipeline created.
Starting pipeline...
[ 0.32177734  0.17346191 -0.76708984]
[ 0.22729492  0.20056152 -0.78369141]
[ 0.31567383  0.19384766 -0.7578125 ]
[ 0.30859375  0.17712402 -0.76904297]
[ 0.32348633  0.1986084  -0.75585938]
[ 0.17919922  0.20678711 -0.79394531]
[ 0.33325195  0.20251465 -0.74902344]
[ 0.31176758  0.18896484 -0.76611328]
[-0.19824219  0.18884277 -0.765625  ]
[ 0.35986328  0.16918945 -0.74951172]
[ 0.53417969  0.25708008 -0.66992188]
[ 0.51660156  0.22888184 -0.71240234]
[ 0.17724609  0.13964844 -0.76220703]
[ 0.14807129  0.11236572 -0.78857422]
[ 0.16955566  0.14672852 -0.76757812]
[ 0.18383789  0.15661621 -0.76806641]
[ 0.21948242  0.13146973 -0.77148438]
[ 0.23303223  0.15686035 -0.75341797]
[ 0.27978516  0.1550293  -0.75048828]
[ 0.30688477  0.17773438 -0.73925781]
[ 0.2442627   0.15258789 -0.78320312]
[ 0.36425781  0.19262695 -0.72998047]
[ 0.35302734  0.1706543  -0.74316406]
[ 0.32836914  0.1673584  -0.75292969]
[ 0.33325195  0.1895752  -0.74121094]
[ 0.36108398  0.24731445 -0.70410156]
[ 0.2442627   0.23608398 -0.75146484]
[ 0.26733398  0.1940918  -0.75927734]
[ 0.42578125  0.19616699 -0.70361328]
[ 0.42724609  0.18994141 -0.70361328]
[ 0.27368164  0.21777344 -0.75097656]
[ 0.35717773  0.16137695 -0.74658203]
[ 0.16296387  0.22290039 -0.78369141]
[ 0.34765625  0.22338867 -0.72949219]
[ 0.16638184  0.24047852 -0.7734375 ]
[ 0.29541016  0.23620605 -0.73144531]
[ 0.33129883  0.17785645 -0.75830078]
[ 0.30419922  0.2244873  -0.74365234]
[ 0.32714844  0.22192383 -0.73486328]
[ 0.30786133  0.17028809 -0.77246094]
[ 0.25146484  0.20751953 -0.76074219]
[ 0.21520996  0.20446777 -0.77587891]
[ 0.31469727  0.17651367 -0.77050781]
[ 0.3581543   0.20166016 -0.73925781]
[ 0.3137207   0.24682617 -0.72998047]
[ 0.17871094  0.22033691 -0.78027344]
[ 0.1541748   0.2166748  -0.78613281]
[ 0.13549805  0.22253418 -0.78710938]
[ 0.25073242  0.21691895 -0.75244141]
[ 0.26074219  0.22265625 -0.75634766]
[ 0.24597168  0.22338867 -0.76220703]
[ 0.30664062  0.17614746 -0.77197266]
[ 0.21911621  0.17150879 -0.79248047]
[ 0.35424805  0.20422363 -0.73974609]
[ 0.26806641  0.22851562 -0.73339844]
[ 0.22351074  0.2512207  -0.75537109]
[ 0.39819336  0.17724609 -0.73388672]
[ 0.15759277  0.19836426 -0.80078125]
[ 0.21728516  0.234375   -0.76757812]
[ 0.3503418   0.18164062 -0.76220703]
[ 0.36303711  0.21203613 -0.72021484]
[ 0.38500977  0.24291992 -0.70556641]
Traceback (most recent call last):
  File "main.py", line 327, in <module>
    Main(camera=args.camera).run()
  File "main.py", line 319, in run
    self.run_camera()
  File "main.py", line 310, in run_camera
    self.parse()
  File "main.py", line 288, in parse
    if cv2.waitKey(1) == ord('q'):
KeyboardInterrupt

C:\drojf\large_projects\depthai-experiments\gaze-estimation>

@Luxonis-Brandon
Copy link
Contributor

Thanks for the update @drojf . Very curious.

@kurisutofu
Copy link
Author

Hi @kurisutofu .
We currently have 2 incompatible depthai versions. Gen1 and upcoming gen2 (which will be versioned as > 0.5)
I suggest using virtual environment in case of trying out depthai-demo and old vs new (gen2) examples.

As for the error, it seems like you are running an older (gen1) depthai library. Can you try installing the requirements as specified in gaze-estimation

python3 -m pip install -r requirements.txt

I had tried already installing the requirement but I was in the same virtual environment as the dephAi demo.
I will try again and will update.

@kurisutofu
Copy link
Author

kurisutofu commented Jan 16, 2021

I forgot to mention I'm running the scripts on the rapsberry pi 4.

I tried again and I got the same error, even in a separate virtual environment.
I compared the requirement file with what @drojf had and I had an older depthai version so I tried the same but it didn't work.
Same error.

However, after checking git, I saw I was not using the latest files anymore so did a pull and installed the requirements again.
Here are the logs:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
Ignoring opencv-python: markers 'platform_machine != "armv7l"' don't match your environment
Requirement already satisfied: opencv-python==4.1.0.25 in /home/pi/Documents/scripts/gaze/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (4.1.0.25)
Collecting depthai==0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a
  Using cached https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/depthai/depthai-0.0.2.1%2Bb9918c481abaaeac51dd1d2b80fe6a150612f90a-cp37-cp37m-linux_armv7l.whl (5.4 MB)
Requirement already satisfied: numpy>=1.16.2 in /home/pi/Documents/scripts/gaze/lib/python3.7/site-packages (from opencv-python==4.1.0.25->-r requirements.txt (line 2)) (1.19.5)
Installing collected packages: depthai
  Attempting uninstall: depthai
    Found existing installation: depthai 0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
    Uninstalling depthai-0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448:
      Successfully uninstalled depthai-0.0.2.1+6974a181509ca15bfb4fbb57bffbdecf87ff2448
Successfully installed depthai-0.0.2.1+b9918c481abaaeac51dd1d2b80fe6a150612f90a

After trying again, this time, I get the following:

Loading pipeline...
Creating pipeline...
Creating Face Detection Neural Network...
Creating Landmarks Detection Neural Network...
Creating Head Pose Neural Network...
Creating Gaze Estimation Neural Network...
Pipeline created.
terminate called without an active exception
Aborted

Any idea what I could do?

@Luxonis-Brandon
Copy link
Contributor

Sorry about the delay here. Will pull @VanDavv in for help, as he wrote this example.

@VanDavv
Copy link
Contributor

VanDavv commented Jan 19, 2021

Hi @kurisutofu
I replaced Gen2 library versions in there examples to use the same one (related PR)
Tested on new virtualenvs both on Manjaro (PC), Ubuntu (PC) and Raspberry OS (RPi 3B+) and they all work - could you try the failing examples again?

And before installing dependencies in your environment, could you run there commands first

python3 -m pip uninstall -y depthai
python3 -m pip install -U pip

And then install requirements using

python3 -m pip install -r requirements.txt

@kurisutofu
Copy link
Author

Hi @VanDavv ,

Thanks for your help.
I uninstalled as you said, then I did a pull and installed again.

This worked, thank you!

However, it's very slow on the raspberry pi 4.
What's your experience with it? Was it really slow for you too?

I'm talking really slow. Very sluggish and a few seconds delay.
I can look at the camera, wait, then look at my pc and I see in the video my head sluggishly moving to look at the camera so I'd say there is a 3-5s delay and the video in between is very sluggish.

@VanDavv
Copy link
Contributor

VanDavv commented Jan 21, 2021

@kurisutofu yes, this is the first example we had of gen2 actually running, so it lacks optimizations we developed when working with new experiments.
It will be updated soon, and probably will need adjustments also in the future, since our API will constantly be upgraded.
Just recently, I've updated the predestrian reid example (#34), and we're trying to keep our gen2 examples (here) updated, so if you're looking for more optimized code examples, feel free to check these links

@kurisutofu
Copy link
Author

@VanDavv ,

Thanks for your reply.
I will check those optimizations but I'm still wrapping my head around how this all works so I feel that you'll have optimized it before I fully understand how this works ;)

@yoich yoich mentioned this issue Jan 27, 2021
@nxdefiant
Copy link

In my case I was running depthai inside docker. Looks like udev support for libusb needs to be disabled in this case with ./configure --disable-udev as done in the luxonis Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants