Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ID Switching Issues in ByteTrack with YOLOv8 #20

Open
durgasaranyu opened this issue Jan 9, 2025 · 0 comments
Open

ID Switching Issues in ByteTrack with YOLOv8 #20

durgasaranyu opened this issue Jan 9, 2025 · 0 comments

Comments

@durgasaranyu
Copy link

I've been using ByteTrack tracker with YOLOv8 for object tracking and have encountered the below ID-switching issues

ID Reassignment for overlapping objects:
When one object appears in place of another (occlusion or overlapping), the ID of the first object gets reassigned to the second object, and the first object gets a new ID.
ID Switch when objects pass each other:
IDs get swapped when two objects pass one another.
Current pseudo code for detection + tracking setup:

// initialize the ByteTrack tracker
byte_track::BYTETracker tracker(40, 30);

// preprocess the input frame
cv::Mat preprocessed_frame = preprocess_frame(input_frame);

// run YOLOv8 model for object detection
std::vector<Detections> detections = run_yolov8(preprocessed_frame);

// push the detections to bytetrack objects
std::vector<byte_track::Object> objects;
for (auto &det : detections) {
        // Prepare bounding box and object for tracking
        byte_track::Rect<float> rect(det.x, det.y, det.width, det.height);
        byte_track::Object obj(rect, 0, det.confidence);
        objects.push_back(obj);
}

// update tracker with objects
std::vector<std::shared_ptr<STrack>> tracked_objects = tracker.update(objects);

// Annotate the frame with tracking results
for (const auto &track : tracked_objects) {
    auto rect = track->getRect();
    draw_bounding_box_with_id(input_frame, rect, track->track_id_);
}

// display the annotated frame
return input_frame;`

Tried adjusting the tracker parameters, frame_rate, match_threshold, track_buffer, but did not solve the issue completely.

If anyone has faced similar issues or has any kind of insights into improving the tracking, I'd appreciate your insights.
Thank you.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant