Skip to content

DynMEP/YOLOplan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

YOLOplan

YOLOplan automates symbol detection and counting in technical drawings (PDF, images, CAD) using YOLO11 object detection. Built for MEP professionals, it streamlines takeoff for electrical, HVAC, plumbing, and architectural projects fast, accurate, and production-ready.

Python 3.8+ License: MIT Tests


๐Ÿš€ Features

Core Capabilities

  • โœ… YOLO11 Integration - State-of-the-art object detection
  • โœ… Multi-format Support - PDF, JPG, PNG, BMP, TIFF
  • โœ… Batch Processing - Process multiple drawings simultaneously
  • โœ… Custom Training - Train on your specific symbols
  • โœ… Export Options - CSV, Excel, JSON with netlist support
  • โœ… Production Ready - Comprehensive error handling & logging

Advanced Features (v1.1.0)

  • ๐Ÿ†• Adaptive Preprocessing - Smart enhancement based on image characteristics
  • ๐Ÿ†• Netlist Generation - Connectivity analysis for electrical schematics
  • ๐Ÿ†• Hyperparameter Optimization - Auto-tune training with Optuna
  • ๐Ÿ†• Synthetic Data Generation - Augment small datasets
  • ๐Ÿ†• Parallel Processing - 3x faster batch operations
  • ๐Ÿ†• Comprehensive Testing - 25+ unit tests for reliability

๐ŸŒŽ Applications

  • Electrical & MEP Engineering - Automated symbol takeoff and counting
  • Construction Estimation - Rapid quantity extraction from plans
  • BIM & Digital Modeling - Integration with building information models
  • Facility Management - Asset inventory from as-built drawings
  • QA/QC - Verify plan completeness and symbol placement
  • Archival Digitization - Extract data from legacy drawings

โšก Quick Start

Installation (5 minutes)

# Clone repository
git clone https://github.com/DynMEP/YOLOplan.git
cd YOLOplan

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Verify installation
pytest test_yoloplan.py -v

Using Pre-trained Models (Immediate Use)

# Option 1: Use YOLO11 pretrained (general objects)
python YOLOplanDetector.py \
    --model yolo11s.pt \
    --source your_plan.pdf \
    --output results \
    --dpi 400

# Option 2: Download electrical symbols model from Roboflow
pip install roboflow
python -c "
from roboflow import Roboflow
rf = Roboflow(api_key='YOUR_KEY')
project = rf.workspace().project('electrical-symbols')
dataset = project.version(1).download('yolov8')
"

# Use downloaded model
python YOLOplanDetector.py \
    --model electrical-symbols-1/weights/best.pt \
    --source your_plan.pdf \
    --export all

Training Custom Model (2-3 hours)

# 1. Setup dataset structure
python YOLOplanTrainer.py setup \
    --path datasets/my_symbols \
    --classes outlet switch light panel

# 2. Label 20-50 images using Roboflow or LabelImg
#    - Upload to roboflow.com (easiest)
#    - Or use: pip install labelImg && labelImg

# 3. Train model with optimization
python YOLOplanTrainer.py train \
    --data datasets/my_symbols/data.yaml \
    --model s \
    --epochs 100 \
    --batch 16 \
    --optimize \
    --name my_model

# 4. Detect symbols in production
python YOLOplanDetector.py \
    --model runs/train/my_model/weights/best.pt \
    --source production_plans/ \
    --export all

๐Ÿ“‚ Project Structure

YOLOplan/
โ”œโ”€โ”€ YOLOplanDetector.py         # Detection and inference engine
โ”œโ”€โ”€ YOLOplanTrainer.py          # Training pipeline
โ”œโ”€โ”€ ImagePreprocessor.py        # Preprocessing utilities
โ”œโ”€โ”€ requirements.txt            # Dependencies
โ”œโ”€โ”€ test_yoloplan.py           # Comprehensive test suite
โ”‚
โ”œโ”€โ”€ docs/                       # Documentation
โ”‚   โ”œโ”€โ”€ YOLOplan.md            # Detailed usage guide
โ”‚   โ”œโ”€โ”€ INSTALLATION_GUIDE.md
โ”‚   โ”œโ”€โ”€ QUICK_REFERENCE.md
โ”‚   โ””โ”€โ”€ COMPLETE_FILES_SUMMARY.md
โ”‚
โ”œโ”€โ”€ datasets/                   # Your training datasets
โ”‚   โ””โ”€โ”€ electrical_symbols/
โ”‚       โ”œโ”€โ”€ images/
โ”‚       โ”‚   โ”œโ”€โ”€ train/
โ”‚       โ”‚   โ”œโ”€โ”€ val/
โ”‚       โ”‚   โ””โ”€โ”€ test/
โ”‚       โ”œโ”€โ”€ labels/
โ”‚       โ””โ”€โ”€ data.yaml
โ”‚
โ”œโ”€โ”€ models/                     # Model weights
โ”‚   โ”œโ”€โ”€ yolo11n.pt
โ”‚   โ”œโ”€โ”€ yolo11s.pt
โ”‚   โ””โ”€โ”€ best.pt
โ”‚
โ”œโ”€โ”€ runs/                       # Training outputs
โ”‚   โ””โ”€โ”€ train/
โ”‚       โ””โ”€โ”€ exp/
โ”‚           โ””โ”€โ”€ weights/
โ”‚
โ””โ”€โ”€ results/                    # Detection outputs
    โ”œโ”€โ”€ annotated_images/
    โ”œโ”€โ”€ summary_*.csv
    โ”œโ”€โ”€ details_*.csv
    โ””โ”€โ”€ netlist_*.csv

๐Ÿ› ๏ธ Requirements

