help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
sports-analysis
RSK World
sports-analysis
Sports Analysis Dataset - Game Footage + Player Tracking + Event Annotations + OpenCV + Video Analysis
sports-analysis
  • .github
  • assets
  • data
  • docs
  • examples
  • scripts
  • .gitignore577 B
  • ADVANCED_FEATURES.md7.1 KB
  • CHANGELOG.md3.5 KB
  • CONTRIBUTING.md1 KB
  • DATA_SUMMARY.md4.1 KB
  • ERROR_CHECK_REPORT.md3.6 KB
  • GITHUB_RELEASE_GUIDE.md4.3 KB
  • LICENSE1.3 KB
  • PROJECT_SUMMARY.md3.8 KB
  • README.md2.7 KB
  • RELEASE_NOTES.md5.6 KB
  • api.html10.3 KB
  • config.json1.6 KB
  • dashboard.html9.6 KB
  • explorer.html8.8 KB
  • index.html95.9 KB
  • package.json1.3 KB
  • server.js7.9 KB
  • sports-analysis.png2.7 MB
  • sports-analysis.zip13.6 KB
  • sports-analysis.zip.info514 B
example_events.py
examples/example_events.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
"""
RSK World
Founder: Molla Samser
Designer & Tester: Rima Khatun
Email: help@rskworld.in
Phone: +91 93305 39277
Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
Website: https://rskworld.in/

Example script for event detection and analysis using the Sports Analysis Dataset
"""

import json
from collections import Counter
from datetime import datetime

def load_events(json_path):
    """
    Load event annotations from JSON file
    
    Args:
        json_path: Path to events JSON file
        
    Returns:
        List of event dictionaries
    """
    with open(json_path, 'r') as f:
        return json.load(f)

def analyze_events(events):
    """
    Analyze events and generate statistics
    
    Args:
        events: List of event dictionaries
        
    Returns:
        Dictionary with statistics
    """
    stats = {
        'total_events': len(events),
        'event_types': Counter([e['event_type'] for e in events]),
        'events_by_player': Counter([e.get('player_id', 'unknown') for e in events]),
        'time_range': {
            'start': min([e['timestamp'] for e in events]),
            'end': max([e['timestamp'] for e in events])
        }
    }
    return stats

def filter_events_by_type(events, event_type):
    """
    Filter events by type
    
    Args:
        events: List of event dictionaries
        event_type: Type to filter by
        
    Returns:
        Filtered list of events
    """
    return [e for e in events if e['event_type'] == event_type]

def print_statistics(stats):
    """
    Print event statistics in a readable format
    
    Args:
        stats: Statistics dictionary
    """
    print("\n=== Event Statistics ===")
    print(f"Total Events: {stats['total_events']}")
    print("\nEvents by Type:")
    for event_type, count in stats['event_types'].items():
        print(f"  {event_type}: {count}")
    print("\nTop Players by Events:")
    for player_id, count in stats['events_by_player'].most_common(5):
        print(f"  Player {player_id}: {count} events")
    print(f"\nTime Range: {stats['time_range']['start']} to {stats['time_range']['end']}")

def main():
    """
    Main function to run event analysis example
    """
    # Example path (adjust based on your dataset structure)
    events_path = '../data/annotations/events_001.json'
    
    print("Loading event data...")
    events = load_events(events_path)
    
    print("Analyzing events...")
    stats = analyze_events(events)
    print_statistics(stats)
    
    # Example: Filter goals
    print("\n=== Goals ===")
    goals = filter_events_by_type(events, 'goal')
    print(f"Total Goals: {len(goals)}")
    for goal in goals:
        print(f"  Player {goal.get('player_id', 'unknown')} at {goal['timestamp']}")

if __name__ == '__main__':
    main()

106 lines•2.9 KB
python
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer