Ball possession sounds like a simple percentage, but producing a trustworthy number from match video is a complete computer vision system. The model must find a small, fast-moving ball, identify players, handle occlusion, and decide when a player or team actually controls play. In school environments, the best solution is rarely the most expensive one. A fixed camera, a carefully defined metric, and an offline workflow can deliver useful coaching feedback while keeping costs and privacy risks manageable.
This guide explains how to apply computer vision for ball possession statistics in school games, with an emphasis on practical deployment in India across football, basketball, hockey, and similar sports.
Define possession before collecting video
Start with a written measurement rule. “Possession” can mean different things:
- Team possession: the percentage of active game time during which one team controls the ball.
- Player possession: the time a named player controls the ball.
- Touches: the number of detected contacts with the ball.
- Possession sequence: a continuous period of control that ends with a pass, tackle, shot, interception, out-of-bounds event, or loss of tracking.
For a first school project, team possession is usually more reliable than player-level possession. Player identities are difficult to maintain when uniforms look alike, players overlap, or the camera view changes. Record uncertain intervals separately rather than silently assigning them to a team. A useful report should include known possession, unknown time, and the confidence of each estimate.
The sport also matters. Football and hockey need field-wide coverage and frequent occlusion; basketball benefits from a higher, court-facing camera; cricket requires a different definition of possession altogether. Define the playing area, restart rules, stoppage handling, and whether dead-ball time is excluded before training a model.
Choose a realistic school-friendly setup
A reliable pilot can begin with one elevated, fixed camera rather than a multi-camera broadcast system. Use the highest frame rate and resolution the school can afford, but prioritise a stable view over cinematic quality. A 1080p camera at 50 or 60 frames per second is often more useful for fast play than a higher-resolution camera with motion blur.
Recommended components include:
- A tripod, balcony mount, or safe elevated position with the full court or field visible.
- Continuous power and enough local storage for complete matches.
- A laptop with a modern GPU for experimentation, or an edge device for lightweight inference.
- A visible game clock or a separate event log for aligning video with match periods.
- A backup copy of original footage and a lower-resolution copy for development.
Avoid placing cameras where students can be identified unnecessarily outside the playing area. If the system is only for team-level statistics, consider blurring faces or processing cropped player regions. Schools should obtain consent from the relevant authorities and guardians, restrict access, define retention periods, and avoid using sports footage for unrelated monitoring. Do not turn a coaching experiment into continuous student surveillance.
For implementation, open-source tools are a sensible starting point. Developers can compare libraries through this guide to open-source computer vision libraries in India, then document the selected versions, model weights, and hardware requirements in a public repository.
Build the detection and tracking pipeline
A practical pipeline has five stages:
1. Video preparation: stabilise footage, sample frames, correct lens distortion, and define the playing-area polygon.
2. Player detection: detect players in each frame using a model trained or fine-tuned on local match footage.
3. Ball detection: detect the ball separately because it is smaller, faster, and more frequently hidden than players.
4. Multi-object tracking: link detections across frames and assign temporary track IDs.
5. Possession inference: combine ball location, player proximity, movement, and event rules to estimate control.
Do not assume that a general-purpose object detector will work well on school footage. Uniforms, dusty grounds, uneven lighting, regional sports equipment, and camera height can differ substantially from public datasets. Annotate representative frames from several schools, venues, times of day, and teams. Include difficult examples: players in groups, partial views, shadows, motion blur, goalkeeper areas, and moments when the ball is hidden.
The project can be managed like other student AI builds: establish a baseline, keep labelled data and evaluation scripts together, and track each experiment. The workflow in how to build computer vision projects as a student is useful for turning an informal prototype into a reproducible submission or grant-ready pilot.
Infer possession instead of using nearest-player alone
Assigning the ball to the nearest detected player is an acceptable baseline, but it fails during passes, tackles, rebounds, and crowded play. A stronger rule engine can combine:
- Distance between the ball and each player after mapping image coordinates to the court or field.
- Ball velocity and direction between frames.
- The player’s movement and body orientation, where available.
- Team identity inferred from jersey colour or a manually configured roster.
- A short temporal window, requiring control to persist for several frames.
- Game events such as shots, goals, throw-ins, fouls, and restarts.
Use a state machine: unassigned, in flight, controlled by player, contested, and out of play. A pass should not instantly transfer possession merely because the ball crosses a player’s bounding box. Likewise, a tackle should create an uncertain or contested interval until the next few frames establish control.
For team statistics, aggregate player-level probabilities where possible. If the ball is contested, distribute confidence across teams or label the interval unknown. This is more honest than producing a precise-looking 63.47% figure from weak evidence.
Evaluate the number, not just the detector
Object-detection accuracy alone does not tell a coach whether possession statistics are useful. Create a manually reviewed test set and compare the system against human annotations. Report:
- Ball detection precision and recall.
- Player tracking failures per minute.
- Team possession error in percentage points.
- Mean absolute error for possession-sequence duration.
- Percentage of footage marked unknown.
- Performance by venue, lighting condition, sport, and camera angle.
Have two coaches or trained reviewers annotate a sample independently. Their disagreement gives a realistic ceiling for the metric. Validate on matches that were not used for training, preferably from a different ground or school. If results degrade sharply, the model has learned the venue rather than the game.
Before showing dashboards to students, review false assignments manually. A trend that is directionally useful for a team may still be unsuitable for ranking individual children. Present ranges and notes, such as “Team A controlled an estimated 52–56% of active play; 8% was unclassified.”
Deploy affordably and protect student data
For most schools, batch processing after the match is preferable to real-time inference. It reduces hardware requirements, avoids distracting coaches during play, and allows human review of uncertain clips. A small pilot can run on a local computer, with only aggregated statistics exported to a dashboard. Keep original video encrypted, limit administrator access, and delete it according to a documented schedule.
If an edge deployment is required, use a compact detector, lower the inference frame rate, and track between detections. Test thermal performance and power stability in the actual venue. Do not upload identifiable student footage to an external service without clear approval and a written data-processing arrangement.
The same engineering discipline applies when handling large datasets: define schemas, preserve timestamps, and separate raw media from derived data. Teams planning to train across many matches can learn from large-scale video data pipelines for computer vision training, while keeping the school pilot much smaller.
Turn possession into coaching insight
Possession is not automatically good performance. Pair it with territory, progressive passes, shots, turnovers, recoveries, and time spent in attacking areas. A team can dominate possession without creating chances; another may defend compactly and score through transitions.
Useful outputs include:
- Possession by half, quarter, or five-minute interval.
- Average and longest possession sequence.
- Possession lost under pressure.
- Team possession after substitutions or tactical changes.
- Clips attached to unusual or disputed events.
Share the limitations with coaches and students. Use the system to support reflection—“What happened during these three short possessions?”—rather than to label children as good or bad players. This makes the technology educational as well as analytical.
A sensible pilot plan for 2026
Start with one sport, one venue, and five to ten recorded matches. Define the metric, annotate a small dataset, establish a nearest-player baseline, and then add tracking and temporal rules. Compare results with human review before expanding to player identities or live dashboards. Publish a short technical report covering accuracy, unknown time, privacy controls, costs, and lessons learned.
Student teams can extend the project through best machine learning projects for computer science students, but the strongest project is not the one with the most advanced model. It is the one that produces a defensible statistic, explains uncertainty, and improves a real coaching decision.
Frequently asked questions
Can one camera measure possession accurately?
Yes, for a controlled pilot, especially on a basketball court or smaller field. A single elevated camera will still lose the ball during occlusion, so report unknown intervals and validate against human annotations.
Should schools process video in real time?
Usually not at first. Offline processing is cheaper, easier to audit, and safer for student data. Real-time analysis should be justified by a specific coaching need.
Which model should we use?
Choose a lightweight detector and fine-tune it on local footage. Model choice matters less than representative labels, camera placement, tracking logic, and evaluation on unseen matches.
Is possession enough to evaluate a player?
No. Possession must be interpreted alongside position, decision-making, defensive work, passing quality, and team context. It should never be the sole basis for selection or assessment.
AI Grants India supports practical AI projects with measurable public or educational value. If your school, student team, or startup is building a responsible sports-analytics pilot, explore AI Grants India for relevant funding and application guidance.