Table of Contents
Contrastive Language-Image Pretraining (CLIP, Contrastive Language-Image Pretraining) is a model released by OpenAI in 2021, mainly based on Transformer.
Use CLIP for Zero-shot classification
Python implementation
Home Technology peripherals AI ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Apr 11, 2023 pm 11:10 PM
Model

Although ImageNet has long completed its historical mission, it is still a key data set in the field of computer vision.

In 2016, the sota accuracy rate of the classification model trained on ImageNet was still less than 80%; to this day, zero-shot generalization based on large-scale pre-trained models alone can achieve an accuracy of 80.1%.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

##Laion recently trained a brand new ViT-G/14 CLIP## using the open source OpenCLIP framework # Model, on the ImageNet data set, the accuracy of the original OpenAI CLIP is only 75.4%, while OpenCLIP achieves a zero-shot accuracy of 80.1%, and achieves a zero-shot of 74.9% on MS COCO Image retrieval (Recall@5), which is also currently the most powerful open source CLIP model.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

LAION stands for Large-scale Artificial Intelligence Open Network. It is a non-profit organization with members from all over the world, aiming to provide large-scale Artificial Intelligence to the public. Scale machine learning models, datasets, and associated code. They claim to be truly Open AI, 100% non-profit and 100% free.

Interested friends can update the CLIP model at hand!

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Model address: https://huggingface.co/laion/CLIP-ViT-bigG-14 -laion2B-39B-b160k

The specific performance of the OpenCLIP model on each data set is shown in the table below.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Zero-shot capability

Generally speaking, computer vision (CV) models perform better in various tasks The sota performance on is based on training data in specific fields and cannot be generalized to other fields or tasks, resulting in a limited understanding of the general attributes of the visual world.

The generalization problem is especially important in fields that lack large amounts of training data.

Ideally, a CV model should learn the semantic content of images rather than focusing too much on specific labels in the training set. For example, for an image of a dog, the model should be able to understand that there is a dog in the image, and further understand that there are trees in the background, the time is daytime, the dog is on the grass, etc.

But the current results obtained by "classification training" are exactly opposite to expectations. The model learns to push the dog's internal representation into the same "dog vector space" and the cat into the same "Cat vector space", the answer to all questions is binary, that is, whether the image can be aligned with a category label.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Retraining a classification model for new tasks is also a solution, but the training itself requires a lot of time and financial investment. to collect classification datasets and train models.

Fortunately, OpenAI’s CLIP model is a very flexible classification model and can usually be used in new classification tasks without retraining.

Why CLIP can Zero-Shot

Contrastive Language-Image Pretraining (CLIP, Contrastive Language-Image Pretraining) is a model released by OpenAI in 2021, mainly based on Transformer.

CLIP consists of two models, a Transformer encoder to convert text to embedding, and a Visual Transformer (ViT) to encode images.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Both text and image models within CLIP are optimized during pre-training to align similar text and images in vector space. During the training process, image-text pairs in the data are pushed closer together in the vector space, while image and text vectors that do not belong to a pair are separated.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

There are several differences between CLIP and general classification models:

First, OpenAI uses crawled data from the Internet The benefits of training on a very large-scale data set containing 400 million text-image pairs are:

1. CLIP training only requires "image-text pairs" and does not require specific class labels, and this Types of data are abundant in today’s social media-centric online world.

2. Large datasets mean CLIP’s ability to understand common textual concepts in images.

3. The text descriptor often contains various features in the image, not just a category feature, which means that a more comprehensive image and text representation can be established.

The above advantages are also a key factor in CLIP's ability to establish Zero-shot. The author of the paper also compared the ResNet-101 model and CLIP model specially trained on ImageNet, and applied it to other data derived from ImageNet. Set, the figure below shows the performance comparison.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

It can be seen that although ResNet-101 is trained on ImageNet, its performance on similar datasets is better than CLIP Performance on the same task is much worse.

