another error: (depthai-env) ali@luxonis:~/depthai/depthai-experiments/gen2-emotion-recognition $ python3 main.py
[2024-09-17 15:39:01] INFO [root.exit:328] Closing OAK camera
another error: (depthai-env) ali@luxonis:~/depthai/depthai-experiments/gen2-emotion-recognition $ python3 main.py
[2024-09-17 15:39:01] INFO [root.exit:328] Closing OAK camera
Hi Ali ! Please make sure that you are using the original USB type -C cable from the luxonis… You may plug out the camera from the Pi and the reconnect it and run the Programme it might help as well…
Awab_Younas
And make sure OAK device has enough power.
I'm using the original cable that came with it. It was my hunch that it may be a power issue as well. I bought a powered USB hub but might need to fiddle with how it's arranged a bit more. Hopefully that does the trick. Thanks everyone.
Alright, so update. I bought a Y-Splitter and that seems to have done the trick. I managed to run gen2-age-gender and gen2-emotion-recognition (separately) via depthai-experiments. Yay!
My question, and any help is appreciated, is what is the easiest way to run a simple object detection model?
I've trained the model on Ultralytics and have also managed to upload a copy to Roboflow.
The model works on the Ultralytics app (on my phone) and also works for still images on the Roboflow website.
AliChoudhry
Run it with YoloDetectionNetwork node. For yolov8; example.
For conversion:
https://docs.luxonis.com/software/ai-inference/integrations/yolo/
Thanks,
Jaka
So I got an error for a stereo camera component. I thought I could make spatial=False in main.py and then just rerun main.py but it then just kills itself?
(depthai-env) ali@luxonis:~/depthai/depthai-experiments/gen2-yolo/device-decoding $ python3 main.py --config model/Ali3.json
config: model/Ali3.json
[2024-10-06 10:42:03] INFO [root.__exit__:328] Closing OAK camera
Traceback (most recent call last):
File "/home/ali/depthai/depthai-experiments/gen2-yolo/device-decoding/main.py", line 10, in <module>
color = oak.create_camera('color')
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/oak_camera.py", line 133, in create_camera
comp = CameraComponent(self._oak.device,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/components/camera_component.py", line 142, in __init__
res = getClosesResolution(sensor, sensor_type, width=1300)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/components/camera_helper.py", line 197, in getClosesResolution
for (res, size) in resolutions:
^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
And this is the code that came with main.py in gen2-yolo device decoding:
from depthai_sdk import OakCamera, ArgsParser
import argparse
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("-conf", "--config", help="Trained YOLO json config path", default='model/yolo.json', type=str)
args = ArgsParser.parseArgs(parser)
with OakCamera(args=args) as oak:
color = oak.create_camera('color')
nn = oak.create_nn(args['config'], color, nn_type='yolo', spatial=True)
oak.visualize(nn, fps=True, scale=2/3)
oak.visualize(nn.out.passthrough, fps=True)
oak.start(blocking=True)
So that would look like this?
from depthai_sdk import OakCamera, ArgsParser
import argparse
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("-conf", "--config", help="Trained YOLO json config path", default='model/yolo.json', type=str)
args = ArgsParser.parseArgs(parser)
with OakCamera(args=args) as oak:
color = oak.create_camera('color', resolution=(640, 480))
nn = oak.create_nn(args['config'], color, nn_type='yolo', spatial=True)
oak.visualize(nn, fps=True, scale=2/3)
oak.visualize(nn.out.passthrough, fps=True)
oak.start(blocking=True)
AliChoudhry
Yep. Make sure version is 1.15 and spatial=False
since you are using oak-1
Thanks,
Jaka
How do I change the version?
(depthai-env) ali@luxonis:~/depthai/depthai-experiments/gen2-yolo/device-decoding $ python main.py
config: model/yolo.json
Traceback (most recent call last):
File "/home/ali/depthai/depthai-experiments/gen2-yolo/device-decoding/main.py", line 11, in <module>
nn = oak.create_nn(args['config'], color, nn_type='yolo', spatial=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/oak_camera.py", line 323, in create_nn
comp = NNComponent(self.device,
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/components/nn_component.py", line 108, in __init__
self._parse_model(model)
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/components/nn_component.py", line 240, in _parse_model
self._parse_config(model)
File "/home/ali/depthai/depthai-env/lib/python3.11/site-packages/depthai_sdk/components/nn_component.py", line 286, in _parse_config
with model_config.open() as f:
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/pathlib.py", line 1045, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'model/yolo.json'
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
AliChoudhry
pip install depthai_sdk==1.15