File size: 1,666 Bytes
16d34b9 b42373a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | ---
title: Chassis OCR
emoji: π§
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---
# Chassis OCR Pipeline
Reads engraved chassis numbers from phone images and matches them against barcode-scanned numbers.
## Setup
```bash
pip install -r requirements.txt
```
On Linux you also need:
```bash
sudo apt-get install libzbar0
```
## Project Structure
```
chassis_ocr/
βββ images/
β βββ barcode/ β put your 50 barcode images here
β βββ chassis/ β put your 50 chassis images here (same filenames)
βββ results/ β comparison images + report saved here
βββ preprocess.py β image cleaning pipeline
βββ barcode_scanner.py
βββ ocr.py
βββ evaluate.py β run this
```
## Important β Naming Convention
Barcode and chassis images must have the **same filename** to be paired:
```
images/barcode/001.jpg ββ images/chassis/001.jpg
images/barcode/002.jpg ββ images/chassis/002.jpg
```
## Run
```bash
# Test preprocessing on a single chassis image
python preprocess.py images/chassis/001.jpg
# Test OCR on a single chassis image
python ocr.py images/chassis/001.jpg
# Run full evaluation on all 50 pairs
python evaluate.py
```
## Output
After running `evaluate.py`:
- `results/report.json` β full accuracy breakdown
- `results/*_comparison.jpg` β before/after preprocessing for each image
## Pipeline
```
Barcode image β pyzbar β ground truth string
β
Chassis image β CLAHE β Adaptive threshold Compare β β
Match / β Mismatch
β Morphological ops β PaddleOCR β
```
|