Inspiration

Baseball is a game rich with data, from pitch speeds to player stats, yet much of its historical footage remains untapped for deeper insights. We wanted to bridge this gap by leveraging AI to extract meaningful Statcast metrics from archival baseball videos, making data analysis more accessible to fans, analysts, and coaches alike. The idea of Base.G was bornβ€”an AI-powered tool that unlocks the hidden statistics in baseball footage.

What it does

Base.G is an AI-powered platform that automatically extracts and analyzes baseball statistics from game videos and images. Users can:

  • Upload baseball game videos or images πŸ“ΉπŸ–ΌοΈ
  • Detect key moments using scene recognition 🎞️
  • Extract important game statistics (e.g., pitch speed, exit velocity, player names, scores, etc.) using AI πŸ€–
  • View structured stats in a dynamic table πŸ“Š
  • Ask questions about the extracted data in a chat interface πŸ’¬
  • Avoid redundant API calls by caching extracted stats ⚑

How we built it

We combined computer vision and natural language AI to make Base.G a powerful yet easy-to-use tool:

  • Frontend: Built using Streamlit for an intuitive and interactive experience.
  • Computer Vision: Used OpenCV and SceneDetect to extract key frames from videos.
  • AI Processing: Leveraged Google Gemini AI to perform OCR, extract statistics, and provide structured insights.
  • Data Processing: Used Pandas to clean and format extracted data, ensuring consistency across frames.
  • Caching & Optimization: Implemented session state caching to prevent unnecessary reprocessing of images when chatting with the extracted data.

Challenges we ran into

  • Inconsistent OCR Results: Gemini sometimes returned different key names for similar stats, requiring additional processing to consolidate extracted data.
  • Data Structuring: Ensuring that extracted stats were properly formatted, labeled, and structured in a clean table required multiple iterations.
  • Efficiency Concerns: Initially, querying the chat feature would reprocess the images, so we optimized it using session caching.
  • Timestamp & Frame Association: Making sure that extracted statistics were properly time-aligned with the video footage was crucial for accuracy.

Accomplishments that we're proud of

  • Successfully built an end-to-end pipeline that can process baseball footage and extract meaningful statistics automatically.
  • Implemented a chat interface for querying extracted data, making it interactive and engaging.
  • Optimized processing efficiency by ensuring minimal redundant API calls to Gemini AI.
  • Created a user-friendly UI that even non-technical users can navigate easily.

What we learned

  • The power of AI in sports analytics: Automating stat extraction opens up new possibilities for game analysis.
  • Data consistency matters: Standardizing AI-extracted data was essential to make the outputs useful.
  • Optimization is key: Efficient caching and structured processing significantly improved performance.
  • Real-world AI challenges: OCR-based AI models require fine-tuning when applied to dynamic, real-world environments like sports broadcasts.

What's next for Base.G

πŸš€ Future Enhancements:

  • Real-time Game Analysis: Enable live video analysis for real-time stat tracking.
  • Player Recognition: Improve AI-based facial recognition to identify players more accurately.
  • Expanded AI Insights: Add deeper insights, such as swing analysis and pitch movement patterns.
  • Multi-Language Support: Enhance OCR capabilities for international baseball broadcasts.
  • Mobile App Integration: Bring Base.G to mobile devices for instant stat retrieval on the go.

Base.G is just getting startedβ€”our vision is to make AI-driven baseball analysis accessible to everyone! ⚾πŸ”₯

Built With

Share this project:

Updates