Skip to content

About

Technical drawing OCR: preprocessing, recognition experiments, and a runnable synthetic demo with tests.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Engineering Drawing OCR

Technical drawing OCR: preprocessing, recognizer experiments, and evaluation. My contribution covered part of a larger private project, not the full application.

Engineering drawing OCR pipeline

Context

This repository documents part of a private project focused on text recognition in technical drawings. The public version is intentionally limited: it shows architecture, preprocessing ideas, model structure, and evaluation workflow without publishing private drawings, labeled crops, model weights, or full application code.

Run the Synthetic Demo

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-demo.txt
python demo.py
python -m pytest -q

The demo creates a drawing from scratch and runs the public preprocessing pipeline. Inspect outputs/synthetic-drawing.png, outputs/preprocessed.png, outputs/comparison.png, and outputs/report.json.

Synthetic drawing before and after preprocessing

Expected result: a 1000 x 600 single-channel image containing only 0 and 255, plus line-detection and deskew diagnostics. Exact diagnostics may vary between OpenCV versions. This demonstrates preprocessing, not text recognition or OCR accuracy; no trained model is downloaded. The CRNN architecture is a separate reference requiring PyTorch, not part of this demo.

Tests cover RGB, RGBA, grayscale, palette and one-bit inputs, blank pages, input immutability, repeatability, deskew on upright and rotated drawings, and exported artifacts. GitHub Actions runs the same demo and retains its output for inspection.

The reference skew estimator uses near-horizontal line segments within 15 degrees of level. It is a compact baseline, not a general orientation detector; rotated title blocks and drawings without long horizontal lines require a different strategy.

What It Shows

  • image preprocessing for scanned drawings;
  • deskew and noise reduction before OCR;
  • region-of-interest handling for title-block style areas;
  • integration approach for switching between an OCR engine and a custom recognizer;
  • CRNN + CTC model structure for narrow technical text lines;
  • synthetic-data and real-crop training loop design;
  • evaluation notes for character error rate and manual verification.

Public Scope

Included:

  • reference preprocessing code;
  • reference CRNN model structure;
  • architecture notes;
  • training and evaluation notes;
  • privacy and publication boundaries.

Not included:

  • private source repository;
  • real engineering drawings or PDFs;
  • labeled production crops;
  • model checkpoints;
  • full GUI / database application code;
  • client-specific data, paths, logs, or business context.

Repository Structure

assets/
  drawing-ocr-pipeline.svg
docs/
  01-architecture.md
  02-training-loop.md
  03-publication-boundaries.md
src/
  preprocessing_reference.py
  crnn_reference.py

Status

Public limited-code case study. The original work included a broader local application and experimental model training pipeline; this repository keeps only the parts that are safe and useful to show publicly.

About

Technical drawing OCR: preprocessing, recognition experiments, and a runnable synthetic demo with tests.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages