DFN5B-CLIP-ViT-H-14-378
apple
open_clip
apple/DFN5B-CLIP-ViT-H-14-378
6,071,841
下载量
109
收藏数
18
浏览量
apple-amlr
许可
简介
一个在DFN-5B上训练的CLIP(对比语言-图像预训练)模型。 数据过滤网络(DFN)是用于自动过滤大规模未整理数据池的小型网络。 该模型基于从430亿未整理图文对(128亿图像)中筛选出的50亿张图像进行训练。
模型卡片
许可协议
apple-amlr
模型配置
模型类型
clip
架构
CLIPModel
模型详情
已翻译一个基于 DFN-5B 训练的 CLIP(Contrastive Language-Image Pre-training)模型。
数据过滤网络(Data Filtering Networks, DFNs)是一种小型网络,用于自动过滤大规模未整理数据。
该模型在 50 亿张图像上训练而成,这些图像从 430 亿对未整理的图像-文本对中筛选得到
(其中 128 亿对来自 CommonPool-12.8B,另外 300 亿对来自公开图像-文本数据)。
该模型已从 Axlearn(https://github.com/apple/axlearn)的原始 JAX 检查点转换为 PyTorch 格式。
这些权重可直接在 OpenCLIP(图像 + 文本)中使用。
模型详情
- 模型类型: 对比式图像-文本,零样本图像分类。
- 数据集: DFN-5b
- 论文:
- Data Filtering Networks:https://arxiv.org/abs/2309.17425
- 训练样本量: 390 亿(224 x 224)+ 50 亿(384 x 384)
模型指标
| 数据集 | 指标 |
|---|---|
| ImageNet 1k | 0.84218 |
| Caltech-101 | 0.954479 |
| CIFAR-10 | 0.9879 |
| CIFAR-100 | 0.9041 |
| CLEVR Counts | 0.362467 |
| CLEVR Distance | 0.206067 |
| Country211 | 0.37673 |
| Describable Textures | 0.71383 |
| EuroSAT | 0.608333 |
| FGVC Aircraft | 0.719938 |
| Food-101 | 0.963129 |
| GTSRB | 0.679018 |
| ImageNet Sketch | 0.73338 |
| ImageNet v2 | 0.7837 |
| ImageNet-A | 0.7992 |
| ImageNet-O | 0.3785 |
| ImageNet-R | 0.937633 |
| KITTI Vehicle Distance | 0.38256 |
| MNIST | 0.8372 |
| ObjectNet 1 | 0.796867 |
| Oxford Flowers-102 | 0.896834 |
| Oxford-IIIT Pet | 0.966841 |
| Pascal VOC 2007 | 0.826255 |
| PatchCamelyon | 0.695953 |
| Rendered SST2 | 0.566722 |
| RESISC45 | 0.755079 |
| Stanford Cars | 0.959955 |
| STL-10 | 0.991125 |
| SUN397 | 0.772799 |
| SVHN | 0.671251 |
| Flickr | 0.8808 |
| MSCOCO | 0.636889 |
| WinoGAViL | 0.571813 |
| iWildCam | 0.224911 |
| Camelyon17 | 0.711536 |
| FMoW | 0.209024 |
| Dollar Street | 0.71729 |
| GeoDE | 0.935699 |
| 平均值 | 0.709421 |
[1]:ObjectNet 使用了中心裁剪预处理(直接缩放会导致准确率降至 0.737)
模型使用
配合 OpenCLIP
import torch
import torch.nn.functional as F
from urllib.request import urlopen
from PIL import Image
from open_clip import create_model_from_pretrained, get_tokenizer
model, preprocess = create_model_from_pretrained('hf-hub:apple/DFN5B-CLIP-ViT-H-14-384')
tokenizer = get_tokenizer('ViT-H-14')
image = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
image = preprocess(image).unsqueeze(0)
labels_list = ["a dog", "a cat", "a donut", "a beignet"]
text = tokenizer(labels_list, context_length=model.context_length)
with torch.no_grad(), torch.cuda.amp.autocast():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features = F.normalize(image_features, dim=-1)
text_features = F.normalize(text_features, dim=-1)
text_probs = torch.sigmoid(image_features @ text_features.T * model.logit_scale.exp() + model.logit_bias)
zipped_list = list(zip(labels_list, [round(p.item(), 3) for p in text_probs[0]]))
print("Label probabilities: ", zipped_list)
引用
@article{fang2023data,
title={Data Filtering Networks},
author={Fang, Alex and Jose, Albin Madappally and Jain, Amit and Schmidt, Ludwig and Toshev, Alexander and Shankar, Vaishaal},
journal={arXiv preprint arXiv:2309.17425},
year={2023}
}
正在翻译中,请稍候...
标签
clip
arxiv:2309.17425
license:apple-amlr
region:us