Shortcuts

ChineseCLIP

摘要

The tremendous success of CLIP (Radford et al., 2021) has promoted the research and application of contrastive learning for vision-language pretraining. In this work, we construct a large-scale dataset of image-text pairs in Chinese, where most data are retrieved from publicly available datasets, and we pretrain Chinese CLIP models on the new dataset. We develop 5 Chinese CLIP models of multiple sizes, spanning from 77 to 958 million parameters. Furthermore, we propose a two-stage pretraining method, where the model is first trained with the image encoder frozen and then trained with all parameters being optimized, to achieve enhanced model performance. Our comprehensive experiments demonstrate that Chinese CLIP can achieve the state-of-the-art performance on MUGE, Flickr30K-CN, and COCO-CN in the setups of zero-shot learning and finetuning, and it is able to achieve competitive performance in zero-shot image classification based on the evaluation on the ELEVATER benchmark (Li et al., 2022). We have released our codes, models, and demos in https://github.com/OFA-Sys/Chinese-CLIP

使用方式

from mmpretrain import ImageClassificationInferencer

inferencer = ImageClassificationInferencer(
    'cn-clip_resnet50_zeroshot-cls_cifar100',
    pretrained=True,
    classes=['鸟', '狗', '猫', '蛇'],
    text_prototype=['鸟', '狗', '猫', '蛇'],
)

prediction = inferencer('./demo/bird.JPEG')[0]
print('Results:', prediction['pred_class'])

Models and results

Image Classification on CIFAR100

模型

Params (M)

Top-1 (%)

配置文件

下载

cn-clip_resnet50_zeroshot-cls_cifar100*

77.00

40.70

config

model

cn-clip_vit-base-p16_zeroshot-cls_cifar100*

188.00

64.50

config

model

cn-clip_vit-large-p14_zeroshot-cls_cifar100*

406.00

74.80

config

model

cn-clip_vit-huge-p14_zeroshot-cls_cifar100*

958.00

79.10

config

model

Models with * are converted from the official repo. The config files of these models are only for inference. We haven’t reproduce the training results.

引用

@article{chinese-clip,
  title={Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese},
  author={Yang, An and Pan, Junshu and Lin, Junyang and Men, Rui and Zhang, Yichang and Zhou, Jingren and Zhou, Chang},
  journal={arXiv preprint arXiv:2211.01335},
  year={2022}
}
Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.