stereolabs / zed-ros-wrapper

ROS wrapper for the ZED SDK
https://www.stereolabs.com/docs/ros/
MIT License
441 stars 389 forks source link

Object detection only tracks one object of a class at a time, even when multiple objects are in the view #908

Closed jamesheatonrdm closed 10 months ago

jamesheatonrdm commented 11 months ago

Preliminary Checks

Description

I am attempting to get up to speed with the object detection with the ZED2i camera. I am using the example display which I am launching with roslaunch zed_display_rviz display_zed2i.launch.

Initially, it seemed to be working perfectly, the bounding boxes over the detected objects are displayed and track the object when the camera moves around.

However, I wanted to test this with multiple people in the camera view and it appears to only be able to track one person at a time. When there are two people in the view, only one person appears to be detected. However when the original detected person leaves the scene, and the undetected person stays in the same place they are now able to be detected.

Steps to Reproduce

  1. roslaunch zed_display_rviz display_zed2i.launch
  2. ...

Expected Result

Multiple people within camera view are detected & tracked

Actual Result

Detection and tracking only occurs for one person out of the multiple in the scene.

ZED Camera model

ZED2i

Environment

Ubuntu 20.04
NVIDIA A2000
ZED SDK 4.0
ROS Noetic

Anything else?

No response

Myzhar commented 11 months ago

@jamesheatonrdm is the detection working with ZED examples outside ROS? Did you try to raise the detection confidence value? Can you post pictures showing the problem?

jamesheatonrdm commented 11 months ago

@Myzhar

I have ran the 'tutorial 6 - object detection' python code, and the output to the command line shows that each person in the scene is detected, however I am unsure how to visualise this.

Raising the confidence value has no effect.

jamesheatonrdm commented 11 months ago

@Myzhar I have managed to build and run the concurrent detections sample.

In this case all of the objects are detected even when multiple poeple are within the scene.

Myzhar commented 11 months ago

Are you using the same values for the parameters in the ROS wrapper? confidence, AI model, etc

jamesheatonrdm commented 11 months ago

@Myzhar

I am using whatever the defaults are between the two (I would presume they are the same?!). I have not changed any values in any parts of the code except for changing the od_enabled parameter to true

Myzhar commented 11 months ago

They are not the same. ROS is a thing and has its own parameters: https://github.com/stereolabs/zed-ros-wrapper/blob/master/zed_wrapper/params/common.yaml#L72-L84

jamesheatonrdm commented 11 months ago

@Myzhar

I am familiar with ROS. The Concurrent Detections sample does not appear to have any parameters that I can pass via the command line. Looking at the main.cpp file, I see that object detection model is MULTI_CLASS_BOX_MEDIUM, which doesn't appear to be an option in the common.yaml file for the zed wrapper (options are MULTI_CLASS_BOX or MULTI_CLASS_BOX_ACCURATE)

jamesheatonrdm commented 11 months ago

@Myzhar

It appears that the model MULTI_CLASS_BOX_ACCURATE is available to both programs, so I have set them to both use it. I have confirmed that confidence is the same between the two (50). Range was slightly higher (20 vs 15) in the concurrent detections program, so I have set the ROS wrapper to use the same, however setting all 3 of these to the same values does not have any effect.

Myzhar commented 11 months ago

You are too close to the camera and most of the camera view is desk surface

jamesheatonrdm commented 11 months ago

Screenshot from 2023-08-03 14-21-26

@Myzhar here is another example, this time with 4 people in the view. Only one is detected

jamesheatonrdm commented 11 months ago

You are too close to the camera and most of the camera view is desk surface

But you still see that the detection works when it is just me in the frame? It is clear that the addition of the second person to the frame is when the issue occurs

jamesheatonrdm commented 11 months ago

The issue must be coming from the way these detections are rendered in RVIZ, as when echoing /zed2i/zed_node/obj_det/objects it shows multiple people detected per frame

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days