[3/3] Anomaly detection tool (crops dataset)
Configured with Execute Workflow Trigger, HTTP Request. Review the connections and setup before adapting this template.
Node categories in this workflow
- Web / API
- Code
- Transform
- Trigger
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 |
|---|---|---|---|
| Embed image | Web / API | HTTP Request | POST |
| Get similarity of medoids | Web / API | HTTP Request | POST |
| Compare scores | Code | Code | See node parameters |
| Variables for medoids | Transform | Edit Fields | See node parameters |
| Info About Crop Labeled Clusters | Transform | Edit Fields | See node parameters |
| Total Points in Collection | Web / API | HTTP Request | POST |
| Each Crop Counts | Web / API | HTTP Request | POST |
| Image URL hardcode | Transform | Edit Fields | See node parameters |
| Execute Workflow Trigger | Trigger | Execute Workflow Trigger | See node parameters |
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
httpHeaderAuthqdrantApi
Workflow notes
Sticky Note1
We are working here with crops dataset: Existing (so not anomalies) crops images in dataset are:
- 'pearl_millet(bajra)',
- 'tobacco-plant',
- 'cherry',
- 'cotton',
- 'banana',
- 'cucumber',
- 'maize',
- 'wheat',
- 'clove',
- 'jowar',
- 'olive-tree',
- 'soyabean',
- 'coffee-plant',
- 'rice',
- 'lemon',
- 'mustard-oil',
- 'vigna-radiati(mung)',
- 'coconut',
- 'gram',
- 'pineapple',
- 'sugarcane',
- 'sunflower',
- 'chilli',
- 'fox_nut(makhana)',
- 'jute',
- 'papaya',
- 'tea',
- 'cardamom',
- 'almond'
Crop Anomaly Detection Tool
Crop Anomaly Detection Tool
This is the tool that can be used directly for anomalous crops detection.
It takes as input (any) image URL and returns a text message telling if whatever this image depicts is anomalous to the crop dataset stored in Qdrant.
- An Image URL is received via the Execute Workflow Trigger which is used to generate embedding vectors via the Voyage.ai Embeddings API.
- The returned vectors are used to query the Qdrant collection to determine if the given crop is known by comparing it to threshold scores of each image class (crop type).
- If the image scores lower than all thresholds, then the image is considered an anomaly for the dataset.
Sticky Note3
clusterCenterType - either
- "is_text_anchor_medoid" or
- "is_medoid"
clusterThresholdCenterType - either
- "is_text_anchor_medoid_cluster_threshold" or
- "is_medoid_cluster_threshold"
Sticky Note2
Variables to access Qdrant's collection we uploaded & prepared for anomaly detection in 2 previous pipelines
Sticky Note5
These three nodes are needed just to figure out how many different classes (crops) we have in our Qdrant collection: cropsNumber (needed in "Get similarity of medoids" node. [Note] "Total Points in Collection" -> "Each Crop Counts" were used&explained already in "[2/4] Set up medoids (2 types) for anomaly detection (crops dataset)" pipeline.
Sticky Note6
Here, we're embedding the image passed to this workflow tool with the Voyage embedding model to compare the image to all crop images in the database.
Sticky Note7
Checking how similar the image is to all the centres of clusters (crops). If it's more similar to the thresholds we set up and stored in centres in the previous workflow, the image probably belongs to this crop class; otherwise, it's anomalous to the class. If image is anomalous to all the classes, it's an anomaly.
For anomaly detection
For anomaly detection
- The first pipeline is uploading (crops) dataset to Qdrant's collection.
- The second pipeline sets up cluster (class) centres in this Qdrant collection & cluster (class) threshold scores.
- This is the anomaly detection tool, which takes any image as input and uses all preparatory work done with Qdrant (crops) collection.
To recreate it
You'll have to upload crops dataset from Kaggle to your own Google Storage bucket, and re-create APIs/connections to Qdrant Cloud (you can use Free Tier cluster), Voyage AI API & Google Cloud Storage
In general, pipelines are adaptable to any dataset of images
[3/3] Anomaly detection tool (crops dataset)
[3/3] Anomaly detection tool (crops dataset)
Purpose and structure
This folder contains the [3/3] Anomaly detection tool (crops dataset) workflow. Its executable nodes use code, executeWorkflowTrigger, httpRequest, 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
Execute Workflow Trigger
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/Http/1462_HTTP_Executeworkflow_Automation_Webhook.json MIT; preserve source notices.