Implement a robust K-Nearest Neighbors (KNN) image classifier using this advanced n8n workflow. Integrate Voyage AI multimodal embeddings and Qdrant vector storage to automate visual classification tasks.
Download this n8n workflow template and start using it instantly.
This sophisticated n8n workflow addresses the challenge of real-time image classification without relying on heavy deep learning models for inference. By utilizing the K-Nearest Neighbors (KNN) algorithm implemented via a Qdrant vector database, the n8n workflow quickly finds the closest neighbors to an input image's vector embedding.
The logic incorporates a crucial element: a tie-breaking loop. If the initial majority vote among neighbors results in a tie between the top two classes (e.g., 5 'forest' and 5 'beach'), the n8n template automatically increases the number of neighbors (limitKNN) and re-queries the database, ensuring accurate and definitive classification. This robust n8n node combination makes deploying highly accurate visual recognition systems simple and efficient.
This specialized n8n template starts when the Execute Workflow Trigger receives an image URL, typically called as a tool from another automation.
land-use), and the initial K value (limitKNN, set to 10).Query Qdrant n8n node performs a nearest neighbor search using the generated vector, retrieving the top limitKNN closest pre-labeled data points and their associated payloads (class labels).Code n8n node tallies the classes of the retrieved neighbors to perform a majority vote and determine the most frequent class.Check tie n8n node evaluates if the top two results have an equal number of votes. If a tie is detected and the search limit is under 100, the n8n workflow enters a self-correction loop.Increase limitKNN n8n node increments the neighbor count by 5, and the process repeats (Step 3). This increases the sample size until a clear majority is established.Return class n8n node outputs the definitive classification result to the calling n8n workflow.Voyage API for the Embed image n8n node. This requires your Voyage AI API key for access to the multimodal embedding service.QdrantApi account for the Query Qdrant n8n node, ensuring it has access to your cloud cluster.land-use in the included settings) containing image embeddings and their corresponding class labels (payload: landscape_name). You must run a prior n8n workflow or script to upload your image dataset (such as the lands dataset) and generate embeddings beforehand.Execute Workflow Trigger, receiving the image URL in the input payload from a parent n8n automation. Execute Workflow Trigger: The initial n8n trigger for this tool, designed to receive input data, specifically the imageURL.
Embed image (HTTP Request): Utilizes the Voyage AI multimodal API (voyage-multimodal-3) to generate a vector embedding for the input image URL. This critical n8n node uses custom authentication.
Qdrant variables + embedding + KNN neigbours (Set): An n8n node that combines the generated ImageEmbedding with the necessary Qdrant configuration parameters, including the collection name and the initial number of neighbors (limitKNN=10).
Query Qdrant (HTTP Request): Queries the specified Qdrant collection using the embedding vector. It performs the nearest neighbor search and ensures that the classification payload data is returned.
Propagate loop variables (Set): Prepares the data structure for the loop and passes the search results to the classification logic.
Majority Vote (Code - Python): A custom Python n8n node implementing the KNN classification logic. It uses Python's collections.Counter to perform a majority vote on the returned landscape_name payloads.
Check tie (If): The flow control n8n node that determines if a tie exists between the top two classes. If a tie is found and the iteration limit (100) is not reached, it redirects the flow to increase K.
Increase limitKNN (Set): If a tie is detected, this n8n node increases the limitKNN value by 5 before looping back to re-query Qdrant.
Use this comprehensive n8n workflow to automatically sync Jotform webinar registrations to KlickTipp, handling data cleanup, date conversion, URL validation, and dynamic tag creation. A perfect n8n template for marketing automation.

Automate your JotForm sales pipeline using this advanced n8n workflow. Sync orders to Google Sheets, generate Zoho Invoices, and send immediate Telegram confirmations, managing Chat ID acquisition seamlessly.

Master data integration in your n8n workflow. This n8n templates guide demonstrates using the n8n node Merge for Inner Join, Left Join, and Union All operations on different datasets.

Automate your RAG system updates. This n8n workflow watches Google Drive changes, extracts text, generates OpenAI embeddings, and updates your Supabase vector database instantly.

Automate monitoring new mechanical keyboard Interest Checks and Group Buys from GeekHack forums. This n8n workflow uses RSS, custom scripting, and PostgreSQL for robust deduplication before sending rich, image-filled Discord notifications.








































