Skip to content

fix: unmatched tracks not marked as Lost when dets_second is empty#2

Open
luigivicidomini wants to merge 1 commit intoGeekgineer:mainfrom
luigivicidomini:fix/bytetrack-lost-state
Open

fix: unmatched tracks not marked as Lost when dets_second is empty#2
luigivicidomini wants to merge 1 commit intoGeekgineer:mainfrom
luigivicidomini:fix/bytetrack-lost-state

Conversation

@luigivicidomini
Copy link

Description

In ByteTrack::update, the entire second association stage was wrapped in a single if (!detections_second.empty() && ...) block. When there are no low-confidence detections around (which is pretty common), the whole block gets skipped — including the part responsible for marking unmatched tracks as Lost. Those tracks would just sit there with Tracked state and never go away, effectively becoming ghost tracks.

u_track2 is now initialized with all indices of r_tracked_stracks_ptrs before the if block, and the mark_lost loop has been moved outside of it so it always runs. Also removed u_detection2, which was being computed but never used anywhere.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update
  • Performance improvement

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Testing

Tested manually by running the tracker on a video sequence where a person leaves the frame. Before the fix, the track would persist indefinitely in active_tracks_ after the person disappeared. After the fix, the track is correctly marked as Lost and eventually removed.

Screenshots (if applicable)

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.

1 participant