Build Your Own Image Search with AI Object Detection and ElasticSearch

n8n AI Engineering Data Management

Contributed by Sabrina Ramonov 🍄. From the community directory at agents.sabrina.dev, republished with permission and full credit.

This n8n workflow demonstrates how to automate indexing of images to build an object-based image search.

By utilizing a Detr-Resnet-50 Object Classification model, we can identify objects within an image and store these associations in Elasticsearch along with a reference to the image.

How it works

An image is imported into the workflow via HTTP request node. The image is then sent to Cloudflare's Worker AI API where the service runs the image through the Detr-Resnet-50 object classification model.

The API returns the object associations with their positions in the image, labels, and confidence score of the classification. Confidence scores of less than 0.9 are discarded for brevity. The image's URL and its associations are then indexed in an ElasticSearch server ready for searching.

Requirements

- A Cloudflare account with Workers AI enabled to access the object classification model.

- An ElasticSearch instance to store the image URL and related associations.

Extending this workflow

Further enrich your indexed data with additional attributes or metrics relevant to your users. Use a vector store to provide similarity search over the images.

Tools used: ElasticSearch, Cloudflare, AI Agent

Download the workflow template (JSON)

Original tutorial

Want this running in your business? KOBA42 builds and operates automations like this one.