System Requirements

  • OS: Windows 10+, Ubuntu 20.04+, macOS 10.15+
  • Python: 3.8 or higher
  • RAM: 8GB minimum (16GB recommended for training)
  • GPU: CUDA-capable NVIDIA GPU recommended (optional)

Core Dependencies

ultralytics>=8.3.0         # YOLO11
torch>=2.0.0               # PyTorch
opencv-python>=4.8.0       # Computer vision
pandas>=2.0.0              # Data handling
PyMuPDF>=1.23.0           # PDF processing
optuna>=3.0.0             # Hyperparameter optimization

See requirements.txt for complete list.


๐Ÿ“Š Performance

Model Comparison

Model Size Speed mAP50 Best For
YOLO11n 6.2 MB 1.5 ms 39.5% Fast inference
YOLO11s 21.5 MB 2.3 ms 47.0% Production (recommended)
YOLO11m 49.7 MB 4.4 ms 51.5% High accuracy
YOLO11l 86.9 MB 6.2 ms 53.4% Maximum accuracy

Processing Speed

  • PDF Conversion: ~2-5 seconds per page (400 DPI)
  • Detection: ~50-200 ms per image (depends on model)
  • Batch Processing: 3x faster with parallel processing
  • Training: ~1-3 hours for 100 epochs (with GPU)

๐Ÿ“– Documentation

Quick Links

Tutorials


๐ŸŽ“ Examples

Example 1: Electrical Takeoff

from YOLOplanDetector import YOLOplanDetector

# Initialize detector
detector = YOLOplanDetector('models/electrical.pt', conf_threshold=0.25)

# Process drawing
result = detector.detect_symbols('electrical_plan.pdf', save_annotated=True)

# Print results
print(f"Total symbols: {result['total_detections']}")
for symbol, count in result['class_counts'].items():
    print(f"  {symbol}: {count}")

# Export
detector.export_results([result], 'takeoff_results', format='excel')

Example 2: Batch Processing

# Process entire project folder
python YOLOplanDetector.py \
    --model models/electrical.pt \
    --source "project_plans/*.pdf" \
    --output project_takeoff \
    --dpi 400 \
    --conf 0.3 \
    --export all

Example 3: Generate Synthetic Training Data

from ImagePreprocessor import ImagePreprocessor

preprocessor = ImagePreprocessor()
preprocessor.generate_synthetic_schematic(
    class_names=['outlet', 'switch', 'light', 'panel'],
    output_dir='datasets/synthetic',
    num_images=200,
    img_size=640
)

๐Ÿงช Testing

Run Tests

# Install testing dependencies
pip install pytest pytest-cov

# Run all tests
pytest test_yoloplan.py -v

# Run with coverage
pytest test_yoloplan.py --cov=. --cov-report=html

# Run specific test
pytest test_yoloplan.py::TestImagePreprocessor -v

Test Coverage

  • โœ… Image preprocessing
  • โœ… Dataset splitting & analysis
  • โœ… Label format conversion
  • โœ… Detection pipeline
  • โœ… Training configuration
  • โœ… End-to-end workflows

๐ŸŽฏ Roadmap

v1.1.0 (Current - October 2025)

  • โœ… Fixed critical bugs
  • โœ… Comprehensive error handling
  • โœ… Logging system
  • โœ… Test suite
  • โœ… Performance optimizations

v1.2.0 (Planned)

  • ๐Ÿ”œ Advanced wire tracing for netlists
  • ๐Ÿ”œ Real-time detection (webcam/video)
  • ๐Ÿ”œ Web dashboard for results
  • ๐Ÿ”œ API endpoint generation
  • ๐Ÿ”œ Database export support

v2.0.0 (Future)

  • ๐Ÿ”ฎ Multi-discipline symbol libraries
  • ๐Ÿ”ฎ Cloud training infrastructure
  • ๐Ÿ”ฎ BIM integration (Revit, AutoCAD)
  • ๐Ÿ”ฎ Mobile app support

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Add tests for new features
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Development Setup

# Clone your fork
git clone https://github.com/YOUR_USERNAME/YOLOplan.git

# Install dev dependencies
pip install -r requirements.txt
pip install pytest pytest-cov black flake8 mypy

# Run tests before committing
pytest test_yoloplan.py -v

๐Ÿ“„ License

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

YOLO11 is licensed under AGPL-3.0 for open-source use. For commercial use, consider the Ultralytics Enterprise License.


๐Ÿ™ Acknowledgments

  • Ultralytics for YOLO11
  • The open-source computer vision community
  • All contributors and users of YOLOplan

๐Ÿ“ž Support & Contact

Get Help

Connect


๐Ÿ“ˆ Citation

If you use YOLOplan in your research or projects, please cite:

@software{yoloplan2025,
  author = {Alfonso Davila},
  title = {YOLOplan: Automated Symbol Detection for Technical Drawings},
  year = {2025},
  url = {https://github.com/DynMEP/YOLOplan},
  version = {1.1.0},
  note = {YOLO11 implementation for MEP symbol detection}
}

โญ Star History

If YOLOplan helps your work, please consider giving it a star! โญ


๐Ÿ’– Support This Project

h1pot



Your support helps maintain and improve YOLOplan!


"Let's build smarter MEP workflows together! ๐Ÿšง"

Get Started โ€ข Documentation โ€ข Examples โ€ข Contributing

Made with โค๏ธ by Alfonso Davila

About

YOLOplan automates symbol detection and counting in technical drawings (PDF, images, CAD) using advanced YOLO object detection. It streamlines takeoff for electrical, HVAC, and more fast, accurate, and adaptable for noisy or complex plans.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages