中文
← Back to tutorials

AI Team Tactical Analysis: From Match Video to Heatmaps and Passing Networks (2026)

How do pro teams use AI to dissect opponents? The full technical path from match footage to positional heatmaps, passing networks, and defensive shape

AI Team Tactical Analysis: From Match Video to Heatmaps and Passing Networks

Highlight reels are for fans; tactical analysis is for coaches. Pro teams have long used AI to dissect opponents: does this side attack more down the left or right? Which two players pass between each other most? Where does the back line open gaps under high press? This article follows on from batch one's computer vision watches football, explaining how to turn match video into analyzable tactical data, then into an interactive dashboard.

If you haven't seen the basics of player detection and tracking, read that article first — this one assumes you can already track players from video.

The key leap from "detection box" to "tactical data"

Batch one covered detecting and tracking players with YOLO + ByteTrack, yielding each player's pixel coordinates in each frame. But pixel coordinates can't directly drive tactical analysis — what you need is the player's position on the real pitch.

This step is called homography: establishing a mapping from video-frame coordinates to a top-down pitch coordinate system. The principle is to find several known corresponding points (pitch lines, corners, the center circle — fixed landmarks) and compute the transformation matrix.

python
import cv2
import numpy as np

4 known points in the video frame (e.g. penalty-box corners) mapped to standard pitch coords (top-down, meters)

img_pts = np.array([[x1,y1],[x2,y2],[x3,y3],[x4,y4]], dtype=np.float32) pitch_pts = np.array([[0,0],[16.5,0],[16.5,40.3],[0,40.3]], dtype=np.float32)

H, _ = cv2.findHomography(img_pts, pitch_pts)

def to_pitch(px, py): # Map a player's pixel coords to real pitch coords p = cv2.perspectiveTransform(np.array([[[px, py]]], dtype=np.float32), H) return p[0][0] # (x_meters, y_meters)

With real coordinates, tactical analysis truly begins. For productionizing YOLO tracking, see production-grade computer vision with YOLO v11.

Tactical data 1: positional heatmaps

A heatmap shows the areas where a player/team is most active across a match. The method is direct: accumulate all of that player's frame-by-frame pitch coordinates into a 2D density map.

python
import numpy as np
from scipy.ndimage import gaussian_filter

def build_heatmap(positions, pitch_w=105, pitch_h=68, bins=50): xs = [p[0] for p in positions] ys = [p[1] for p in positions] heat, _, _ = np.histogram2d(xs, ys, bins=bins, range=[[0, pitch_w], [0, pitch_h]]) return gaussian_filter(heat, sigma=1.5) # Gaussian smoothing for a more natural heatmap

Once a heatmap is drawn, a player's role is obvious at a glance: a fullback's heatmap concentrates in the wide channel, an attacking midfielder's spreads across the final third. The opponent's overall heatmap reveals which side they prefer to attack from — exactly what the coach wants to know.

Tactical data 2: passing networks

A passing network is a more information-rich analysis: treat players as nodes, passing relationships as edges, with edge thickness representing pass frequency. It visually shows who the team's organizational core is and which passing lane is its lifeline.

python
import networkx as nx

def build_pass_network(passes): # passes: [(from_player, to_player), ...] G = nx.DiGraph() for src, dst in passes: if G.has_edge(src, dst): G[src][dst]['weight'] += 1 else: G.add_edge(src, dst, weight=1) # Node centrality = how important this player is to the organization centrality = nx.betweenness_centrality(G, weight='weight') return G, centrality

The player with the highest centrality is often the team's organizational hub. Marking that person specifically disrupts the opponent's attacking organization — the most practical use of passing-network analysis.

Tactical data 3: formation and compactness

Aggregating the whole team's real-time coordinates lets you compute formation centroid, team width, defensive-line height, and compactness. For instance, "how many seconds after conceding possession does this side restore defensive compactness" is a key measure of defensive organization. This is essentially geometric statistics on pitch coordinates — not hard; the difficulty is having accurate enough tracking and coordinate mapping upstream.

Making it an interactive dashboard

Computing the data isn't enough; coaches need to explore it interactively. Render the analyses above into a dashboard: pick a player to see the heatmap, pick a time window to see the passing network, compare two teams' formations. This stack is the same as real-time AI dashboards — see how to build a real-time AI dashboard and real-time AI analytics dashboard.

The realistic boundaries

Some honest words:

  • Coordinate-mapping precision is the bottleneck. Single-camera broadcast angles keep switching, and every shot cut requires re-calibrating homography; errors propagate to all downstream analysis. Professional scouting systems use fixed-position whole-pitch tactical cameras with far higher precision.
  • Player identity recognition is hard: tracking gives an ID, but mapping it to "which specific player" requires jersey-number recognition (OCR), often illegible in broadcast footage.
  • Large data volume: frame-by-frame analysis of a match is large; plan storage and compute well.
  • But even a hobby reproduction — producing a single player's heatmap, one passing-network graph — already reveals plenty, and it's a rewarding advanced project.

    For the upstream (detection and tracking) see CV watches football, and for the big picture see the AI and 2026 World Cup roundup.

    Also available in 中文.