Build with RF-DETR

Build a Ball Tracking App Free with RF-DETR

Find and follow the ball through every frame of a match, even when it is tiny, blurred, or hidden. Label footage, train RF-DETR free, and deploy it as a workflow.

  • No credit card
  • No ML team required
  • Edge, on-prem or API
RF-DETRLive inference
A basketball game between Baylor and Duke with computer vision tracking overlays highlighting players, referees, the court lines, the ball, and the backboard.
Representative result. Basketball tracking on a court.

Build a Ball Tracking App with Roboflow’s Free RF-DETR

In short

A ball tracking app uses computer vision to detect the ball in each frame of sports video and follow it with one consistent ID, so you know where the ball is throughout play. The model to train for it is RF-DETR, Roboflow's open-source real-time detection model, which can find small, fast-moving objects, paired with a tracker such as ByteTrack. With Roboflow you label your footage, train RF-DETR for free, and deploy it as a workflow that returns annotated frames and the ball's tracked position.

How it works

The workflow behind the ball tracking app

Use this Ball Tracking with RF-DETR workflow: each frame goes to an RF-DETR model that finds the ball, then through a low confidence filter to a ByteTrack tracker that keeps one ID on the ball across frames, even when it is briefly hidden. The tracked ball is drawn with its box and ID. Every block is editable in the low-code builder, and the Roboflow Agent can build it from a description.

Ball Tracking with RF-DETR
Returns
  • output_image
  • tracked_ball

How to build a ball tracking app with RF-DETR

  1. Open the workflow and add your footage

    Click "Use this free template" to copy the workflow into your Roboflow workspace. Upload frames from your own matches at the camera angle you will use, including frames where the ball is small, blurred, or close to players.

  2. Label the ball and train RF-DETR

    Use Auto Label to box the ball in each frame, then review and correct the results, paying close attention to motion-blurred frames. Train an RF-DETR model and select it in the detect_ball block, or start with the pretrained soccer model already in the workflow.

  3. Tune detection and tracking

    Adjust the threshold in filter_by_confidence so the ball is found in fast passes without false hits on heads or pitch markings. Raise the lost track buffer in track_ball if the ball is often hidden for longer.

  4. Deploy and run it on your video

    Deploy the workflow as a Serverless Cloud API, or on your own hardware through Inference, to process live streams or recorded matches. Each frame returns output_image and tracked_ball, the ball's position to feed possession stats, highlights, or broadcast graphics.

Roboflow MCP

Build it from your AI assistant with the Roboflow MCP

Connect the Roboflow MCP Server to Claude, Cursor, or any MCP-compatible assistant and build the whole ball tracking app in natural language, without leaving your editor.

Ask an assistant like Codex or ChatGPT to search Roboflow Universe for ball detection datasets, upload and auto-label your match frames, and train an RF-DETR model to find the ball. It can then create and run the ball tracking workflow on test frames and deploy it to your devices.

Paste it into your coding agent and it walks you through the rest. Setting up by hand? The server is https://mcp.roboflow.com/mcp.

Add to Claude (opens in a new tab)

Open the Roboflow listing, select Connect, then sign in to Roboflow. Available on desktop, web and mobile.

Run these commands in your terminal, then sign in to Roboflow. Claude Code CLI has no documented browser install link.

Add to Cursor (opens in a new tab)

Opens the Roboflow plugin listing. Sign in if prompted and confirm the install on Cursor to add MCP and skills.

Add to ChatGPT (opens in a new tab)

Opens the Roboflow plugin listing. Install the plugin and sign in to Roboflow when prompted to connect your account.

Add to Codex (opens in a new tab)

Opens the Roboflow plugin listing shared by ChatGPT and Codex. Install the plugin and sign in to Roboflow when prompted to connect your account.

Then run /mcp auth roboflow in Gemini CLI to sign in. Gemini CLI has no documented browser install link.

What your ball tracking app can do

Trained on your footage, an RF-DETR model handles the specific, hard-to-catch cases that matter in a match:

  • Find the ball when it is only a few pixels wide in wide broadcast shots
  • Keep detecting through motion blur on fast passes and shots
  • Hold the ball's ID when it is briefly hidden behind players
  • Tell the ball apart from heads, shoes, and pitch markings
  • Follow the ball in the air as well as on the ground
  • Adapt to your sport's ball, field, and camera angles
Roboflow agent · free to start

Want to customize your ball tracking app?

Describe the ball tracking app you want in plain English: the sport, the camera view, and what you want to do with the ball's position. The Roboflow Agent finds the data, trains an RF-DETR model, and assembles the workflow for you.

Open source

Roboflow’s RF-DETR is open source, Apache-2.0, and free to use

RF-DETR is an open-source, Apache-2.0 licensed real-time object detection model developed by Roboflow. The rfdetr Python package and most RF-DETR models are free to use, including in commercial products, and you can train and run everything on your own hardware. No account or lock-in required.

  • Apache-2.0 and free

    The rfdetr package, Nano to Large detection, every segmentation size and Keypoint are Apache-2.0 licensed and free to use, including commercially.

  • Install and train locally

    pip install rfdetr on Python 3.10+. Fine-tune on your own data in a few lines and run it entirely on your machine.

  • State of the art on COCO

    RF-DETR is a real-time detector that is SOTA on COCO. RF-DETR-Large reaches 56.5 AP at 6.8 ms on an NVIDIA T4, and uses a DINOv2 backbone.

  • Deploy anywhere

    Export to ONNX or TensorRT and run on GPU, CPU, or NVIDIA Jetson at the edge, or serve it through the Roboflow hosted API.

RF-DETR licence by model size
ModelsLicence
Detection: Nano, Small, Medium, LargeApache-2.0
Segmentation: every size, Nano to 2XLargeApache-2.0
Keypoint (preview)Apache-2.0
Detection: Atto, Femto, Pico, XL, 2XL (rfdetr[plus])PML 1.0: commercial use included on Roboflow; commercial self-hosting needs the Enterprise add-on

RF-DETR vs. other free detectors

A ball tracking app has to find a small, fast-moving ball on every frame, quickly enough to keep up with live play. Here is how RF-DETR, fine-tuned on your own match footage, compares for real-time ball tracking.

RF-DETR vs. other free detectors
ModelTasksBest forLicense
RF-DETRDetection, segmentation (keypoints in preview)Real-time detection you fine-tune on your own data, one model across tasksApache-2.0 (Nano to Large, all segmentation); PML 1.0 (Atto, Femto, Pico, XL, 2XL)
D-FINEDetectionPrecision localization when you do not need to fine-tuneApache-2.0
YOLODetection, segmentation, poseFast CNN-based detection with a large ecosystemAGPL-3.0 (commercial license required for closed-source use)
GroundingDINOOpen-vocabulary detectionFinding objects by text prompt with no training, not real-timeApache-2.0
SAM 2 / SAM 3SegmentationPixel-precise masks; SAM 3 adds text-prompted segmentationApache-2.0 (SAM 2), SAM License (SAM 3)
Florence-2Vision-languageReading, captioning, and OCR on imagesMIT

The takeaway for this app: RF-DETR runs in real time, so it keeps pace with live video and gives the tracker a clean ball detection on every frame. It fine-tunes well on small custom datasets and is open source, so you can adapt it to your sport and run it wherever your video is.

Build your ball tracking app free today

Label, train, and deploy your ball tracking app in one place.