Football Field Keypoint Detection (Roboflow)

YOLOv8 keypoint detection model for identifying field lines and key points on a football/soccer pitch.

Model Details

  • Model ID: football-field-detection-f07vi/14
  • Platform: Roboflow
  • Architecture: YOLOv8 Pose
  • Task: Keypoint detection

Quick Start

Installation

pip install inference-gpu  # or inference for CPU
pip install supervision

Basic Usage

from inference import get_model
import supervision as sv

# Initialize model
api_key = "YOUR_ROBOFLOW_API_KEY"
model = get_model(
    model_id="football-field-detection-f07vi/14",
    api_key=api_key
)

# Run inference
result = model.infer("image.jpg", confidence=0.3)[0]
key_points = sv.KeyPoints.from_inference(result)

print(f"Detected {len(key_points.xy[0])} keypoints")

Using the Wrapper

from field_inference import FootballFieldDetector
import os

detector = FootballFieldDetector(api_key=os.getenv("ROBOFLOW_API_KEY"))
results = detector.predict("image.jpg", confidence=0.3)

Applications

  • Homography Estimation: Map player positions to tactical view
  • Camera Calibration: Align multiple camera views
  • Tactical Analysis: Project player movements on 2D pitch
  • AR Overlays: Augmented reality graphics on field
  • Voronoi Diagrams: Team possession and control analysis

Example: View Transformation

import numpy as np
from sports.common.view import ViewTransformer
from sports.configs.soccer import SoccerPitchConfiguration

# Get field keypoints
result = model.infer(frame, confidence=0.3)[0]
key_points = sv.KeyPoints.from_inference(result)

# Filter confident keypoints
filter = key_points.confidence[0] > 0.5
frame_points = key_points.xy[0][filter]

# Create transformer
config = SoccerPitchConfiguration()
pitch_points = np.array(config.vertices)[filter]

transformer = ViewTransformer(
    source=frame_points,
    target=pitch_points
)

# Transform player positions to pitch coordinates
pitch_xy = transformer.transform_points(player_xy)

API Key

You need a Roboflow API key to use this model. Get one at roboflow.com.

Citation

@misc{football-field-detection,
    title={Football Field Detection},
    author={Roboflow},
    year={2024},
    url={https://universe.roboflow.com/roboflow-jvuqo/football-field-detection-f07vi}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support