Animated data flow diagram

AI Image Classification Agent for Land Types (KNN with Voyage & Qdrant)

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

Voyage AI Qdrant

Overview

Unlock Automated Image Classification with this AI Agent

This n8n AI Agent automates the classification of land types from satellite or aerial imagery, achieving impressive accuracy (e.g., reported 93.24% on test datasets without fine-tuning). It takes an image URL, generates a powerful multimodal embedding using Voyage AI, and then queries a Qdrant vector database to find the K-Nearest Neighbors (KNN). By performing a majority vote on the classes of these neighbors (e.g., 'forest', 'agricultural', 'buildings'), it accurately assigns a land type to the input image. The agent intelligently handles classification ties by dynamically increasing the number of neighbors considered, ensuring robust and reliable results. This empowers users to efficiently categorize vast amounts of imagery for applications like environmental monitoring, urban planning, agricultural assessment, or any domain requiring visual classification at scale.

Key Features & Benefits

  • Advanced Image Understanding: Utilizes Voyage AI for state-of-the-art multimodal image embeddings, capturing rich visual context.
  • Efficient Similarity Search: Leverages Qdrant for fast and scalable K-Nearest Neighbors (KNN) vector similarity search.
  • Accurate Classification: Implements a robust KNN classification algorithm to categorize images based on similarity to a labeled dataset.
  • Automated Tie-Breaking: Intelligently resolves classification ties by expanding the neighbor search, enhancing reliability.
  • Flexible Input: Processes images via URL, allowing easy integration with various data sources and other workflows.
  • Adaptable & Scalable: Primarily designed for land type classification from satellite/aerial imagery, but easily adaptable for other image classification tasks with your own Qdrant collection.
  • Clear Output: Provides a direct classification label (e.g., 'forest', 'buildings') for straightforward use in downstream processes.

Use Cases

  • Automate land cover mapping for environmental agencies by classifying satellite imagery.
  • For AgriTech B2B SaaS: Offer automated crop type identification or monitor field health by classifying drone/satellite imagery, enabling precision farming insights for customers.
  • For Real Estate Tech B2C platforms: Automatically tag property listings with environmental features (e.g., 'beach access', 'forest view') by classifying aerial/satellite imagery, improving search filters and property appeal.
  • Assist urban planners by automatically classifying zones (residential, commercial, industrial) from aerial surveys to track development and infrastructure changes.
  • Enable large-scale research by classifying images for biodiversity studies, deforestation tracking, or geological surveys.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • Voyage AI API Key and associated credentials for the 'Embed image' node (HTTP Header Auth).
  • Qdrant Cloud instance URL and API Key for the 'Query Qdrant' node.
  • A pre-populated Qdrant collection (e.g., named 'land-use') containing image embeddings and their corresponding class labels. This workflow is designed as part 2 of a process; part 1 would involve populating this Qdrant collection.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure the 'Embed image' (HttpRequest) node:
    • Under 'Authentication', select 'Generic Credential Type'.
    • For 'Generic Auth Type', choose 'HTTP Header Auth'.
    • Select or create credentials (e.g., 'Voyage API') providing your Voyage AI API key as per Voyage AI's authentication requirements (likely in an 'Authorization: Bearer YOUR_API_KEY' header).
  4. In the 'Qdrant variables + embedding + KNN neigbours' (Set) node:
    • Update the qdrantCloudURL value with your specific Qdrant Cloud instance URL (e.g., https://your-qdrant-id.eu-central-1-0.aws.cloud.qdrant.io).
    • Ensure the collectionName value matches your Qdrant collection (default is 'land-use').
    • You can adjust the initial limitKNN (number of neighbors for classification) if desired.
  5. Configure the 'Query Qdrant' (HttpRequest) node:
    • Under 'Authentication', select 'Predefined Credential Type'.
    • For 'Node Credential Type', choose 'Qdrant API'.
    • Select or create your 'QdrantApi account' credentials, providing your Qdrant API Key.
  6. Review the Python code in the 'Majority Vote' node. Ensure the JSON path point["payload"]["landscape_name"] correctly extracts the class label from your Qdrant payload structure. Adjust if your payload schema differs.
  7. Test the workflow: Use the 'Execute Workflow Trigger' node. You can manually run it with an imageURL in the input JSON (see pinned data in the workflow for an example structure: {"query": {"imageURL": "your_image_url_here"}}).
  8. Activate the workflow. It can now be called by other n8n workflows or external triggers to classify images.

Tags:

AI AgentImage ClassificationVoyage AIQdrantKNNSatellite ImageryAutomationData AnalysisMachine Learning

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation