• DepthAI-v2
  • Gen2-People-Tracker project customization

Hi all, I'm currently working on a project which is basically counting people entering and outgoing people to the room, I used the gen2-deepsort-tracking project and it didn't work as expected problems are low FPS and laggy stream.
So today I used the gen2-people-tracker project which is similar to what I'm trying to make but simpler, so I want to customize it, what I need is I need to find where I can get information on detected objects(people in this case) to draw around them and I need to enter coordinates from Django rest framework so I need to identify where coordinates are located in this project.
If anyone worked on this project or knows about it please help me 🙂 don't hesitate to contact me thanks in advance

email: dombit1999@gmail.com
Fakhrullo

    Hi Fakhrullo
    You can get the coordinates of detected objects by accessing the tracklet.roi attribute of TrackerPacket.

    def cb(packet: TrackerPacket, vis: Visualizer):
            left, right, up, down = pt.calculate_tracklet_movement(packet.daiTracklets)
            if len(packet.daiTracklets.tracklets) > 0:
                print(packet.daiTracklets.tracklets[0].roi.x)
                print(packet.daiTracklets.tracklets[0].roi.y)
                print(packet.daiTracklets.tracklets[0].roi.width)
                print(packet.daiTracklets.tracklets[0].roi.height)

    Hope it helps,
    Jaka

      Hi jakaskerl
      It seems the code you provided is for main.py in that project but I'm not working with that, instead, I'm working main_api.py file Github you can see that in this link, Please can you look through that. I'm new to this kind of projects so any help would be great, thank you so much bro.

        Hi Fakhrullo
        Here is an example on how to do that.

        tracker class --> out == depthai.Tracklets --> tracklets == vector of information (roi and stuff)

        for t in trackletsData:
                    roi = t.roi.denormalize(frame.shape[1], frame.shape[0])
                    x1 = int(roi.topLeft().x)
                    y1 = int(roi.topLeft().y)
                    x2 = int(roi.bottomRight().x)
                    y2 = int(roi.bottomRight().y)

        Hope this helps,
        Jaka

          jakaskerl Hey bro I looked through the code (main_api.py) file and couldn't find the trackletsData nor tracklets itself the project you provided is completely different. Script and main functions are in the same file, but in my case, this is slightly different (this driving me crazy) go here and look through the main_api.py and script.py file. You will see what is going on there and hopefully give me advice 🙂

            Hi Fakhrullo
            Your tracklets are getting sent to the script node (script.py) -here
            You can use node.warn(<string>) to print out the roi from within the script.
            Alternatively, you can link an additional output of trackers to Xlink as well and view them just like you would in the code above.

            Thanks,
            Jaka

              jakaskerl Thank you so much, bro, it helped me a lot. One more question, When working with OAK cameras(OAK-D PoE I'm using) using Luxonis official GitHub projects, does the hardware matter for the performance? or the Camera itself handles all the heavy-duty?

              ⚠️ Another problem popped out I managed to get detected objects' coordinates and draw on them, but it's so laggy and inaccurate and when an object leaves the frame drawing is still there. Is there any solutions?

                Hi Fakhrullo,

                Fakhrullo does the hardware matter for the performance? or the Camera itself handles all the heavy-duty?

                Camera handles the heavy-duty. Anything that refers to nodes is handled on device. The while True: loop is executed on the host --> opencv displaying, prints, additional logic.

                I'm not sure about lagginess, but the frames stays there after the object leaves, because of the setting you have set inside the script node. line

                Hope this helps,
                Jaka