KatInterview

Near-Duplicate Image Matching Pipeline for Rights Enforcement

Machine LearningModel answer
MediumModel answerMachine Learningml-system-designcomputer-visionann-search

Last updated

Design a pipeline that checks every uploaded image against a huge catalog of protected works, tolerating edits and partial reuse, at high throughput, under a tight latency limit, with a review workflow.

Scenario

You work on a photo-sharing platform that receives about 10,000 new image uploads every second. A rights-management team maintains a catalog of 100 million protected images (film stills, stock and professional photography, artwork). Your task is to design a system that decides whether an uploaded image reuses protected material.

What the system must do

  • Detect uploads that match a protected work, even when the uploader has resized it, applied color filters, cropped it, or made small edits.
  • Expose an API so internal reviewers can inspect and act on flagged uploads.

Constraints

  • Latency: the full detection pipeline must return a verdict within 500 ms of upload.
  • Catalog size: 100 million reference images.
  • Resilience: the system should hold up against common evasion tricks such as added noise or overlaid watermarks.

What your answer should cover

  1. Representation: how do you encode images so that similarity lookups are fast and survive edits?
  2. Serving architecture: how do you sustain 10k uploads per second?
  3. Two-stage matching: describe a fast, recall-oriented candidate step followed by a slower, precision-oriented verification step.
  4. Partial reuse: how do you catch collages, or uploads that contain only a piece of a protected work (or the reverse)?
  5. Precision vs. recall: how do you trade off wrongly accusing users against missing real infringements, and how does that shape the actions the system takes?

State your assumptions and back them with rough numbers.

Hints

Hint 1

Combine several signals instead of one: a cheap perceptual hash for near-exact copies, a learned embedding trained with heavy augmentation for edited copies, and local keypoint features for final verification.

Hint 2

Do the memory math before choosing an index: 100M vectors at full precision is far too large to replicate everywhere, but product quantization shrinks it dramatically. Also count how many ANN queries each upload generates once you add crops.

Hint 3

For partial matches, query with a multi-scale grid of crops (and index some crops of the references too), then use geometric verification such as RANSAC on local features to confirm and localize the match.

Hint 4

Do not use a single threshold. Define tiers such as auto-action at very high calibrated confidence, human review in the middle band, and log-only below it, and tie each tier to the cost of a false claim.