Skip to content

ID Switching Issues in ByteTrack with YOLOv8 #434

Open
@durgasaranyu

Description

@durgasaranyu

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

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions