Skip to content

xampos101/Hybrid-Euro-Detection-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hybrid Euro Coin Detection System

Python License YOLO OpenCV

A real-time Euro coin detection and classification system using a Hybrid Pipeline Architecture that combines YOLO11s deep learning with classical computer vision techniques for high accuracy and stability.

๐ŸŽฏ Overview

This system detects and classifies all 8 types of Euro coins (1c, 2c, 5c, 10c, 20c, 50c, 1โ‚ฌ, 2โ‚ฌ) in real-time using a custom-trained YOLO11s model combined with size refinement, color classification, and consensus voting.

โœจ Key Features

  • ๐Ÿš€ Real-time Detection: Optimized for 20+ FPS with frame skipping
  • ๐ŸŽฏ High Accuracy: Custom-trained YOLO11s model (99.1% mAP50)
  • ๐Ÿ”ฌ Multi-method Classification: YOLO + Size + Color with consensus voting
  • ๐Ÿ“Š Temporal Smoothing: Reduces flickering with frame history tracking
  • ๐ŸŽจ Color Classification: Robust HSV-based color analysis
  • ๐Ÿ“ Size-based Classification: Calibrated pixel-to-millimeter conversion
  • ๐Ÿ–ฅ๏ธ Side-by-Side GUI: Camera feed + Statistics panel
  • โš™๏ธ Calibration System: Coin-based calibration for accurate sizing

๐Ÿ—๏ธ Architecture

The system uses a Hybrid Pipeline that combines multiple detection methods:

Camera Frame
    โ†“
YOLO11s Detection (Primary)
    โ†“
Hybrid Pipeline Processing
    โ”œโ”€โ–บ Size Refinement (Hough Circles - Optional)
    โ”œโ”€โ–บ Color Classification (HSV Analysis)
    โ”œโ”€โ–บ Size Classification (Calibrated)
    โ””โ”€โ–บ Consensus Voting (Weighted Combination)
    โ†“
Temporal Smoothing (Frame History)
    โ†“
Display (Camera + GUI Panel)

Component Overview

  • CoinDetectionApp (main.py): Main application coordinator
  • CoinDetector (detector.py): YOLO11s model wrapper
  • HybridPipeline (hybrid.py): Multi-method classification
  • Calibrator (calibration.py): Pixel-to-mm calibration
  • Utils (utils.py): Utility functions

For detailed architecture, see Report/Report.md.

๐Ÿ“ธ Screenshots

Screenshots will be added to assets/screenshots/

๐Ÿš€ Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/xampos101/Hybrid-Euro-Detection-System.git
    cd Hybrid-Euro-Detection-System
  2. Install dependencies:

    pip install -r requirements.txt
  3. Verify model file:

    • Ensure V2/model/best.pt exists (YOLO11s trained model)

Basic Usage

python new_pipeline/main.py

Calibration (Recommended)

For best accuracy, calibrate the system first:

  1. Press '2' for 2โ‚ฌ coin calibration
  2. Place ONLY the selected coin in frame
  3. Wait for green circle
  4. Press SPACE to confirm

๐Ÿ“ Project Structure

Hybrid-Euro-Detection-System/
โ”œโ”€โ”€ new_pipeline/          # Main pipeline code
โ”‚   โ”œโ”€โ”€ main.py           # Application entry point
โ”‚   โ”œโ”€โ”€ detector.py       # YOLO detection wrapper
โ”‚   โ”œโ”€โ”€ hybrid.py         # Hybrid classification pipeline
โ”‚   โ”œโ”€โ”€ calibration.py   # Calibration system
โ”‚   โ”œโ”€โ”€ utils.py          # Utility functions
โ”‚   โ””โ”€โ”€ config.py         # Configuration settings
โ”‚
โ”œโ”€โ”€ V2/                   # Models
โ”‚   โ””โ”€โ”€ model/
โ”‚       โ””โ”€โ”€ best.pt       # YOLO11s trained model
โ”‚
โ”œโ”€โ”€ Report/               # Documentation
โ”‚   โ”œโ”€โ”€ Report.md        # Technical report
โ”‚   โ””โ”€โ”€ FlowDiagrams.md  # Mermaid flow diagrams
โ”‚
โ”œโ”€โ”€ docs/                 # Additional documentation
โ”‚   โ””โ”€โ”€ training/        # Training results and plots
โ”‚
โ”œโ”€โ”€ records/              # Demo videos
โ”‚   โ””โ”€โ”€ *.mp4           # Video demonstrations
โ”‚
โ””โ”€โ”€ assets/              # Images and screenshots
    โ”œโ”€โ”€ screenshots/     # Application screenshots
    โ””โ”€โ”€ diagrams/        # Exported diagrams

๐ŸŽ“ YOLO11s Model

Training Details

  • Architecture: YOLO11s (small variant)
  • Base Model: Pretrained yolo11s.pt
  • Epochs: 20
  • Dataset: Custom Euro coins dataset
  • Final Performance:
    • Precision: 97.7%
    • Recall: 97.0%
    • mAP50: 99.1%
    • mAP50-95: 90.7%

Training Results

Training Results

Confusion Matrix

For detailed training information, see docs/training/training_results.md.

๐ŸŽฅ Demo Videos

Demo videos are available in the records/ folder:

  • FINAL_RECORD.mp4 - Final demonstration
  • Recording 2026-01-15 160914.mp4 - Latest recording
  • Additional recordings available

See records/README.md for detailed descriptions.

๐Ÿ“š Documentation

  • Report/Report.md: Comprehensive technical report

    • Architecture overview
    • Component descriptions
    • Algorithms and logic
    • Configuration guide
  • Report/FlowDiagrams.md: Mermaid flow diagrams

    • Main application flow
    • Detection pipeline
    • Consensus voting
    • Temporal smoothing
    • Color classification
  • docs/training/training_results.md: Training documentation

    • Training configuration
    • Results and metrics
    • Performance analysis

โš™๏ธ Configuration

All settings are in new_pipeline/config.py:

  • YOLO Settings: Confidence threshold, IOU threshold, image size
  • Hybrid Pipeline: Hough refinement, color thresholds
  • Temporal Smoothing: History size, matching thresholds
  • Performance: Frame skipping, optimization settings

๐ŸŽฎ Controls

  • 'q': Quit application
  • 'd': Toggle debug mode
  • '2': Calibrate with 2โ‚ฌ coin
  • '1': Calibrate with 1โ‚ฌ coin
  • '5': Calibrate with 50c coin
  • SPACE: Confirm calibration
  • ESC: Cancel calibration

๐Ÿ”ง Requirements

  • Python 3.8+
  • OpenCV (cv2)
  • NumPy
  • Ultralytics YOLO
  • PyTorch (CPU or CUDA)

Install all dependencies:

pip install -r requirements.txt

๐Ÿ† Performance

  • Detection Speed: 20+ FPS (with optimizations)
  • Accuracy: 99.1% mAP50 (YOLO11s model)
  • Classification: Multi-method consensus voting
  • Stability: Temporal smoothing reduces flickering

๐Ÿ› ๏ธ Technologies Used

  • YOLO11s: Custom-trained deep learning model
  • OpenCV: Image processing, Hough circles, camera capture
  • NumPy: Array operations and mathematical calculations
  • Ultralytics: YOLO framework
  • PyTorch: Deep learning backend

๐Ÿ“Š System Architecture

The system combines:

  • Deep Learning (YOLO11s): Fast and accurate detection
  • Classical CV (Hough, Color): Robust classification
  • Temporal Smoothing: Stability across frames
  • Consensus Voting: Weighted combination for accuracy

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Ultralytics for the YOLO framework
  • OpenCV community for excellent computer vision tools
  • Euro coin specifications from official sources

๐Ÿ“ง Contact

For questions or issues, please open an issue on GitHub.


Built with โค๏ธ using YOLO11s and OpenCV

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages