---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://mixpeek.com/.well-known/search?q={query}"
  method: GET
  documentation: "https://mixpeek.com/llms.txt"
---

1.  [](/)
2.  [Code examples](/recipes)
3.  Image Deduplication Pipeline

Back to code examples

# Image Deduplication Pipeline

Identify near-duplicate and visually similar images in your collection using embedding-based clustering. Groups images by visual similarity, flags duplicates, and provides confidence scores to help clean up redundant content in media libraries and product catalogs.

image

Multi-Stage

[Run in Builder](/build?recipe=image-deduplication)

Python

cURL

import requests

from mixpeek import Mixpeek

client \= Mixpeek(api\_key\="YOUR\_API\_KEY", namespace\="image-library")

API \= "https://api.mixpeek.com/v1"

HEADERS \= {"Authorization": "Bearer YOUR\_API\_KEY", "X-Namespace": "image-library"}

\# 1. A bucket for the library, and a collection that embeds each image

bucket \= client.buckets.create(

    bucket\_name\="image-library",

    bucket\_schema\={"properties": {"image": {"type": "image"}}},

)

collection \= client.collections.create(

    collection\_name\="image\_library",

    source\={"type": "bucket", "bucket\_ids": \[bucket\["bucket\_id"\]\]},

    feature\_extractor\={

        "feature\_extractor\_name": "multimodal\_extractor",

        "version": "v1",

    },

)

client.buckets.upload(

    bucket\["bucket\_id"\],

    blobs\=\[{"property": "image", "type": "image", "data": "s3://your-bucket/images/IMG\_0001.jpg"}\],

)

client.collections.trigger(collection\["collection\_id"\])

\# 2. HDBSCAN with a minimum group size of 2 turns near-duplicates into small,

\#    tight clusters. The SDK has no clusters resource, so this is REST.

cluster \= requests.post(API + "/clusters", headers\=HEADERS, json\={

    "cluster\_name": "near-duplicates",

    "collection\_ids": \[collection\["collection\_id"\]\],

    "cluster\_type": "vector",

    "vector\_config": {

        "feature\_uris": \["mixpeek://multimodal\_extractor@v1/vertex\_multimodal\_embedding"\],

        "clustering\_method": "hdbscan",

        "algorithm\_params": {"min\_cluster\_size": 2},

    },

}).json()

requests.post(API + "/clusters/" + cluster\["cluster\_id"\] + "/execute", headers\=HEADERS, json\={})

\# 3. Once the execution finishes, review the groups

groups \= requests.get(API + "/clusters/" + cluster\["cluster\_id"\] + "/groups", headers\=HEADERS).json()

print(groups\["total\_groups"\], "groups of near-duplicates")

### Feature Extractors

Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

### Retriever Stages

## Frequently asked questions

### What similarity threshold should I use for deduplication?

A threshold of 0.92-0.95 catches near-exact duplicates (resized, recompressed). Lower thresholds (0.80-0.90) catch visually similar but not identical images.

### Does this catch crops and edits of the same image?

Yes. Embedding-based similarity is robust to cropping, color adjustments, watermarking, and minor edits. Heavily modified images may fall below the threshold.

### How does this scale with collection size?

The clustering algorithm uses approximate nearest neighbor search, scaling efficiently to millions of images. Processing time grows sub-linearly with collection size.

## Related code examples and resources

Pages on the same stages, extractors and patterns.

[

Extractor

### Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

Learn more





](/extractors/multimodal)[

Extractor

### Image Embedding

Generate visual embeddings for similarity search and clustering

Learn more





](/extractors/image)[

Extractor

### Face Identity Extractor

Detect, align, and embed faces to 512-D ArcFace vectors across image, video and PDF, using SCRFD for detection.

Learn more





](/extractors/face-identity)[

Recipe

### Image Similarity Search Pipeline

Deploy a visual search engine that finds similar images using state-of-the-art embedding models. Perfect for product catalogs, stock photo libraries, and visual discovery.

Learn more





](/recipes/image-similarity-search)[

Recipe

### Automatic Image Tagging Pipeline

Automatically tag images with objects, scenes, colors, and custom labels using computer vision models. Perfect for DAM systems and media libraries.

Learn more





](/recipes/image-tagging-pipeline)[

Recipe

### E-commerce Product Image Analytics

Analyze product images across your catalog to extract visual attributes, identify trends, detect quality issues, and benchmark against competitors.

Learn more





](/recipes/ecommerce-product-analytics)