First off, thank you for considering contributing to the Driver Monitoring System! It's people like you that make this project such a great tool.
This project and everyone participating in it is governed by our commitment to providing a welcoming and inspiring community for all. Please be respectful and constructive in your communications.
Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible:
Bug Report Template:
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment:**
- OS: [e.g. Windows 10, macOS 13.0]
- Python Version: [e.g. 3.9.7]
- Browser: [e.g. Chrome 120]
**Additional context**
Add any other context about the problem here.Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
- Clear title and description of the suggested enhancement
- Use cases - Why would this be useful?
- Possible implementation - How could this be implemented?
- Alternatives considered - What other solutions have you thought about?
-
Fork the Repository
git clone https://github.com/yourusername/Driver_Monitoring_System.git cd Driver_Monitoring_System -
Create a Branch
git checkout -b feature/your-feature-name
Branch naming conventions:
feature/for new featuresbugfix/for bug fixesdocs/for documentation updatesrefactor/for code refactoring
-
Make Your Changes
- Write clear, commented code
- Follow PEP 8 style guidelines for Python
- Add docstrings to functions and classes
- Update documentation as needed
-
Test Your Changes
- Ensure all existing tests pass
- Add new tests for new features
- Test manually with both live camera and image upload modes
-
Commit Your Changes
git add . git commit -m "feat: add amazing new feature"
Commit message format:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for formatting changesrefactor:for code refactoringtest:for adding testschore:for maintenance tasks
-
Push to Your Fork
git push origin feature/your-feature-name
-
Open a Pull Request
- Provide a clear description of the changes
- Reference any related issues
- Include screenshots/videos if applicable
python --version # Should be 3.8+# Clone your fork
git clone https://github.com/yourusername/Driver_Monitoring_System.git
cd Driver_Monitoring_System
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install development dependencies
pip install pytest black flake8 mypy# Run all tests
pytest
# Run specific test file
pytest tests/test_detection.py
# Run with coverage
pytest --cov=.We follow PEP 8 with some modifications:
# Format code with black
black .
# Check style with flake8
flake8 .
# Type checking with mypy
mypy .Key guidelines:
- Maximum line length: 100 characters
- Use 4 spaces for indentation (no tabs)
- Use descriptive variable names
- Add type hints where possible
- Write docstrings for all public functions/classes
Use Google-style docstrings:
def process_frame(frame, model, threshold=0.5):
"""Process a video frame for object detection.
Args:
frame (np.ndarray): Input image frame in BGR format.
model (YOLO): YOLO model instance.
threshold (float, optional): Confidence threshold. Defaults to 0.5.
Returns:
list: List of detected objects with bounding boxes.
Raises:
ValueError: If frame is None or empty.
"""
passWhen adding a new detection module:
- Create a new file:
new_detection.py - Follow this template:
"""Module for [detection type] detection.
This module implements [brief description].
"""
from utils import extract_boxes
def process_[detection_type](frame, model, **kwargs):
"""Process frame for [detection type] detection.
Args:
frame: Input image frame
model: YOLO model instance
**kwargs: Additional parameters
Returns:
list: Detection results
"""
# Implementation
pass- Import in
app.py:
from new_detection import process_[detection_type]- Add to processing pipeline in
/process_imageroute
Add configuration to the top of app.py:
# New feature config
NEW_FEATURE_ENABLED = True
NEW_FEATURE_THRESHOLD = 0.6- 🧪 Unit Tests - Improve test coverage
- 📊 Performance Optimization - Reduce latency
- 🎯 Detection Accuracy - Improve model performance
- 📱 Mobile Responsiveness - Better UI on mobile devices
- 🌍 Internationalization - Add multi-language support
- 📈 Analytics Dashboard - Add statistics and charts
- 🐳 Dockerization - Create Docker setup
- 📚 Documentation - More examples and tutorials
- Multi-person detection support
- Head pose estimation for attention detection
- Fatigue score calculation
- Historical data logging
- REST API for integrations
- Voice alerts
- Dashboard for fleet monitoring
Contributors will be:
- Listed in the README.md
- Mentioned in release notes
- Given credit in documentation
Feel free to:
- Open an issue with the
questionlabel - Reach out via email: your.email@example.com
- Start a discussion in GitHub Discussions
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing! 🎉