When applying the ResNet model to other fields, a common method is "linear probe", that is, the characteristics learned in the last few layers of the ResNet model are input into a linear classifier, and then Fine-tuned for specific data sets.

In the CLIP paper, linear detection ResNet-50 is compared with zero-shot CLIP. The conclusion is that in the same scenario, zero-shot CLIP performs better than ResNet in multiple tasks. Linear detection in -50.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

However, it is worth noting that when given more training samples, Zero-shot does not outperform linear detection.

Use CLIP for Zero-shot classification

As you can know from the above description, the image and text encoder can create a 512-dimensional vector that maps the input image and text input to the same vector space.

Using CLIP for zero-shot classification means putting category information into text sentences.

For example, if you input an image and want to determine whether its category is a car, bird or cat, you can create three text strings to represent the category:

T1 represents car: a photo of a car

T2 represents a bird: a photo of a bird

T3 represents a cat: a photo of a cat

Enter the category description into the text encoder, and A vector can be obtained that can represent the category.

Assume that the input is a photo of a cat. Use the ViT model to encode it. After obtaining the image vector, calculate the cosine distance between it and the category vector as the similarity. If the similarity with T3 is the highest, it means The category of the image belongs to cats.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

As you can see, the category label is not a simple word, but based on the template 「a photo of a {label}」 The format of is rewritten into a sentence, which can be extended to category prediction without training restrictions.

In the experiment, using this prompt template improved the classification accuracy of ImageNet by 1.3 percentage points. However, the prompt template does not always improve performance. In actual use, it needs to be tested based on different data sets.

Python implementation

It is also very easy to quickly use CLIP for zero-shot classification. The author selected the frgfm/imagenette data set in Hugging Face as a demonstration. The data set contains 10 labels. , and all are saved as integer values.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Using CLIP for classification requires converting integer value labels into corresponding text content.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

#Before directly calculating the similarity between tags and photos, you need to initialize the CLIP model, which can be implemented using the CLIP found through Hugging Face transformers.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

The text transformer cannot read text directly, but requires a set of integer values ​​called token IDs (or input_IDs), where each A unique integer represents a word or sub-word (ie token).

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Input the converted tensor into the text transformer to obtain the text embedding of the label

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Note that currently CLIP The output vector has not been normalized, and the similarity results obtained after dot multiplication are inaccurate.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

Next, you can select an image in the data set for testing, and obtain the image vector after the same processing process.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

After converting the image into a vector with dimensions of (1, 3, 224, 224), input it into the model to obtain embedding

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

The next step is to calculate the dot product similarity between the image embedding and the ten label text embeddings in the data set. The one with the highest score is the predicted category.

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated


The model gives the result for the cassette player (cassette player), in the entire data set After running it again, we can get an accuracy of 98.7%

ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated

In addition to Zero-shot classification, multi-modal search, target detection, generative Models such as OpenAI's Dall-E and Stable disusion, CLIP open a new door to computer vision.

The above is the detailed content of ImageNet zero-sample accuracy exceeds 80% for the first time, and the strongest open source CLIP model on the planet is updated. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo May 07, 2024 pm 04:13 PM

Imagine an artificial intelligence model that not only has the ability to surpass traditional computing, but also achieves more efficient performance at a lower cost. This is not science fiction, DeepSeek-V2[1], the world’s most powerful open source MoE model is here. DeepSeek-V2 is a powerful mixture of experts (MoE) language model with the characteristics of economical training and efficient inference. It consists of 236B parameters, 21B of which are used to activate each marker. Compared with DeepSeek67B, DeepSeek-V2 has stronger performance, while saving 42.5% of training costs, reducing KV cache by 93.3%, and increasing the maximum generation throughput to 5.76 times. DeepSeek is a company exploring general artificial intelligence

KAN, which replaces MLP, has been extended to convolution by open source projects KAN, which replaces MLP, has been extended to convolution by open source projects Jun 01, 2024 pm 10:03 PM

