Cosine Similarity¶
Class: CosineSimilarityBlockV1
Source: inference.core.workflows.core_steps.math.cosine_similarity.v1.CosineSimilarityBlockV1
Calculate the cosine similarity between two embeddings.
A cosine similarity of 1 means the two embeddings are identical, while a cosine similarity of 0 means the two embeddings are orthogonal. Greater values indicate greater similarity.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/cosine_similarity@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Unique name of step in workflows. | ❌ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to Cosine Similarity in version v1.
- inputs:
CLIP Embedding Model,Perception Encoder Embedding Model,Identify Changes - outputs:
SAM 3,OpenAI,Crop Visualization,PTZ Tracking (ONVIF).md),OpenAI,Google Gemini,Anthropic Claude,Label Visualization,Llama 3.2 Vision,Google Gemini,Seg Preview,Roboflow Dataset Upload,Dynamic Zone,Segment Anything 2 Model,Template Matching,Webhook Sink,Velocity,Distance Measurement,Camera Calibration,Line Counter Visualization,Keypoint Visualization
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Cosine Similarity in version v1 has.
Bindings
Example JSON definition of step Cosine Similarity in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/cosine_similarity@v1",
"embedding_1": "$steps.clip_image.embedding",
"embedding_2": "$steps.clip_text.embedding"
}