Contributing to BaseballCV
We welcome contributions from the community! This guide explains how to contribute to BaseballCV effectively, whether you’re improving code, adding datasets, or helping with documentation.
Ways to Contribute
There are several ways to contribute to BaseballCV:
- Code Development
- Implementing new features
- Bug fixes
- Performance improvements
- Model optimizations
- Dataset Contributions
- Adding new annotated datasets
- Improving existing annotations
- Validating dataset quality
- Documentation
- Improving existing documentation
- Adding new examples
- Writing tutorials
- Fixing typos or unclear explanations
- Testing
- Writing unit tests
- Integration testing
- Model validation
- Dataset validation
Getting Started
1. Setting Up Your Development Environment
# Fork and clone the repository
git clone https://github.com/yourusername/BaseballCV.git
cd BaseballCV
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows, use venv\Scripts\activate
# Install development dependencies
pip install -r requirements.txt
2. Code Standards
We follow these coding standards:
# Example of proper code style
def process_video(video_path: str,
output_dir: str,
max_frames: int = 1000) -> List[str]:
"""
Process video frames with proper documentation.
Args:
video_path (str): Path to input video
output_dir (str): Directory for output frames
max_frames (int, optional): Maximum frames to process. Defaults to 1000.
Returns:
List[str]: Paths to processed frames
"""
# Your implementation here
pass
- Use type hints for function arguments and returns
- Provide clear docstrings for all functions
- Follow PEP 8 style guidelines
- Add comments for complex logic
- Keep functions focused and single-purpose
Development Workflow
1. Creating a New Feature
# Create a new branch
git checkout -b feature/your-feature-name
# Make your changes
# Add tests for new functionality
# Update documentation if needed
# Run tests
pytest tests/
# Submit your pull request
2. Testing Requirements
All contributions must include appropriate tests:
# Example test file: tests/test_video_processing.py
import pytest
from baseballcv.functions import extract_frames_from_video
def test_frame_extraction():
"""Test video frame extraction functionality"""
video_path = "tests/data/test_video.mp4"
output_dir = "tests/output"
frames = extract_frames_from_video(
video_path=video_path,
output_dir=output_dir,
max_frames=10
)
assert len(frames) == 10
assert all(frame.endswith('.jpg') for frame in frames)
Contributing Datasets
When contributing new datasets:
- Data Organization
dataset_name/ ├── train/ │ ├── images/ │ └── labels/ ├── valid/ │ ├── images/ │ └── labels/ └── test/ ├── images/ └── labels/
- Annotation Requirements
- Follow existing format conventions (YOLO/COCO)
- Provide class mappings
- Include dataset statistics
- Document any special considerations
- Dataset Documentation
# Example dataset documentation dataset_info = { 'name': 'new_baseball_dataset', 'version': '1.0', 'classes': { 0: 'baseball', 1: 'glove', # ... other classes }, 'statistics': { 'total_images': 1000, 'train_split': 800, 'valid_split': 100, 'test_split': 100 } }
Documentation Contributions
When contributing to documentation:
- Write clear, concise explanations
- Include practical examples
- Follow Markdown formatting guidelines
- Test all code examples
- Update navigation and links as needed
Pull Request Guidelines
When submitting a pull request:
- Title and Description
- Clear, descriptive title
- Detailed description of changes
- Reference any related issues
- Code Review Checklist
- Code follows style guidelines
- All tests pass
- Documentation is updated
- Changes are tested
- Branch is up to date with main
- Pull Request Template
## Description Brief description of changes ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Documentation update - [ ] Dataset contribution ## Test Coverage Describe testing approach ## Additional Notes Any extra information
Using the Annotation App
For dataset contributions, you can use our Annotation App:
- Visit Annotation App
- Enter credentials
- Select or create a project
- Follow annotation guidelines
- Submit contributions
Getting Help
- Join our community discussions
- Check existing issues
- Review documentation
- Contact maintainers
Before starting work on a major contribution, please open an issue to discuss your proposed changes with the maintainers.
Code of Conduct
We expect all contributors to:
- Be respectful and professional
- Welcome newcomers
- Provide constructive feedback
- Follow project guidelines
Recognition
Contributors are recognized through:
- GitHub contribution graph
- Release notes
- Documentation credits
- Community acknowledgments
By contributing to BaseballCV, you agree to license your contributions under the project’s MIT license.