| --- |
| 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 β |
| ``` |
|
|