Earlier this month, researchers from MIT and other institutions proposed a very promising alternative to MLP - KAN. KAN outperforms MLP in terms of accuracy and interpretability. And it can outperform MLP running with a larger number of parameters with a very small number of parameters. For example, the authors stated that they used KAN to reproduce DeepMind's results with a smaller network and a higher degree of automation. Specifically, DeepMind's MLP has about 300,000 parameters, while KAN only has about 200 parameters. KAN has a strong mathematical foundation like MLP. MLP is based on the universal approximation theorem, while KAN is based on the Kolmogorov-Arnold representation theorem. As shown in the figure below, KAN has

Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Apr 18, 2024 pm 07:58 PM

Boston Dynamics Atlas officially enters the era of electric robots! Yesterday, the hydraulic Atlas just "tearfully" withdrew from the stage of history. Today, Boston Dynamics announced that the electric Atlas is on the job. It seems that in the field of commercial humanoid robots, Boston Dynamics is determined to compete with Tesla. After the new video was released, it had already been viewed by more than one million people in just ten hours. The old people leave and new roles appear. This is a historical necessity. There is no doubt that this year is the explosive year of humanoid robots. Netizens commented: The advancement of robots has made this year's opening ceremony look like a human, and the degree of freedom is far greater than that of humans. But is this really not a horror movie? At the beginning of the video, Atlas is lying calmly on the ground, seemingly on his back. What follows is jaw-dropping

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

AI subverts mathematical research! Fields Medal winner and Chinese-American mathematician led 11 top-ranked papers | Liked by Terence Tao AI subverts mathematical research! Fields Medal winner and Chinese-American mathematician led 11 top-ranked papers | Liked by Terence Tao Apr 09, 2024 am 11:52 AM

AI is indeed changing mathematics. Recently, Tao Zhexuan, who has been paying close attention to this issue, forwarded the latest issue of "Bulletin of the American Mathematical Society" (Bulletin of the American Mathematical Society). Focusing on the topic "Will machines change mathematics?", many mathematicians expressed their opinions. The whole process was full of sparks, hardcore and exciting. The author has a strong lineup, including Fields Medal winner Akshay Venkatesh, Chinese mathematician Zheng Lejun, NYU computer scientist Ernest Davis and many other well-known scholars in the industry. The world of AI has changed dramatically. You know, many of these articles were submitted a year ago.

Time Series Forecasting NLP Large Model New Work: Automatically Generate Implicit Prompts for Time Series Forecasting Time Series Forecasting NLP Large Model New Work: Automatically Generate Implicit Prompts for Time Series Forecasting Mar 18, 2024 am 09:20 AM

Today I would like to share a recent research work from the University of Connecticut that proposes a method to align time series data with large natural language processing (NLP) models on the latent space to improve the performance of time series forecasting. The key to this method is to use latent spatial hints (prompts) to enhance the accuracy of time series predictions. Paper title: S2IP-LLM: SemanticSpaceInformedPromptLearningwithLLMforTimeSeriesForecasting Download address: https://arxiv.org/pdf/2403.05798v1.pdf 1. Large problem background model

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

FisheyeDetNet: the first target detection algorithm based on fisheye camera FisheyeDetNet: the first target detection algorithm based on fisheye camera Apr 26, 2024 am 11:37 AM

Target detection is a relatively mature problem in autonomous driving systems, among which pedestrian detection is one of the earliest algorithms to be deployed. Very comprehensive research has been carried out in most papers. However, distance perception using fisheye cameras for surround view is relatively less studied. Due to large radial distortion, standard bounding box representation is difficult to implement in fisheye cameras. To alleviate the above description, we explore extended bounding box, ellipse, and general polygon designs into polar/angular representations and define an instance segmentation mIOU metric to analyze these representations. The proposed model fisheyeDetNet with polygonal shape outperforms other models and simultaneously achieves 49.5% mAP on the Valeo fisheye camera dataset for autonomous driving

See all articles