Skip to content

jethronap/UNDO-cctv-detection

Repository files navigation

📹 CCTV Detection System

License Python Tests

Part of the Understanding Nordic Digital Order (UNDO) project

A multi-model object detection system for identifying CCTV cameras and signage using state-of-the-art deep learning architectures: YOLOv8, Faster R-CNN, and DETR.

✨ Features

  • 🎯 Multi-Model Support: Compare three detection architectures (YOLOv8, Faster R-CNN, DETR)
  • 🎨 Interactive Web UI: Gradio-based interface with side-by-side model comparison
  • 📊 Performance Dashboard: Training metrics, loss curves, and mAP comparisons
  • 🧪 Comprehensive Testing: >65% code coverage with 137+ passing tests
  • ⚙️ Type-Safe Configuration: Pydantic v2 settings with environment variable support

🚀 Quick Start

Installation

This project uses uv for fast package management:

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync --all-extras

# Install pre-commit hooks
uv run pre-commit install

📦 Download Model Weights

Place trained model weights in the samples/ directory:

samples/
├── best.pt              # YOLOv8 weights
├── fasterrcnn_best.pt   # Faster R-CNN weights
└── detr_best.pt         # DETR weights

Or train models from scratch (see Training Guide).

Need access to pre-trained weights or the full dataset? Contact the UNDO project team.

🎬 Launch the Application

# Start the Gradio web interface
uv run python app.py

# Or use the console script
uv run cctv-ui

Visit http://127.0.0.1:7860 in your browser.

📚 Documentation

Comprehensive guides are available in the docs/source/ directory:

Guide Description
🏗️ Architecture Layered architecture, design patterns, and project structure
⚙️ Configuration Environment variables, paths, and settings customization
🧠 Training Training all three models with custom datasets
📈 Evaluation Model evaluation and performance comparison methodology
🎛️ UI Guide Using the web interface and preparing example images
💻 Development Testing, code quality, and contributing guidelines
🗂️ Dataset Dataset structure, format conversion, and labeling

🛠️ Console Scripts

Command Description
uv run cctv-ui Launch Gradio web interface
uv run cctv-train Train YOLOv8 model
uv run cctv-train-faster-rcnn Train Faster R-CNN model
uv run cctv-train-detr Train DETR model
uv run cctv-evaluate-faster-rcnn Evaluate Faster R-CNN and compute mAP
uv run cctv-evaluate-detr Evaluate DETR and compute mAP
uv run cctv-prepare-examples Prepare example images for UI
uv run cctv-benchmark Benchmark inference speed

🗂️ Project Structure

cctv_detection/
├── app.py                   # Main entry point
├── src/
│   ├── domain/             # Business logic & interfaces
│   ├── application/        # Use case orchestration
│   ├── infrastructure/     # Concrete implementations
│   ├── ui/                 # Gradio web interface
│   └── config.py           # Centralized configuration
├── scripts/                # Training and utility scripts
├── tests/                  # Comprehensive test suite
├── docs/                   # Detailed documentation
├── datasets/               # Training data
├── samples/                # Model weights
└── examples/               # UI example images

See Architecture Guide for detailed information.

🤝 Contributing

Contributions are welcome! Please see the Development Guide for:

  • Setting up your development environment
  • Running tests and code quality checks
  • Coding standards and best practices
  • Submitting pull requests

📄 License

This project is licensed under the GNU General Public License v3.0 - See LICENSE

🙏 Acknowledgments

📚 Citation

If you use this system in research, please cite:

@software{cctv_detection_2024,
  title={CCTV Detection System},
  author={UNDO Project},
  year={2024},
  url={https://github.com/jethronap/cctv_detection}
}

About

A CCTV detection pipeline. For the UNDO project: https://undo-project.info | UNDO

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •