Clip Comparison

Compare CLIP image and text embeddings.

v2

Use the OpenAI CLIP zero-shot classification model to classify images.

This block accepts an image and a list of text prompts. The block then returns the similarity of each text label to the provided image.

This block is useful for classifying images without having to train a fine-tuned classification model. For example, you could use CLIP to classify the type of vehicle in an image, or if an image contains NSFW material.

Type identifier

Use the following identifier in step "type" field: roboflow_core/clip_comparison@v2 to add the block as a step in your workflow.

Properties

NameTypeDescriptionRefs
namestrUnique name of step in workflows.
classesList[str]List of classes to calculate similarity against each input image.
versionstrVariant of CLIP model.

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds Clip Comparison in version v2 has.

Input and output bindings
  • input

    • images (image): The image to infer on..
    • classes (list_of_values): List of classes to calculate similarity against each input image.
    • version (string): Variant of CLIP model.
  • output

Example JSON definition
{
	    "name": "<your_step_name_here>",
	    "type": "roboflow_core/clip_comparison@v2",
	    "images": "$inputs.image",
	    "classes": [
	        "a",
	        "b",
	        "c"
	    ],
	    "version": "ViT-B-16"
	}

v1

Use the OpenAI CLIP zero-shot classification model to classify images.

This block accepts an image and a list of text prompts. The block then returns the similarity of each text label to the provided image.

This block is useful for classifying images without having to train a fine-tuned classification model. For example, you could use CLIP to classify the type of vehicle in an image, or if an image contains NSFW material.

Type identifier

Use the following identifier in step "type" field: roboflow_core/clip_comparison@v1 to add the block as a step in your workflow.

Properties

NameTypeDescriptionRefs
namestrUnique name of step in workflows.
textsList[str]List of texts to calculate similarity against each input image.

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds Clip Comparison in version v1 has.

Input and output bindings
  • input

    • images (image): The image to infer on..
    • texts (list_of_values): List of texts to calculate similarity against each input image.
  • output

    • similarity (list_of_values): List of values of any type.
    • parent_id (parent_id): Identifier of parent for step output.
    • root_parent_id (parent_id): Identifier of parent for step output.
    • prediction_type (prediction_type): String value with type of prediction.
Example JSON definition
{
	    "name": "<your_step_name_here>",
	    "type": "roboflow_core/clip_comparison@v1",
	    "images": "$inputs.image",
	    "texts": [
	        "a",
	        "b",
	        "c"
	    ]
	}