Skip to content

Implementation of custom bytetrack graph [GSoC'26]#131

Open
Vishwa2684 wants to merge 10 commits into
openvinotoolkit:mainfrom
Vishwa2684:custom_bytetrack_graph
Open

Implementation of custom bytetrack graph [GSoC'26]#131
Vishwa2684 wants to merge 10 commits into
openvinotoolkit:mainfrom
Vishwa2684:custom_bytetrack_graph

Conversation

@Vishwa2684
Copy link
Copy Markdown

@Vishwa2684 Vishwa2684 commented Apr 25, 2026

Hello @atobiszei , @dtrawins

This is the implementation of my bytetrack algorithm as stated in my proposal. To fix the issues in my previous approach , I did the following things:

  • Instead of packet resampler, I used flow limiter to handle tracked detections.
  • Unified detection filtering inside bytetrack calculator and removed filter_detections_by_confidence_calculator which was stated in the proposal.
  • Added a calculator to compute specific color based on id.

This is the output video generated by my graph. I'm looking forward to any suggestions to improve my approach and correct any mistakes which are done on my side.

  • Output on example from bytetrack
out_bt_ovms.mp4
  • Output on object detection example from mediapipe
out_bt_ovms_desk.mp4

Regards,
Konkala Vishwa Teja

@Vishwa2684 Vishwa2684 changed the title Implementation of custom bytetrack graph Implementation of custom bytetrack graph [GSoC'26] May 3, 2026
@Vishwa2684
Copy link
Copy Markdown
Author

@atobiszei To test the example in real time, I'm currently using IP Webcam app in my mobile. Which starts a server. And I pass the camera ip address as input_video_path. The real time output is quite laggy

@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch 3 times, most recently from bb74456 to 11cacc4 Compare May 25, 2026 10:12
@Vishwa2684
Copy link
Copy Markdown
Author

@dtrawins Could you please review openvino_yolox_tensors_to_detections_calculator.cc in mediapipe/calculators/openvino & yolox_tensors_to_detections_calculator.cc in mediapipe/calculators/tflite?

@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch 2 times, most recently from bc86735 to b5b4cd4 Compare May 26, 2026 09:02
@atobiszei
Copy link
Copy Markdown
Collaborator

Hi Vishwa, In the attached video you can see that the person in yellow vest, is standing almost still
image
And they are changing the id twice during that video so something is not going well here
image

Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.proto Outdated
Copy link
Copy Markdown

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 adds a MediaPipe-based multi-object tracking demo pipeline built around a custom C++ implementation of the ByteTrack algorithm, with graphs for both TFLite (CPU) and OpenVINO Model Server (OVMS) inference backends and optional visualization utilities.

Changes:

  • Added ByteTrack tracker core (track objects, Kalman filter, association/matching utilities) and a ByteTrackCalculator.
  • Added YOLOX decoding calculators (TFLite + OpenVINO) and example graphs/demos wiring detection → tracking → rendering.
  • Added visualization support (color-by-track-id) plus build/Docker integration for OVMS demo builds.

Reviewed changes

Copilot reviewed 39 out of 40 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
mediapipe/models/BUILD Adds model/label filegroups for the demos.
mediapipe/graphs/bytetrack/test_ovms.pbtxt Minimal OVMS test graph wiring flow limiting, detection, tracking, rendering.
mediapipe/graphs/bytetrack/test_cpu.pbtxt Minimal CPU test graph wiring flow limiting, detection, tracking, rendering.
mediapipe/graphs/bytetrack/subgraphs/renderer_cpu.pbtxt Rendering subgraph (detections → RenderData → overlay).
mediapipe/graphs/bytetrack/subgraphs/object_tracking_cpu.pbtxt Tracking subgraph wrapping ByteTrack usage.
mediapipe/graphs/bytetrack/subgraphs/object_detection_ovms.pbtxt OVMS detection subgraph definition.
mediapipe/graphs/bytetrack/subgraphs/object_detection_cpu.pbtxt CPU (TFLite) detection subgraph definition.
mediapipe/graphs/bytetrack/subgraphs/BUILD Bazel targets to register bytetrack subgraphs.
mediapipe/graphs/bytetrack/calculators/strack.h Adds the per-track state container (STrack).
mediapipe/graphs/bytetrack/calculators/strack.cc Implements STrack prediction/update/activation logic.
mediapipe/graphs/bytetrack/calculators/render_data_passthrough_calculator.cc Debug calculator to log/forward RenderData.
mediapipe/graphs/bytetrack/calculators/matching_utils.h Matching utilities (IoU cost, score fusion, assignment).
mediapipe/graphs/bytetrack/calculators/kalman_matrices.h Kalman model matrices/constants helpers.
mediapipe/graphs/bytetrack/calculators/kalman_filter.h KalmanFilter API for tracker state estimation.
mediapipe/graphs/bytetrack/calculators/kalman_filter.cc KalmanFilter implementation (init/predict/update/multipredict).
mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.proto ByteTrack calculator options proto.
mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.h ByteTrackCalculator interface and state.
mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc Main ByteTrack algorithm calculator implementation.
mediapipe/graphs/bytetrack/calculators/BUILD Bazel build targets for bytetrack calculators/libs.
mediapipe/graphs/bytetrack/calculators/basetrack.h Base track abstraction and track-state enum.
mediapipe/graphs/bytetrack/calculators/basetrack.cc BaseTrack static id counter definition.
mediapipe/graphs/bytetrack/bytetrack_ovms.pbtxt Full OVMS demo graph (YOLOXn via OVMS → ByteTrack → overlay).
mediapipe/graphs/bytetrack/bytetrack_cpu.pbtxt Full CPU demo graph (YOLOX TFLite → ByteTrack → overlay).
mediapipe/graphs/bytetrack/BUILD Bazel targets collecting calculator deps for bytetrack graphs.
mediapipe/examples/desktop/bytetrack/README.md Demo documentation and graph diagrams.
mediapipe/examples/desktop/bytetrack/BUILD Bazel binaries for bytetrack desktop demos.
mediapipe/calculators/util/detection_color_by_id_calculator.proto Options proto for color-by-id visualization.
mediapipe/calculators/util/detection_color_by_id_calculator.cc Calculator producing RenderData with per-id colors and labels.
mediapipe/calculators/util/BUILD Registers the new visualization calculator + proto targets.
mediapipe/calculators/tflite/yolox_tensors_to_detections_calculator.proto Options proto for YOLOX TFLite decode calculator.
mediapipe/calculators/tflite/yolox_tensors_to_detections_calculator.cc YOLOX TFLite output decoding into Detection protos.
mediapipe/calculators/tflite/BUILD Registers YOLOX TFLite decode calculator + proto targets.
mediapipe/calculators/ovms/config.json Adds OVMS model config entry used by bytetrack OVMS demo.
mediapipe/calculators/ovms/BUILD Wires OpenVINO YOLOX decode calculator into OVMS deps.
mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.proto Options proto for YOLOX OpenVINO decode calculator.
mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.cc YOLOX OpenVINO output decoding into Detection protos.
mediapipe/calculators/openvino/BUILD Registers YOLOX OpenVINO decode calculator + proto targets.
Dockerfile.openvino Downloads extra YOLOX assets and stages OVMS model layout in Docker build.
build_desktop_examples.sh Special-cases bytetrack example target selection during build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc
Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc
Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc
Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.cc
Comment thread mediapipe/calculators/util/detection_color_by_id_calculator.cc
Comment thread mediapipe/graphs/bytetrack/subgraphs/object_detection_ovms.pbtxt
Comment thread mediapipe/graphs/bytetrack/subgraphs/object_detection_ovms.pbtxt
Comment thread Dockerfile.openvino Outdated
Comment thread build_desktop_examples.sh
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch 3 times, most recently from 63aca34 to 6fd2a27 Compare May 27, 2026 09:36
@Vishwa2684 Vishwa2684 closed this May 27, 2026
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch from 6fd2a27 to 12e8d51 Compare May 27, 2026 09:41
@Vishwa2684 Vishwa2684 reopened this May 27, 2026
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch from 297de9d to e13fe8a Compare May 27, 2026 10:03
@Vishwa2684 Vishwa2684 requested a review from atobiszei May 27, 2026 10:37
@Vishwa2684
Copy link
Copy Markdown
Author

@atobiszei could you review the following calculators?

  • mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.cc
  • mediapipe/calculators/tflite/yolox_tensors_to_detections_calculator.cc

And I'm using the yolox model from this repo. I've downloaded the nano weights from the model zoo in this repository, then i converted them to ONNX following the model guidelines and then converted the ONNX weights to tflite.

Comment thread Dockerfile.openvino Outdated
Comment on lines +1 to +10
#include <vector>
#include <algorithm>
#include <numeric>
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/location_data.pb.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
#include <cmath>
#include "mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.pb.h"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Follow standard Google C++ Style guide with includes. Eg:

#include "mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.pb.h"

#include
#include
#include
#include

#include <openvino/openvino.hpp>

#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/location_data.pb.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"

Comment thread mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.cc Outdated
Comment thread mediapipe/calculators/openvino/openvino_yolox_tensors_to_detections_calculator.cc Outdated
Comment thread mediapipe/graphs/bytetrack/calculators/bytetrack_calculator.h Outdated
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch from 2aa15b6 to a8ed205 Compare May 29, 2026 08:27
@Vishwa2684 Vishwa2684 requested a review from atobiszei May 29, 2026 08:52
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch from efd6ee2 to b98e792 Compare May 29, 2026 11:11
@Vishwa2684 Vishwa2684 force-pushed the custom_bytetrack_graph branch from b98e792 to 4b28af1 Compare May 29, 2026 11:12
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.

3 participants