AI Crop Anomaly Detection Agent (Voyage AI & Qdrant)
Integrates with:
Overview
Unlock Automated Crop Anomaly Detection with this AI Agent
This AI Agent is a powerful tool for identifying unusual or unexpected crop images within your agricultural datasets. As the final part of a three-workflow series for building a comprehensive image anomaly detection system, this agent takes an image URL, uses Voyage AI to understand its visual content by generating multimodal embeddings, and then queries a Qdrant vector database. This database, prepared by the preceding workflows, stores information about known crop types and their characteristic visual features (medoids and thresholds). The agent intelligently compares the new image against these known types. If the image doesn't closely match any existing category, it's flagged as a potential anomaly, providing you with a clear textual alert or classification.
Key Features & AI Abilities:
- Image Understanding: Leverages Voyage AI's
voyage-multimodal-3
model to generate rich embeddings from input crop images. - Anomaly Detection: Performs AI-driven similarity searches in a Qdrant vector database to compare new images against established crop profiles (medoids).
- Intelligent Scoring: Uses Python-based custom logic to evaluate similarity scores against learned thresholds, distinguishing known crops from anomalies.
- Automated Alerts: Clearly indicates if an image is recognized or if it's a potential new, undefined crop requiring attention.
- Scalable Solution: Designed to integrate with larger agricultural monitoring systems or quality control processes.
- Part of a Pipeline: Functions as the detection component in an end-to-end anomaly detection setup (dataset upload, medoid creation, detection).
Use Cases
- For B2C e-commerce (e.g., online grocery, farm-to-table platforms): Automatically verify user-submitted produce images against known crop types, improving catalog accuracy and flagging potentially mislabeled or novel items.
- For B2B SaaS (e.g., AgTech platforms, precision agriculture solutions): Integrate this agent to offer clients automated visual anomaly detection in field imagery, helping identify early signs of plant stress, disease, or pest presence that deviates from healthy crop patterns.
- Enhance quality control for agricultural suppliers: Quickly identify and sort out produce that doesn't match the expected visual characteristics of a specific crop batch.
- Streamline agricultural research: Efficiently scan large image datasets of crops to pinpoint unusual specimens or variations for further study.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- Voyage AI API Key (for Header Authentication).
- Qdrant Cloud cluster URL and API Key.
- A Qdrant collection (e.g.,
agricultural-crops
) pre-populated with crop image embeddings, medoid data, and associated thresholds. This setup is performed by the preceding workflows in this series (typically named '[1/3] Upload crops dataset...' and '[2/3] Set up medoids...').
Setup Instructions
- Download the n8n workflow JSON file (
ai-crop-anomaly-detection-agent-v1.0.0.json
). - Import the workflow into your n8n instance.
- Ensure you have already executed the first two workflows in this series to populate your Qdrant collection with the necessary crop image embeddings, medoids, and threshold data.
- Configure the 'Variables for medoids' (Set node):
- Update
qdrantCloudURL
with your Qdrant Cloud instance URL. - Verify
collectionName
matches your Qdrant collection (default isagricultural-crops
). - Check that
clusterCenterType
(e.g.,is_medoid
) andclusterThresholdCenterType
(e.g.,is_medoid_cluster_threshold
) match the payload keys used during your medoid setup in Qdrant.
- Update
- In the 'Embed image' (HTTP Request node for Voyage AI), select or create your Voyage AI API credentials using 'Generic Credential Type' -> 'HTTP Header Auth'. Add a header with Name 'Authorization' and Value 'Bearer YOUR_VOYAGE_API_KEY'.
- In the 'Get similarity of medoids', 'Total Points in Collection', and 'Each Crop Counts' (HTTP Request nodes for Qdrant), select or create your Qdrant API credentials (predefinedCredentialType: qdrantApi).
- The workflow is triggered by the 'Execute Workflow Trigger' node, which expects an
imageURL
as a query parameter (e.g.,?imageURL=your_image_link.jpg
). You can test this by manually executing the workflow with a sample URL in the pinData or trigger it externally. - Review the Python code in the 'Compare scores' node if you need to adjust the logic for how similarity scores are compared against thresholds or how the result message is formulated.
- Activate the workflow. It will now process incoming image URLs and report whether the image is a known crop or a potential new/undefined crop.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation