timm documentation

CaiT

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v1.0.31).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

CaiT

类别: ViT · 代码: timm/models/cait.py · 架构: 10 · 预训练权重: 10(10 个具有 ImageNet-1k 结果)

图像 Transformer 中的类别注意力(CaiT),一种深层视觉 Transformer,使用 LayerScale 并以类别注意力层收尾,这些层仅根据 patch token 更新类别 token。

论文

用法

请参阅快速入门了解如何加载预训练权重、进行图像预处理和微调,以及查阅特征提取了解如何将模型用作骨干网络。

>>> import timm
>>> model = timm.create_model('cait_xs24_384.fb_dist_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

模型 API 支持

功能Cait
features_only=True 特征图✓(strides 16, 16, 16)
forward_intermediates()✓
prune_intermediate_layers()✓
任意输入尺寸,无需更改✗
set_input_size()✗
dynamic_img_size=True✗
set_grad_checkpointing()✓
逐层学习率衰减(group_matcher())✓
reset_classifier()✓

✓ 支持,✓ (square) 仅支持方形尺寸,✗ 不支持,– 无需支持(该模型本身已接受任意输入尺寸)。通过在每个功能上运行随机初始化的模型(Cait 使用 cait_xxs24_224,尺寸为 224)进行验证,预期同一类的其他架构表现相同。详情请参阅 Model API 页面。

架构

架构参数(M)GMAC输入大小预训练权重
cait_m36_384271.22173.113841
cait_m48_448356.46329.414481
cait_s24_22446.929.352241
cait_s24_38447.0632.173841
cait_s36_38468.3747.993841
cait_xs24_38426.6719.283841
cait_xxs24_22411.962.532241
cait_xxs24_38412.039.633841
cait_xxs36_22417.303.772241
cait_xxs36_38417.3714.353841

GMACs 和参数量对应于每种架构的默认输入大小和分类器,数据来自基准测试结果。

预训练权重

Top-1 是 results-imagenet.csv 中在所列评估规模下的 ImageNet-1k 验证准确率,- 表示该权重没有 ImageNet-1k 结果(例如预训练权重或图文权重)。Classes 是预训练分类器的大小,对于没有分类器的权重则为 none。

权重输入大小Top-1(%)评估大小类许可证Hub
cait_m36_384.fb_dist_in1k38486.0603841000apache-2.0timm
cait_m48_448.fb_dist_in1k44886.4804481000apache-2.0timm
cait_s24_224.fb_dist_in1k22483.4842241000apache-2.0timm
cait_s24_384.fb_dist_in1k38485.0483841000apache-2.0timm
cait_s36_384.fb_dist_in1k38485.4583841000apache-2.0timm
cait_xs24_384.fb_dist_in1k38484.0643841000apache-2.0timm
cait_xxs24_224.fb_dist_in1k22478.4002241000apache-2.0timm
cait_xxs24_384.fb_dist_in1k38480.9543841000apache-2.0timm
cait_xxs36_224.fb_dist_in1k22479.7502241000apache-2.0timm
cait_xxs36_384.fb_dist_in1k38482.2043841000apache-2.0timm
Update on GitHub