Animated data flow diagram

AI Crop Anomaly Detection Agent using n8n, Voyage AI & Qdrant

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

Integrates with:

Voyage AI Qdrant HTTP Request

Overview

Unlock Advanced Agricultural Image Analysis with this AI Agent

This n8n AI Agent empowers you to automatically identify anomalous images within your crop dataset. It takes an image URL as input, generates multimodal embeddings using Voyage AI, and then queries a Qdrant vector database to compare the new image against known crop categories. If the image's similarity to existing categories falls below predefined thresholds, it's flagged as a potential anomaly or a new, undefined crop type.

This agent is the third part of a 3-workflow series designed for comprehensive image dataset management and anomaly detection. The underlying AI mechanism for anomaly detection can be adapted for various visual datasets beyond agriculture.

Key Features & Benefits

  • AI-Powered Anomaly Detection: Employs Voyage AI's voyage-multimodal-3 model for rich image embeddings and Qdrant for high-speed vector similarity searches against pre-calculated cluster medoids.
  • Automated Image Vetting: Streamlines the process of identifying outliers or novel items in large image collections, saving significant manual review time.
  • Enhanced Dataset Integrity: Helps maintain the quality and consistency of your image datasets by flagging potentially misclassified or unknown items.
  • Extensible & Customizable: Built on n8n, allowing easy modification of parameters (like Qdrant collection name, threshold types) and integration with other tools in your stack.
  • Clear Actionable Output: Provides a straightforward text message: "ALERT, we might have a new undefined crop!" or "Looks similar to [crop_name]", enabling quick decision-making.
  • Designed for Prepared Datasets: Works seamlessly with a Qdrant collection prepared with image embeddings, class medoids, and similarity thresholds from preceding data preparation workflows.

Use Cases

  • Automate quality control for agricultural image datasets, identifying outliers or mislabeled crop photos.
  • Assist researchers in discovering new or undocumented plant varieties by flagging images that don't match known types.
  • Enhance precision agriculture platforms by alerting to unusual crop appearances in monitored fields, potentially indicating stress, disease, or foreign species.
  • For developers building AI for agriculture or other visual domains: Streamline dataset preparation by automatically identifying anomalous images that could negatively impact model training.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • Voyage AI API Key with access to the voyage-multimodal-3 model.
  • Qdrant Cloud instance (or self-hosted) and API Key.
  • A Qdrant collection (e.g., 'agricultural-crops' as used in the workflow) pre-populated by the two preceding workflows in this series. This collection must contain image embeddings, crop names, medoid flags (is_medoid), and medoid cluster thresholds (is_medoid_cluster_threshold).

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Important: This workflow is part 3 of 3 ('[3/3] Anomaly detection tool (crops dataset)'). Ensure your Qdrant collection has been set up and populated by the first two prerequisite workflows which handle dataset upload, embedding, and medoid/threshold calculation.
  4. Configure the 'Variables for medoids' node:
    • Update qdrantCloudURL to your Qdrant instance URL.
    • Verify collectionName matches your Qdrant collection (default: agricultural-crops).
    • The clusterCenterType (default: is_medoid) and clusterThresholdCenterType (default: is_medoid_cluster_threshold) should match the payload keys used when setting up medoids in Qdrant.
  5. Configure HTTP Request Nodes:
    • In the 'Embed image' node, set up your Voyage AI API credentials (HttpHeaderAuth).
    • In 'Get similarity of medoids', 'Total Points in Collection', and 'Each Crop Counts' nodes, select or create your Qdrant API credentials.
  6. The workflow is triggered by the 'Execute Workflow Trigger' node, which expects an imageURL as a query parameter (e.g., YOUR_N8N_WEBHOOK_URL?imageURL=https://path.to/your/image.jpg). You can use the 'Image URL hardcode' node to set a test URL by modifying its value {{ $json.query.imageURL }} to a static URL temporarily.
  7. Review the Python code in the 'Compare scores' node if you need to adjust the logic for determining anomalies or the output messages.
  8. Activate the workflow and test by sending an image URL to its webhook.

Tags:

AI AgentAnomaly DetectionImage AnalysisVoyage AIQdrantAgricultureAutomationDataset ManagementComputer Vision

Want your own unique AI agent?

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

Schedule a Consultation