Warehouse Label Matching From Existing Text Inference

Job ID: 40511239

Budget: $250 – $750 USD

# Freelancer Requirement: Warehouse Label Matching From Existing Text Inference

## Project Context
We already have these components working in production:
- QR code detection
- Barcode detection
- Text detection / OCR inference

We do **not** need a new OCR model or a new QR/barcode detector.

The required work is to build/improve a **warehouse label matching module** that takes existing OCR text results and matches them to warehouse label records in our inventory data.

## Goal
Given OCR text detections from images, match text candidates to the correct warehouse label with high precision and practical recall, and return ranked matches with confidence and explainability.

## In Scope
- Use existing text inference outputs (detected text, confidence, bounding boxes) as input.
- Normalize noisy OCR strings (e.g., O/0, I/1, B/8, S/5 confusion).
- Match OCR text candidates to warehouse labels in inventory.
- Support exact and fuzzy/partial matching.
- Return top-N ranked candidates with confidence score and match reason.
- Handle ambiguity (multiple similar labels) and produce confidence flags.
- Provide clear thresholds/configs for production tuning.
- Integrate into the current Python pipeline with minimal disruption.

## Out of Scope
- Building a new OCR/text detection model.
- Building or replacing QR/barcode pipelines.
- UI/frontend work.
- Full data platform redesign.

## Existing Inputs and Data
Expected OCR input per text detection (already available):
- `text`: OCR text string
- `confidence`: OCR confidence
- `bbox`: bounding box coordinates

Data we will provide to the freelancer for implementation and validation:
- A representative set of real inference results (JSON/text outputs)
- Original images from production-like runs
- Relevant image crops for difficult label regions (including split/wavy labels)
- A copy/snapshot of actual warehouse inventory records to match against (with required label fields)

Expected inventory/label fields (examples):
- `LicensePlateNumber` / `license_plate_number`
- `ItemNumber`
- `Location`
- Other metadata used for tie-breaking and audit

## Functional Requirements
1. Candidate Extraction
- Parse OCR text detections and generate normalized label candidates.
- Support fragmented or partial label reads.
- Reconstruct labels from split OCR fragments when text is broken into multiple detections (for example wavy/curved labels or damaged print).
- Use geometric and text heuristics to group nearby fragments (same row/line, overlap/proximity, reading order) and generate merged candidates.
- Try multiple join strategies (left-to-right concatenation, separator removal, OCR-corrected merge) before matching.

2. Matching Engine
- Perform exact pattern match where possible.
- Perform fuzzy/partial matching for incomplete text.
- Match both single-fragment and merged-fragment candidates.
- Score matches with a composite method (string similarity, edit distance, positional weighting, sequence proximity when applicable).
- Return top 3-10 matches per candidate with scores.

3. Confidence + Ambiguity Handling
- Assign confidence tiers (for example: HIGH, MEDIUM, LOW, AMBIGUOUS).
- Detect ambiguous prefix/similar-label cases and downgrade confidence.
- If sequential context/history is available, use it as an optional boost.

4. Output Contract
For each accepted text-derived match, return:
- matched label
- source type (exact/fuzzy)
- confidence score
- confidence flag
- reason/explanation (why this was selected)
- linked inventory metadata
- candidate construction metadata (single OCR text vs merged from fragments, and which fragment indices were joined)

5. Fallback Behavior
- If no reliable match exists above threshold, return `NO_MATCH` with debug info.
- Never overwrite higher-priority matches from QR/barcode flows.

## Non-Functional Requirements
- Deterministic results for same input.
- Configurable thresholds via environment/config values.
- Efficient runtime suitable for Lambda-style execution.
- Logging for observability and debugging.
- Unit-testable design with pure matching functions.

## Deliverables
1. Production-ready Python module
- Clean, documented code for normalization + matching + ranking.

2. Integration changes
- Hooked into current inference pipeline where OCR text is already processed.
- Backward-compatible output structure where feasible.

3. Test suite
- Unit tests for exact, fuzzy, ambiguous, and no-match cases.
- Fixture-based tests using representative warehouse labels and OCR noise patterns.
- Include tests where true labels are split across 2-3 OCR detections and must be joined to match correctly.

4. Evaluation report
- Precision/recall-style metrics on provided sample set.
- Error analysis: false positives vs false negatives.
- Recommended threshold defaults and rationale.
- Validation must be performed on the provided real inference results, images, crops, and warehouse inventory snapshot (not only synthetic examples).

5. Handover notes
- Configuration guide
- How to run tests
- How to tune thresholds safely

## Acceptance Criteria
- Correctly matches known sample labels from OCR outputs at agreed target accuracy.
- Ambiguous matches are flagged instead of silently misclassified.
- No regressions to existing QR/barcode pipelines.
- Code passes tests and is deployable in current repo structure.
- Split-text labels (broken OCR regions) are correctly reconstructed and matched in agreed sample scenarios.

## Suggested Technical Approach
- Text normalization layer for OCR artifacts.
- Fragment grouping + reconstruction layer before matching (spatial clustering + reading-order join).
- Pattern-aware matcher for known label formats.
- Composite scoring combining:
- normalized string similarity
- weighted edit distance
- suffix/prefix sensitivity
- optional sequential proximity (if labels are sequential)
- Rank + threshold + confidence policy layer.

## Timeline and Commercial Terms
- Engagement type: **Fixed price only** (no hourly proposals).
- Priority: **ASAP delivery**.
- Expected start: immediately after award.
- Freelancer must propose a fast delivery plan with concrete dates.
- Preferred target: first working version in 2-4 days, final handover in 5-7 days (unless a justified alternative is approved).

## Skills Required
- Strong Python experience
- OCR post-processing and noisy text matching
- Similarity algorithms (Levenshtein / weighted scoring)
- Practical MLOps mindset for production inference pipelines
- Experience with AWS Lambda/S3-style workflows is a plus

## Proposal Instructions for Freelancer
Please include in your proposal:
- Similar projects where you matched noisy OCR text to structured inventory labels
- Proposed scoring/matching strategy
- Testing strategy and an **ASAP** timeline with dates
- **Fixed-price quote** with clear scope assumptions (no hourly quote)
- Any assumptions or risks you see in this scope