Skip to main content

SoccerNetPro is the professional extension of the popular SoccerNet library, designed for advanced video understanding in soccer. It provides state-of-the-art tools for action recognition, spotting, retrieval, and captioning, making it ideal for researchers, analysts, and developers working with soccer video data.

Project description

SoccerNetPro

SoccerNetPro is the professional extension of the popular SoccerNet library, designed for advanced video understanding in soccer. It provides state-of-the-art tools for action recognition, spotting, retrieval, and captioning, making it ideal for researchers, analysts, and developers working with soccer video data.

Installation

conda create -n SoccerNet python=3.12 pip
conda activate SoccerNet
pip install soccernetpro==0.0.1.dev1

Configuration Sample (.yaml) file

TASK: classification

DATA:
  dataset_name: mvfouls
  data_path: mvfouls
  view_type: single
  annotations:
    train: soccernetpro-ml/train_annotations.json
    valid: soccernetpro-ml/test_annotations.json
    test: soccernetpro-ml/valid_annotations.json
  num_frames: 16               # 8 before + 8 after the foul
  input_fps: 25                # Original FPS of video
  target_fps: 16               # Temporal downsampling to 1s clip (approx)
  frame_size: [224, 224]       # Spatial resolution (HxW)
  augmentations:
    random_crop: true
    random_horizontal_flip: true
    flip_prob: 0.5
    color_jitter: false
    jitter_params: [0.4, 0.4, 0.4, 0.1]   # brightness, contrast, saturation, hue
    random_erasing: false
  num_workers: 1
  train_batch_size: 8
  valid_batch_size: 4

MODEL:
  type: huggingface
  backbone: video_mae
  pretrained_model: MCG-NJU/videomae-base
  num_classes: 7
  freeze_backbone: true
  

TRAIN:
  enabled: true
  use_weighted_sampler: true
  epochs: 10
  learning_rate: 0.005
  save_dir: soccernetpro/checkpoints
  log_interval: 10
  save_every: 5

SYSTEM:
  log_dir: ./soccernetpro/logs
  seed: 42

Annotations (train/valid/test) (.json) format

{
  "version": "1.0",
  "date": "2025-11-11",
  "task": "action_classification",
  "dataset_name": "mvfouls",
  "metadata": {
    "source": "Professional Soccer Dataset",
    "license": "CC-BY-NC-4.0",
    "created_by": "AI Sports Lab",
    "notes": "Converted automatically from SoccerNet-like foul annotation structure."
  },
  "labels": {
    "foul_type": {
      "type": "single_label",
      "labels": [
        "Challenge",
        "Dive",
        "Elbowing",
        "High Leg",
        "Holding",
        "Pushing",
        "Standing Tackling",
        "Tackling"
      ]
    },
    "severity": {
      "type": "single_label",
      "labels": [
        "No Offence",
        "Offence + No Card",
        "Offence + Yellow Card",
        "Offence + Red Card"
      ]
    },
    "attributes": {
      "type": "multi_label",
      "labels": [
        "Intentional",
        "Reckless",
        "Dangerous Play",
        "VAR Checked",
        "InBox",
        "CounterAttack"
      ]
    }
  },
  "data": [
    {
      "id": "action_0",
      "inputs": [
        {
          "type": "video",
          "path": "Dataset/Train/action_0/clip_0",
          "metadata": {
            "camera_type": "Main camera center",
            "timestamp": 1730826,
            "replay_speed": 1.0
          }
        },
        {
          "type": "video",
          "path": "Dataset/Train/action_0/clip_1",
          "metadata": {
            "camera_type": "Close-up player or field referee",
            "timestamp": 1744173,
            "replay_speed": 1.8
          }
        }
      ],
      "labels": {
        "foul_type": {
          "label": "Challenge"
        },
        "severity": {
          "label": "Offence + No Card"
        },
        "attributes": {
          "labels": [
            "Reckless"
          ]
        }
      },
      "metadata": {
        "UrlLocal": "england_epl\\2014-2015\\2015-02-21 - 18-00 Chelsea 1 - 1 Burnley",
        "Contact": "With contact",
        "Bodypart": "Upper body",
        "Upper body part": "Use of shoulder",
        "Handball": "No handball"
      }
    }
    ]
}

Train

from soccernetpro import model
import wandb

# Initialize model with config
myModel = model.classification(
    config="soccernetpro/config/classification.yaml"
)

# Optionally adjust config
myModel.config.TRAIN.learning_rate = 1e-4
myModel.config.MODEL.freeze_backbone = True

# Train on your dataset
myModel.train(
    train_set="train_annotations.json",
    valid_set="valid_annotations.json",
    pretrained=None  # or path to pretrained checkpoint
)

Test / Inference

from soccernetpro import model

# Load trained model
myModel = model.classification(
    config="soccernetpro/config/classification.yaml"
)

# Run inference on test set
myModel.infer(
    test_set="test_annotations.json",
    pretrained="checkpoints/final_model",
    output_inference="inference_results.json"
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soccernetpro-0.0.1.dev2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soccernetpro-0.0.1.dev2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file soccernetpro-0.0.1.dev2.tar.gz.

File metadata

  • Download URL: soccernetpro-0.0.1.dev2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for soccernetpro-0.0.1.dev2.tar.gz
Algorithm Hash digest
SHA256 20558563732a3d6f780e9b5c6b322697f6d719bca883f1e199578896959b0c82
MD5 1934a4b4c397e674bf60cd9918b9f89f
BLAKE2b-256 d99d1e6bd180f92ec1eac2c13e90849ee29f0f5f931e49cce29ae81306c18a96

See more details on using hashes here.

File details

Details for the file soccernetpro-0.0.1.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for soccernetpro-0.0.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 d5d5da37d611b0f72b9e2c8c0488c399f6785fe01bf3cee31f724ba142b53a18
MD5 f557c42c34b4e9abb08beaf16a26a3b6
BLAKE2b-256 73879d32f5be1c3e7d85d36f237d5eb789bff3249569a0172432dc11c8d40f65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page