feat: VIN Photo OCR Pipeline (#67) #75

Merged
egullickson merged 1 commits from issue-67-vin-ocr-pipeline into main 2026-02-02 01:36:27 +00:00
Owner

Summary

Implements VIN-specific OCR extraction in the OCR service with optimized preprocessing and validation.

  • Add POST /extract/vin endpoint for VIN extraction from photos
  • VIN-optimized preprocessing: HEIC conversion, grayscale, deskew, CLAHE, denoise, adaptive threshold
  • VIN validator with check digit validation and common OCR error correction (I->1, O->0, Q->0)
  • VIN extractor using multiple Tesseract PSM modes (6/7/8) for robustness
  • Response includes confidence score, bounding box, and alternative candidates
  • Comprehensive unit tests for validator and preprocessor
  • Integration tests for VIN extraction endpoint

Files Changed

  • ocr/app/validators/vin_validator.py - VIN validation with check digit and OCR error correction
  • ocr/app/preprocessors/vin_preprocessor.py - VIN-optimized image preprocessing
  • ocr/app/extractors/vin_extractor.py - VIN extraction with pattern matching
  • ocr/app/routers/extract.py - Added /extract/vin endpoint
  • ocr/app/models/schemas.py - Added VinExtractionResponse model

Closes #67

Test plan

  • Unit tests pass for VIN validator
  • Unit tests pass for VIN preprocessor
  • Integration tests pass for VIN extraction endpoint
  • Test with clear VIN sticker photo (>90% confidence expected)
  • Test with angled VIN plate (>80% confidence expected)
  • Test with dashboard VIN through windshield (>70% confidence expected)
  • Processing time <3 seconds verified

Generated with Claude Code

## Summary Implements VIN-specific OCR extraction in the OCR service with optimized preprocessing and validation. - Add `POST /extract/vin` endpoint for VIN extraction from photos - VIN-optimized preprocessing: HEIC conversion, grayscale, deskew, CLAHE, denoise, adaptive threshold - VIN validator with check digit validation and common OCR error correction (I->1, O->0, Q->0) - VIN extractor using multiple Tesseract PSM modes (6/7/8) for robustness - Response includes confidence score, bounding box, and alternative candidates - Comprehensive unit tests for validator and preprocessor - Integration tests for VIN extraction endpoint ### Files Changed - `ocr/app/validators/vin_validator.py` - VIN validation with check digit and OCR error correction - `ocr/app/preprocessors/vin_preprocessor.py` - VIN-optimized image preprocessing - `ocr/app/extractors/vin_extractor.py` - VIN extraction with pattern matching - `ocr/app/routers/extract.py` - Added `/extract/vin` endpoint - `ocr/app/models/schemas.py` - Added VinExtractionResponse model Closes #67 ## Test plan - [ ] Unit tests pass for VIN validator - [ ] Unit tests pass for VIN preprocessor - [ ] Integration tests pass for VIN extraction endpoint - [ ] Test with clear VIN sticker photo (>90% confidence expected) - [ ] Test with angled VIN plate (>80% confidence expected) - [ ] Test with dashboard VIN through windshield (>70% confidence expected) - [ ] Processing time <3 seconds verified Generated with [Claude Code](https://claude.com/claude-code)
egullickson added 1 commit 2026-02-02 01:31:56 +00:00
feat: add VIN photo OCR pipeline (refs #67)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 31s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 31s
Deploy to Staging / Verify Staging (pull_request) Successful in 2m19s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
54cbd49171
Implement VIN-specific OCR extraction with optimized preprocessing:

- Add POST /extract/vin endpoint for VIN extraction
- VIN preprocessor: CLAHE, deskew, denoise, adaptive threshold
- VIN validator: check digit validation, OCR error correction (I->1, O->0)
- VIN extractor: PSM modes 6/7/8, character whitelist, alternatives
- Response includes confidence, bounding box, and alternatives
- Unit tests for validator and preprocessor
- Integration tests for VIN extraction endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit 944a5963ab into main 2026-02-02 01:36:27 +00:00
egullickson deleted branch issue-67-vin-ocr-pipeline 2026-02-02 01:36:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#75