Object Matching
Compare detected objects against the enrolled object database
The matching stage compares detected objects against the enrolled database to identify and classify them.
After detection localizes objects in a frame, matching determines which enrolled class each detection belongs to by comparing embeddings.
| Step | Action | Output |
|---|
| 1 | Crop detection | Object region from frame |
| 2 | Extract embedding | Feature vector |
| 3 | Database lookup | Compare against enrolled classes |
| 4 | Similarity scoring | Distance/similarity values |
| 5 | Classification | Best match or unknown |
| Component | Description |
|---|
| Input | Cropped detection region |
| Model | Feature extraction backbone |
| Output | 512-dimensional embedding vector |
| Metric | Formula | Range | Best Match |
|---|
| Cosine Similarity | dot(a,b) / (‖a‖·‖b‖) | [-1, 1] | Highest |
| Euclidean Distance | ‖a - b‖ | [0, ∞) | Lowest |
| Manhattan Distance | Σ|a - b| | [0, ∞) | Lowest |
| Parameter | Default | Description |
|---|
match_threshold | 0.6 | Minimum similarity for match |
unknown_threshold | 0.4 | Below this = unknown |
top_k | 3 | Candidates to consider |
| Scenario | Condition | Action |
|---|
| Strong match | similarity ≥ threshold | Return class label |
| Weak match | below threshold but in range | Return with low confidence |
| No match | below unknown threshold | Mark as unknown |
Efficient similarity search:
| Method | Complexity | Use Case |
|---|
| Linear scan | O(n) | Small databases |
| KD-tree | O(log n) | Medium databases |
| FAISS | O(log n) | Large-scale |
| pgvector | O(log n) | PostgreSQL integration |
| Field | Type | Description |
|---|
class_id | int | Matched class identifier |
class_name | string | Human-readable label |
similarity | float | Match confidence score |
is_known | boolean | True if above threshold |
candidates | array | Top-k alternative matches |
When multiple enrolled classes are similar:
| Strategy | Description |
|---|
| Top-1 | Return highest similarity match |
| Top-k | Return k best candidates |
| Threshold filter | Only return above threshold |
| Confidence delta | Require margin between top matches |
| Factor | Impact | Optimization |
|---|
| Database size | Query time | Use indexing |
| Embedding dimension | Memory | Dimensionality reduction |
| Batch matching | Throughput | Process multiple at once |
| Option | Description |
|---|
| Log only | Record unknown for review |
| Collect samples | Save crops for future enrollment |
| Alert | Trigger notification |
| Ignore | Skip non-matching detections |
| Level | Similarity Range | Interpretation |
|---|
| High | ≥ 0.85 | Very confident match |
| Medium | 0.65 - 0.85 | Likely correct |
| Low | 0.45 - 0.65 | Possible match |
| None | < 0.45 | Unknown object |