@filipjeretina and @jakaskerl

The below code is for a person tracking model that was developed and put out in the depthai experiments code, I had this functioning and was going to be used for not only a field demonstration, but also for research. Now when I try to run this code, It does not function as it did before. There is a 12 second delay in the video feed and then it crashes after I move infront of the camera.

I am using a windows computer and I believe a USB2, can you adjust the code so it functions on my computer?

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

    If you had these files open in a code editor, they might still be cached somewhere, but not sure where, in the stackoverflow question I posted there are instructions for some editors, including vscode

    @filipjeretina

    (venv) C:\Users\sale4088\AppData\Local\Programs\DepthAI\venv\Scripts>git reset --hard

    fatal: not a git repository (or any of the parent directories): .git

    @filipjeretina

    I do not know what I am doing.

    I had these functional and it took a lot of people to help me make this possible

    Now everything is lost because of the codes that you sent me.

    I NEED YOUR HELP TO FIX THIS

    If the code above is fixed than I am able to make it through my field demo and research

    PLEASE HELP ME MAKE THIS CODE FUNCTION

    @filipjeretina

    My field demo is tomorrow,

    I just need the code to stop crashing and to reduce the lag time between the display and the camera

    If that is done than it should be enough for the time to get me through what I need to get through

    @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)