@filipjeretina

(venv) C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-tracker>python3 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 10, in <module>

with dai.OakCamera(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as oak:

AttributeError: module 'depthai' has no attribute 'OakCamera'

(venv) C:\Users\sale4088\AppData\Local\Programs\Depthai2\depthai-viewer\scripts\depthai-experiments\gen2-people-trackerpython3 main.py

C:\Users\sale4088\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\depthai_sdk\oak_camera.py:219: UsbWarning: Device connected in USB2 mode! This might cause some issues. In such case, please try using a (different) USB3 cable, or force USB2 mode 'with OakCamera(usbSpeed=depthai.UsbSpeed.HIGH)'

warnings.warn("Device connected in USB2 mode! This might cause some issues. "

Closing OAK camera

[18443010F141790E00] [1.7] [1723829068.552] [host] [warning] Device crashed, but no crash dump could be extracted.

    @filipjeretina

    Above I attached the errors and issues that are displayed to me after the system crashes

    How can I fix the code with the error messages

    You mentioned many people have helped you to make this work before? Can you go back to the previous answers and put something together? You did it once, so you can do it again

    @filipjeretina

    I can't, those people are not around me and won't be around me for some time.

    Those people are also not experts with the system that I am using, but you are and I am hoping that it should not be a difficult issue.

    I am not a computer scientist and I have never had formal training as one

    These issues took a while to figure out and I do not have the paper work or documentation since they were all in the same files that were deleted when I tried to install the codes you sent

    Can you help me?

    @filipjeretina

    I sent you the code as well as the error messages

    Are you able to figure out why?

    It seems to be because it is going through a USB2? But I do not know how to place the code properly so it can run on that.

    @filipjeretina

    The code just needs to display, I do not care if the video file saves

    The code just needs to open the display and have it run so it does not crash and so it runs through my computer

    Please help me

    @filipjeretina

    The full code and the full error messages are sent above

    Can you please help or forward me to someone on your team who can help.

    This is urgent

    Does this work:

    #!/usr/bin/env python3
    
    from depthai_sdk import OakCamera, TrackerPacket, Visualizer, TextPosition
    import depthai as dai
    from people_tracker import PeopleTracker
    import cv2
    
    pt = PeopleTracker()
    
    with OakCamera(replay='people-tracking-above-03') 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)

    @filipjeretina

    #!/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)

    @filipjeretina

    The script that I ran is the script that you sent, But I removed the replay feature from the oakcamera(replay=…) because that would only replay a video that was from the github.

    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:

    @filipjeretina

    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

    @filipjeretina

    (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

    @filipjeretina

    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.

    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:

    michaelsalerno

    Maybe you can try to lower the fps on the camera:

    color_cam = oak.create_camera('color', fps=10)

    @filipjeretina

    (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