Try to change this:
with dai.OakCamera(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:
To with dai.Device(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:
Try to change this:
with dai.OakCamera(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:
To with dai.Device(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:
The problem I think is partly due to it being ran through a USB2, I just need the lag time for this to be reduced and for the device to stop crashing.
It seems to crash pretty quickly once a person is in front of the camera
But also, please send the contents of this file:
C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker\main.py
(venv) C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-trackerpython3 main.py
Traceback (most recent call last):
File "C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker\main.py", line 10, in <module>
with dai.Device(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:
NameError: name 'pipeline' is not defined
I have been sending the contents of that file, the folder is the same as the tab in the github, I cloned that github and have been editing from the exact files that are in it.
Can I set it to medium? Would that reduce the stress on the camera and maybe increase the frames?
Okay so this is the file you are running:
#!/usr/bin/env python3
from depthai_sdk import OakCamera, TrackerPacket, Visualizer, TextPositionimport depthai as daifrom people_tracker import PeopleTrackerimport cv2
pt = PeopleTracker()
with OakCamera() as oak: color_cam = oak.create_camera('color') tracker = oak.create_nn('person-detection-retail-0013', color_cam, tracker=True) tracker.config_nn(conf_threshold=0.6) tracker.config_tracker(tracker_type=dai.TrackerType.ZERO_TERM_COLOR_HISTOGRAM, track_labels=[1])
def cb(packet: TrackerPacket, vis: Visualizer): left, right, up, down = pt.calculate_tracklet_movement(packet.daiTracklets)
vis.add_text(f"Up: {up}, Down: {down}", position=TextPosition.TOP_LEFT, size=1) vis.draw(packet.frame)
cv2.imshow('People Tracker', packet.frame)
oak.visualize(tracker.out.tracker, callback=cb) oak.start(blocking=True)
I was just confused with the error you sent here:
Maybe you can try to lower the fps on the camera:
color_cam = oak.create_camera('color', fps=10)
Does this improve your situation?
(venv) C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker>python3 main.p
[18443010F141790E00] [1.7] [1723831363.772] [host] [warning] Device crashed, but no crash dump could be extracted.
Closing OAK camera
Traceback (most recent call last):
File "C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker\main.py", line 25, in <module>
oak.start(blocking=True)
File "C:\Users\sale4088\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\depthai_sdk\oak_camera.py", line 268, in start
self.build() # Build the pipeline
File "C:\Users\sale4088\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\depthai_sdk\oak_camera.py", line 349, in build
self._init_device()
File "C:\Users\sale4088\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\depthai_sdk\oak_camera.py", line 211, in _init_device
self._oak.device = dai.Device(
RuntimeError: Device already closed or disconnected: io error
power cycle the device and try again. this error seems unrelated
I think it is now working
Thank you for all your help
My apologies if I was short tempered, I was extremely nervous for tomorrows meeting and needed everything to be working well.
Thank you again
My apologies if I was short tempered, I was extremely nervous for tomorrows meeting and needed everything to be working well.
hahah, I get it. Really sorry for the inconvenience. But for the future. NEVER work inside of the installers repository.... It is not safe!!! And make backups of things!
Wait, it seems to be not working again
Wait, it seems to be not working again
What is the issue now?
(venv) C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker>python main.p
Traceback (most recent call last):
File "C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker\main.py", line 3, in <module>
from depthai_sdk import OakCamera, TrackerPacket, Visualizer, TextPosition
ModuleNotFoundError: No module named 'depthai_sdk'
I removed the versions since I wanted it to function and not be confined to a certain version, but maybe Ill try adding it back?
This seems like an environment error
Not sure why, but make sure you have depthai_sdk installed.
can install it via python -m pip install depthai_sdk
I removed the versions since I wanted it to function and not be confined to a certain version, but maybe Ill try adding it back?
Yea
I would suggest you to copy the working version to your Desktop and leaving it alone. Maybe also run python -m pip freeze
which will give you a list of all installed packages. And save this somewhere too.