Назад к подготовке

Metric learning для сравнения двух машин по фото

Metric learning для сравнения двух машин по фото

Ответить самому

Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.

Загрузка

Короткий ответ

Normalize comparable views, match angles, learn embeddings with hard positives and hard negatives, aggregate per-view similarities, and calibrate for high precision on obvious visual mismatches.

Полный разбор

Break the problem into view normalization and comparison. First classify or infer photo angles so front, side, rear and interior views are compared to similar views. Crop or normalize away background when possible, because the model should focus on vehicle identity and visible details.

Then train an embedding model with metric learning. Positives are different photos of the same vehicle, while hard negatives should be close in make, model, color or trim but differ in visible details. Random negatives are too easy and will overstate quality. Triplet, contrastive or supervised contrastive losses are reasonable choices.

At serving time, compute cosine similarities for matched view pairs and aggregate them with a small model or calibrated rules. Evaluate on a deliberately hard dataset and report precision/recall at the threshold used for manual review or automatic action. Thin differences may be impossible from photos, so define the product use case as surfacing likely mismatches, not proving identity.

Теория

Metric learning is useful when the label is pairwise similarity and the serving system needs nearest-neighbor or pair-comparison behavior.

Типичные ошибки

  • Train only on random negative pairs.
  • Compare unmatched angles directly.
  • Ignore background, lighting and crop normalization.
  • Report average quality without separating obvious and subtle mismatches.

Как отвечать на собеседовании

  • Explicitly mention angle matching before metric learning.
  • Explain how hard negatives are mined or labeled.