Skip to content

ObjectTracker: expose tracking paramters; add force remove functionality#1109

Merged
SzabolcsGergely merged 5 commits intodevelopfrom
object_tracker_improvements
May 9, 2025
Merged

ObjectTracker: expose tracking paramters; add force remove functionality#1109
SzabolcsGergely merged 5 commits intodevelopfrom
object_tracker_improvements

Conversation

@SzabolcsGergely
Copy link
Contributor

@SzabolcsGergely SzabolcsGergely commented May 6, 2025

Updated object_tracker.py to reflect new functionality and API usage:

objectTracker.setOcclusionRatioThreshold(0.4)
objectTracker.setTrackletMaxLifespan(120)
objectTracker.setTrackletBirthThreshold(3)
config = dai.ObjectTrackerConfig()
config.forceRemoveID(idToRemove)
trackerConfigQueue.send(config)

Purpose

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

None / not applicable

@SzabolcsGergely SzabolcsGergely requested review from Copilot and moratom May 6, 2025 18:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the object tracking functionality by adding new properties and setter methods to better configure tracking behavior.

  • Introduces new bindings for occlusion ratio threshold, tracklet max lifespan, and tracklet birth threshold.
  • Adds a new object tracker configuration binding and updates the Python example to use a tracker configuration input node.

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

File Description
src/pipeline/node/ObjectTrackerBindings.cpp Adds new property and setter bindings; however, there is a duplicate binding for "trackingPerClass".
src/pipeline/datatype/ObjectTrackerConfigBindings.cpp Introduces bindings for the object tracker configuration.
src/DatatypeBindings.cpp Registers the new object tracker configuration binding to the callstack.
examples/ObjectTracker/object_tracker.py Updates the example pipeline to include tracker configuration parameters and handling.
Files not reviewed (2)
  • CMakeLists.txt: Language not supported
  • depthai-core: Language not supported

.def_readwrite("trackerIdAssignmentPolicy", &ObjectTrackerProperties::trackerIdAssignmentPolicy, DOC(dai, ObjectTrackerProperties, trackerIdAssignmentPolicy))
.def_readwrite("trackingPerClass", &ObjectTrackerProperties::trackingPerClass, DOC(dai, ObjectTrackerProperties, trackingPerClass))
.def_readwrite("occlusionRatioThreshold", &ObjectTrackerProperties::occlusionRatioThreshold, DOC(dai, ObjectTrackerProperties, occlusionRatioThreshold))
.def_readwrite("trackingPerClass", &ObjectTrackerProperties::trackingPerClass, DOC(dai, ObjectTrackerProperties, trackingPerClass))
Copy link

Copilot AI May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate binding for 'trackingPerClass' detected. Please remove the duplicate line to avoid potential runtime issues or unexpected behavior.

Suggested change
.def_readwrite("trackingPerClass", &ObjectTrackerProperties::trackingPerClass, DOC(dai, ObjectTrackerProperties, trackingPerClass))

Copilot uses AI. Check for mistakes.
@SzabolcsGergely SzabolcsGergely changed the title Object tracker improvements ObjectTracker: expose tracking paramters; add force remove functionality May 6, 2025
cv2.rectangle(frame, (x1, y1), (x2, y2), color, cv2.FONT_HERSHEY_SIMPLEX)

if t.status == dai.Tracklet.TrackingStatus.TRACKED:
latestTrackedIds.append(t.id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason to have that condition here?
The UX seems better without it to me, since I presume you often want to prematurely remove the LOST tracklets.

@SzabolcsGergely SzabolcsGergely merged commit 3f04748 into develop May 9, 2025
@SzabolcsGergely SzabolcsGergely deleted the object_tracker_improvements branch May 9, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants