eva_giant_patch14_224.clip_ft_in1k

我要开发同款
匿名用户2024年07月31日
15阅读
开发技术pytorch
所属分类ai、timm、image-classification
开源地址https://modelscope.cn/models/timm/eva_giant_patch14_224.clip_ft_in1k
授权协议mit

作品详情

Model card for evagiantpatch14224.clipft_in1k

An EVA-CLIP image classification model. Pretrained on LAION-400M with CLIP and fine-tuned on ImageNet-1k by paper authors. EVA-CLIP uses MIM pretrained image towers and pretrained text towers, FLIP patch dropout, and different optimizers and hparams to accelerate training.

NOTE: timm checkpoints are float32 for consistency with other models. Original checkpoints are float16 or bfloat16 in some cases, see originals if that's preferred.

Model Details

  • Model Type: Image classification / feature backbone
  • Model Stats:
  • Params (M): 1012.6
  • GMACs: 267.2
  • Activations (M): 192.6
  • Image size: 224 x 224
  • Papers:
  • EVA-CLIP: Improved Training Techniques for CLIP at Scale: https://arxiv.org/abs/2303.15389
  • Original:
  • https://github.com/baaivision/EVA
  • https://huggingface.co/QuanSun/EVA-CLIP

Model Usage

Image Classification

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model('eva_giant_patch14_224.clip_ft_in1k', pretrained=True)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0))  # unsqueeze single image into batch of 1

top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)

Image Embeddings

from urllib.request import urlopen
from PIL import Image
import timm

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

model = timm.create_model(
    'eva_giant_patch14_224.clip_ft_in1k',
    pretrained=True,
    num_classes=0,  # remove classifier nn.Linear
)
model = model.eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

output = model(transforms(img).unsqueeze(0))  # output is (batch_size, num_features) shaped tensor

# or equivalently (without needing to set num_classes=0)

output = model.forward_features(transforms(img).unsqueeze(0))
# output is unpooled, a (1, 257, 1408) shaped tensor

output = model.forward_head(output, pre_logits=True)
# output is a (1, num_features) shaped tensor

Model Comparison

Explore the dataset and runtime metrics of this model in timm model results.

model top1 top5 param_count img_size
eva02largepatch14448.mimm38mftin22k_in1k 90.054 99.042 305.08 448
eva02largepatch14448.mimin22kftin22k_in1k 89.946 99.01 305.08 448
evagiantpatch14560.m30mftin22kin1k 89.792 98.992 1014.45 560
eva02largepatch14448.mimin22kftin1k 89.626 98.954 305.08 448
eva02largepatch14448.mimm38mftin1k 89.57 98.918 305.08 448
evagiantpatch14336.m30mftin22kin1k 89.56 98.956 1013.01 336
evagiantpatch14336.clipft_in1k 89.466 98.82 1013.01 336
evalargepatch14336.in22kftin22kin1k 89.214 98.854 304.53 336
evagiantpatch14224.clipft_in1k 88.882 98.678 1012.56 224
eva02basepatch14448.mimin22kftin22k_in1k 88.692 98.722 87.12 448
evalargepatch14336.in22kft_in1k 88.652 98.722 304.53 336
evalargepatch14196.in22kftin22kin1k 88.592 98.656 304.14 196
eva02basepatch14448.mimin22kftin1k 88.23 98.564 87.12 448
evalargepatch14196.in22kft_in1k 87.934 98.504 304.14 196
eva02smallpatch14336.mimin22kftin1k 85.74 97.614 22.13 336
eva02tinypatch14336.mimin22kftin1k 80.658 95.524 5.76 336

Citation

@article{EVA-CLIP,
  title={EVA-02: A Visual Representation for Neon Genesis},
  author={Sun, Quan and Fang, Yuxin and Wu, Ledell and Wang, Xinlong and Cao, Yue},
  journal={arXiv preprint arXiv:2303.15389},
  year={2023}
}
@misc{rw2019timm,
  author = {Ross Wightman},
  title = {PyTorch Image Models},
  year = {2019},
  publisher = {GitHub},
  journal = {GitHub repository},
  doi = {10.5281/zenodo.4414861},
  howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
}
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论