build your own image search using ai object detection cdn and elasticsearch
Configured with Edit Image, HTTP Request. Review the connections and setup before adapting this template.
Node categories in this workflow
- Trigger
- Transform
- Web / API
- Code
- Files / media
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| When clicking ‘Test workflow’ | Trigger | Manual Trigger | See node parameters |
| Get Variables | Transform | Edit Fields | See node parameters |
| Get Test Image | Web / API | HTTP Request | See node parameters |
| Gemini 2.0 Object Detection | Web / API | HTTP Request | POST |
| Scale Normalised Coords | Code | Code | See node parameters |
| Draw Bounding Boxes | Files / media | Edit Image | multiStep |
| Get Image Info | Files / media | Edit Image | information |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
googlePalmApi
Workflow notes
Sticky Note
Fig 1. Output of Object Detection
1. Download Test Image
1. Download Test Image
Any compatible image will do (see docs) but best if it isn't too busy or the subjects too obscure. Most importantly, you are able to retrieve the width and height as this is required for a later step.
2. Use Prompt-Based Object Detection
2. Use Prompt-Based Object Detection
We've had generalised object detection before (see my other template using ResNet) but being able to prompt for what you're looking for is a very exciting proposition! Not only could this reduce the effort in post-detection filtering but also introduce contextual use-cases such as searching by "emotion", "locality", "anomolies" and many more!
I found the the output json schema of { "box_2d": { "type": "array", ... } } works best for Gemini to return coordinates.
3. Scale Coords to Fit Original Image
3. Scale Coords to Fit Original Image
According to the Gemini 2.0 overview on how it calculates bounding boxes, we'll have to rescale the coordinate values as they are normalised to a 0-1000 range. Nothing a little code node can't help with!
Q. Why not use the Basic LLM node?
Q. Why not use the Basic LLM node?
At time of writing, Langchain version does not recognise Gemini 2.0 to be a multimodal model.
4. Draw!
4. Draw!
Read more about the Edit Image node
Finally for this demonstration, we can use the "Edit Image" node to draw the bounding boxes on top of the original image. In my test run, I can see Gemini did miss out one of the bunnies but seeing how this is the experimental version we're playing with, it's pretty good to see it doesn't do too bad of a job.
Try it out!
Try it out!
This n8n template demonstrates how to use Gemini 2.0's new Bounding Box detection capabilities your workflows.
The key difference being this enables prompt-based object detection for images which is pretty powerful for things like contextual search over an image. eg. "Put a bounding box around all adults with children in this image" or "Put a bounding box around cars parked out of bounds of a parking space".
How it works
- An image is downloaded via the HTTP node and an "Edit Image" node is used to extract the file's width and height.
- The image is then given to the Gemini 2.0 API to parse and return coordinates of the bounding box of the requested subjects. In this demo, we've asked for the AI to identify all bunnies.
- The coordinates are then rescaled with the original image's width and height to correctl align them.
- Finally to measure the accuracy of the object detection, we use the "Edit Image" node to draw the bounding boxes onto the original image.
Need Help?
Join the Discord or ask in the Forum!
Happy Hacking!
build your own image search using ai object detection cdn and elasticsearch
build your own image search using ai object detection cdn and elasticsearch
Purpose and structure
This folder contains the build your own image search using ai object detection cdn and elasticsearch workflow. Its executable nodes use code, editImage, httpRequest, manualTrigger, set. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
When clicking ‘Test workflow’
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0665_Code_Editimage_Update_Webhook.json MIT; preserve source notices.