CoolFace
Apppublic

n-tan/engineering-drawing-intelligence

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

Engineering Drawing Intelligence (EDI)

A high-performance Computer Vision pipeline designed to extract structured data from complex engineering drawings and blueprints. This system leverages RT-DETR for real-time precision object detection (targeting Tables and Notes) combined with a robust PaddleOCR / EasyOCR multi-method strategy for text extraction.

✨ Key Features

  • Precision Detection: Accurate localization of technical components using state-of-the-art RT-DETR architecture.
  • Hybrid OCR Engine: Modular extraction pipeline optimized for engineering fonts and technical notation.
  • Structured JSON Output: Automatic conversion of visual data into machine-readable formats.
  • Modern Workflow: Fully managed with uv for reproducible and fast environment setup.

🛠 Tech Stack

  • Detection: Ultralytics RT-DETR
  • OCR: PaddleOCR, EasyOCR
  • Processing: OpenCV, NumPy, PyTorch
  • Tooling: Python 3.10+, uv Package Manager

🚀 Quick Start

1. Environment Setup

This project uses uv for high-performance dependency management. If you don't have it, install it here.

bash
# Sync dependencies and create virtual environment
uv sync

# Activate the environment
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

2. Model Weights

The core detection model relies on specialized weights.

  • Download: You can download the trained best.pt file from **Google Drive**.
  • Placement: Ensure the downloaded best.pt file is placed inside the weight/ directory.
Note: These files are typically excluded from Git via .gitignore. Verify their presence before running the pipeline.

3. Execution

To run the complete inference pipeline on input images:

bash
python full_pipeline.py

Results are saved by default in the pipeline_results/ directory:

  • pipeline_output.json: The complete structured dataset.
  • table_*_crop.jpg: Individual crops for visual verification of table extraction.

📁 Project Structure

text
├── app/                 # Core processing logic
│   ├── detection.py     # Object Detection (RT-DETR)
│   ├── ocr.py           # Pre-processing & OCR (Paddle/EasyOCR)
│   └── config.py        # Configuration & Hyperparameters
├── weight/              # Directory for model weights (best.pt)
├── data/                # Input image directory
├── full_pipeline.py     # Main coordination script
├── pyproject.toml       # Dependency definitions
└── README.md            # Project documentation

📈 Model Training

To retrain the RT-DETR model on a new dataset:

python
from ultralytics import RTDETR

# Initialize model
model = RTDETR("rtdetr-l.pt")  # or load your existing checkpoint

# Start training
model.train(data="your_dataset/data.yaml", epochs=100, imgsz=640)

📝 Performance Notes

  • OpenCV & PyTorch: Ensure your system environment supports these libraries.
  • Hardware: While it runs on CPU, GPU acceleration (CUDA) is strongly recommended for real-time OCR and detection performance.