0

Zero-shot Image Classification with OpenAI CLIP

In this tutorial, you will use OpenAI CLIP model to perform zero-shot image classification.

Example · مثالopenai

Content

Zero-shot Image Classification with OpenAI CLIP

Zero-shot image classification is a computer vision task to classify images into one of several classes, without any prior training or knowledge of the classes.

!zero-shot-pipeline

In this tutorial, you will use OpenAI CLIP model to perform zero-shot image classification.

Notebook Contents

This tutorial demonstrates how to perform zero-shot image classification using the open-source CLIP model. CLIP is a multi-modal vision and language model. It can be instructed in natural language to predict the most relevant text snippet, given an image, without directly optimizing for the task. According to the paper, CLIP matches the performance of the original ResNet50 on ImageNet “zero-shot” without using any of the original 1.28M labeled examples, overcoming several major challenges in computer vision. You can find more information about this model in the research paper, OpenAI blog, model card and GitHub repository.

This folder contains notebook that show how to convert and quantize model with OpenVINO and NNCF

The notebook contains the following steps:

  1. Instantiate model.
  2. Run PyTorch model inference.
  3. Convert model with OpenVINO.
  4. Launch interactive demo

Inference supports CPU, GPU and NPU. The NPU path fixes input shapes before compilation and compiles the model again when the number of labels changes.

We will use CLIP model for zero-shot image classification. The result of model work demonstrated on the image below !image

Installation Instructions

This is a self-contained example that relies solely on its own code.</br> The notebook uses OpenVINO >= 2026.5.0 and Optimum Intel >= 2.3.0. We recommend running the notebook in a virtual environment. You only need a Jupyter server to start. For details, please refer to [Installation Guide](../../README.md)..

Source and license

Source
Intel OpenVINO Notebooks
Original
openvinotoolkit/openvino_notebooks/notebooks/clip-zero-shot-image-classification
License
Apache-2.0