---
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"
---

What is Mixpeek?

[Back to Blog](/blog)

[](https://twitter.com/intent/tweet?text=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB&url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery)[](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery&title=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB)[](https://www.reddit.com/submit?url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery&title=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB)

This was originally in our newsletter.

Get Updates

Dec 13, 2024•4 min read

# Reverse Image Search with CLIP and MongoDB

AI-powered image discovery app using Mixpeek's multimodal SDK and MongoDB's $vectorSearch. Features deep learning, vector embeddings, and KNN search for advanced visual content management.

![Reverse Image Search with CLIP and MongoDB](https://blog.mixpeek.com/content/images/2024/08/Xnapper-2024-08-19-10.54.39.jpg)

Search

TABLE OF CONTENTS

The team at Shimmer built an innovative AI-powered image discovery app showcasing Mixpeek multimodal understanding and MongoDB $vectorSearch.

This writeup will explore the architecture, implementation, and key features of Shimmer.

## Architecture Overview

graph TD A\[User\] -->|Interacts with| B\[Shimmer Web App\] B -->|Sends requests| C\[Backend Server\] C -->|Uses| D\[Mixpeek SDK\] D -->|Generates embeddings  
and metadata| C C -->|Stores/Retrieves data| E\[MongoDB\] E -->|Performs $vectorSearch| E subgraph "Frontend" A B end subgraph "Backend" C D end subgraph "Database" E end style A fill:#f9f,stroke:#333,stroke-width:2px style B fill:#bbf,stroke:#333,stroke-width:2px style C fill:#dfd,stroke:#333,stroke-width:2px style D fill:#fdd,stroke:#333,stroke-width:2px style E fill:#ddf,stroke:#333,stroke-width:2px

Shimmer consists of three main components:

1.  **Frontend**: A responsive web application built with HTML, CSS, and JavaScript
2.  **Backend**: Powered by Mixpeek's multimodal understanding SDK
3.  **Database**: MongoDB with $vectorSearch for similarity search

## Implementation Details

### 1\. Image Indexing

When a new image is added to the system, it goes through the following process:

1.  The image is uploaded to the Mixpeek API
2.  Mixpeek processes the image, generating:
    *   Vector embedding
    *   Caption
    *   Metadata extraction
3.  The processed data is stored in MongoDB

 Your browser does not support the video tag.

Here's a sample of the MongoDB document structure with the data extracted via Mixpeek AI:

```json
{
  "_id": { "$oid": "66c2350bd8a79aee18e80e25" },
  "created_at": { "$date": "2024-08-18T17:53:15.387Z" },
  "embedding": [0.18961688876152039, -0.05179230123758316, ...],
  "caption": "A small wooden boat floating on a serene lake surrounded by misty mountains at sunset",
  "file_url": "https://mixpeek-api.s3.us-east-2.amazonaws.com/ix-0Sqm__ZbVpAIHRkOJIyqEyhGEaNXs2dvY6WXJ6o6GkEzI0lXfR7S-qBimKKhI_OS8Bw/shimmer/a26b0f1b-6ada-4ab8-8536-f827582e4859.jpg",
  "file_id": "a26b0f1b-6ada-4ab8-8536-f827582e4859",
  "collection_id": "shimmer",
  "metadata": {
    "url": "https://scontent-lga3-1.cdninstagram.com/v/t51.29350-15/455897686_812566104022598_2572383807345858400_n.jpg?stp=dst-jpg_e35&_nc_ht=scontent-lga3-1.cdninstagram.com&_nc_cat=102&_nc_ohc=WgWr7a2ok-8Q7kNvgEBReYB&edm=AEhyXUkBAAAA&ccb=7-5&ig_cache_key=MzQzNTI2ODU2NDU0NDQ5NTI2Ng%3D%3D.2-ccb7-5&oh=00_AYC2dV7pLOxfcPrYfoKX7dAVwXFqeHsqGfEWjVYi9xbXiA&oe=66C7F7B3&_nc_sid=8f1549",
    "ai_analysis": {
      "scene_classification": [
        {"label": "landscape", "confidence": 0.98},
        {"label": "sunset", "confidence": 0.95},
        {"label": "lake", "confidence": 0.92}
      ],
      "object_detection": [
        {"label": "boat", "confidence": 0.89, "bounding_box": [0.2, 0.6, 0.4, 0.3]},
        {"label": "mountain", "confidence": 0.87, "bounding_box": [0.1, 0.1, 0.8, 0.5]},
        {"label": "tree", "confidence": 0.76, "bounding_box": [0.05, 0.4, 0.2, 0.3]}
      ],
      "color_analysis": {
        "dominant_colors": [
          {"color": "#FF7F50", "percentage": 0.35},
          {"color": "#4682B4", "percentage": 0.25},
          {"color": "#2F4F4F", "percentage": 0.20}
        ],
        "average_color": "#A0522D"
      },
      "emotion_analysis": {
        "overall_mood": "peaceful",
        "emotions": [
          {"emotion": "tranquility", "intensity": 0.85},
          {"emotion": "awe", "intensity": 0.72},
          {"emotion": "serenity", "intensity": 0.68}
        ]
      },
      "artistic_style": {
        "style": "landscape photography",
        "influences": ["Ansel Adams", "Peter Lik"],
        "techniques": ["long exposure", "golden hour lighting"]
      },
      "image_quality": {
        "sharpness": 0.92,
        "exposure": 0.88,
        "noise_level": 0.05,
        "dynamic_range": 0.85
      },
      "semantic_segmentation": {
        "sky": 0.30,
        "water": 0.25,
        "mountains": 0.20,
        "vegetation": 0.15,
        "boat": 0.05,
        "other": 0.05
      },
      "text_detection": [],
      "estimated_location": {
        "type": "mountain lake",
        "confidence": 0.85,
        "possible_locations": [
          {"name": "Lake Louise, Canada", "confidence": 0.6},
          {"name": "Lake Bled, Slovenia", "confidence": 0.4}
        ]
      }
    }
  }
}
```

### 2\. Image Search

Shimmer uses MongoDB's $vectorSearch for efficient KNN search. The search query looks like this:

## Run this on your own content

Point Mixpeek at the storage you already have and search your video, images, audio, and documents the way this post describes. Build starts at $25/mo for up to 1M vectors.

[Search your own files](https://studio.mixpeek.com/namespaces/create?mode=managed&utm_source=homepage&utm_medium=blog_onramp_mid&utm_campaign=mvs_onramp)[Talk to us](/demo)

```json
{
  "$vectorSearch": {
    "index": "vector_index",
    "filter": filter_query,
    "path": "embedding",
    "queryVector": embedding,
    "numCandidates": 100 * page,
    "limit": 100 * page
  }
}
```

This query allows for:

*   Filtering based on metadata
*   Efficient similarity search using vector embeddings
*   Pagination for large result sets

### 3\. Frontend Implementation

The frontend is built using HTML, CSS, and JavaScript. Here's a snippet of the JavaScript code that handles image rendering and infinite scrolling:

```javascript
class GalleryManager {
  constructor() {
    this.isLoading = false;
    this.itemsPerPage = 12;
    this.currentFetcher = new ListFilesFetcher();
  }

  async fetchImages() {
    if (this.isLoading) return;
    this.isLoading = true;
    this.showLoader();

    try {
      const data = await this.currentFetcher.fetch();
      if (data.results) {
        await this.displayImages(data.results);
      } else {
        console.error('Unexpected data structure:', data);
      }
    } catch (error) {
      console.error('Error fetching images:', error);
    } finally {
      this.isLoading = false;
      this.hideLoader();
    }
  }

  async displayImages(images) {
    // ... (code to display images in the gallery)
  }

  handleScroll() {
    const scrollPosition = window.innerHeight + window.scrollY;
    const documentHeight = document.documentElement.scrollHeight;
    const threshold = 200;

    if (scrollPosition >= documentHeight - threshold && this.currentFetcher.hasNextPage()) {
      this.fetchImages();
    }
  }

  // ... (other methods)
}
```

This code manages the image gallery, handles infinite scrolling, and dynamically loads images as the user scrolls.

## Key Features and Benefits

1.  **Image Search**: Utilizes vector embeddings and KNN search for fast and accurate image retrieval.
2.  **Multimodal Understanding**: Leverages Mixpeek's SDK to generate rich metadata, including captions and vector embeddings.
3.  **Scalability**: MongoDB's $vectorSearch allows for efficient searching even with large image collections.
4.  **Responsive UI**: The frontend provides a smooth user experience with infinite scrolling and dynamic image loading.

 Your browser does not support the video tag.

## Why Shimmer is Useful

Shimmer revolutionizes image discovery by:

1.  **Enabling Visual Search**: Users can find similar images based on visual content, not just text descriptions.
2.  **Improving Content Organization**: Automatically generated captions and metadata help in better categorization and retrieval of images.
3.  **Enhancing User Experience**: The intuitive interface and efficient search capabilities make image exploration enjoyable and productive.

Aesthetic-minded creators (like myself, hehe) can then create custom feeds of their posts: [https://shimmer.so/ethan.codes](https://web.archive.org/web/20250706143831/https://shimmer.so/ethan.codes)

## Other Use Cases for Image Discovery

1.  **Medical Imaging Analysis**:  
    Enable radiologists to quickly find similar X-rays or MRIs, improving diagnosis accuracy and speed. This could potentially save lives by identifying critical conditions earlier.
2.  **Retail Product Recommendation**:  
    Implement visual search in e-commerce platforms, allowing customers to find products similar to an image they upload. This can significantly boost sales and improve customer satisfaction.
3.  **Satellite Imagery for Climate Change Research**:  
    Analyze vast archives of satellite images to identify and track changes in landscapes over time, aiding in climate change research and environmental monitoring.

These use cases demonstrate the versatility and potential impact of AI-powered image discovery across various industries, showcasing how technology like Shimmer can drive innovation and efficiency in critical sectors.

[Build your Own](https://mixpeek.com/start?ref=blog.mixpeek.com)

[ES

Ethan Steininger

Former lead of MongoDB's Search Team, Ethan noticed the most common problem customers faced was building indexing and search infrastructure on their S3 buckets. Mixpeek was born.



](/blog/authors/ethan)

## Run this on your own content

Point Mixpeek at the storage you already have and search your video, images, audio, and documents the way this post describes. Build starts at $25/mo for up to 1M vectors.

[Search your own files](https://studio.mixpeek.com/namespaces/create?mode=managed&utm_source=homepage&utm_medium=blog_onramp_end&utm_campaign=mvs_onramp)[Talk to us](/demo)

## Continue Learning

[

![How to Build a Multimodal Search Engine in 2025](https://mixpeek.com/og-image.png)

### How to Build a Multimodal Search Engine in 2025

A practical guide to building search that works across text, images, video, and audio using shared embedding spaces and retrieval pipelines.

Read More





](/blog/how-to-build-multimodal-search-engine)[

![The Best Twelve Labs Alternative for Self-Hosted Video AI: 2026 Guide](https://blog.mixpeek.com/content/images/2026/01/Xnapper-2026-01-26-07.40.34.jpg)

### The Best Twelve Labs Alternative for Self-Hosted Video AI: 2026 Guide

Looking for a Twelve Labs alternative? Compare Mixpeek's self-hosted video AI platform with pricing, features, and a complete migration guide.

Read More





](/blog/twelve-labs-alternative)

### Author

ES

Ethan Steininger

![Mixpeek Icon](/brand/logo-dark-icon.webp)

#### Multimodal Search, On Demand

Index, retrieve, and reason over videos, images, audio, and docs, all from a single API.

[Start Building](/start)

### Share

[](https://twitter.com/intent/tweet?text=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB&url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery)[](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery&title=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB)[](https://www.reddit.com/submit?url=https%3A%2F%2Fmixpeek.com%2Fblog%2Fai-image-discovery&title=Reverse%20Image%20Search%20with%20CLIP%20and%20MongoDB)