Rope Vit Reg4 B14 Capi Imagenet21k
R
Rope Vit Reg4 B14 Capi Imagenet21k
由 birder-project 开发
采用RoPE的ViT图像分类模型,经过CAPI预训练和ImageNet-21K微调,适用于图像分类和检测任务。
下载量 40
发布时间 : 5/10/2025
模型简介
该模型是一个基于Vision Transformer (ViT)架构的图像分类模型,采用了旋转位置编码(RoPE)技术。通过两阶段训练流程(CAPI预训练和ImageNet-21K微调)优化性能,支持图像分类、特征提取和检测任务。
模型特点
旋转位置编码(RoPE)
采用EVA风格的旋转位置编码,支持不同分辨率输入时的灵活配置,优化模型表现。
两阶段训练流程
先进行CAPI预训练,然后在ImageNet-21K数据集上微调,提升模型性能。
多任务支持
不仅支持图像分类,还可用于特征提取和目标检测任务。
模型能力
图像分类
特征提取
目标检测
使用案例
计算机视觉
鸟类识别
利用该模型进行鸟类图像分类和识别。
图像特征提取
提取图像特征用于下游任务,如图像检索或相似度计算。
目标检测
作为骨干网络用于目标检测任务。
🚀 rope_vit_reg4_b14_capi-imagenet21k模型卡片
这是一个基于RoPE的ViT图像分类模型。该模型采用两阶段训练流程:首先进行CAPI预训练,然后在ImageNet-21K
数据集上进行微调。
🚀 快速开始
本模型是一个RoPE ViT图像分类模型,采用两阶段训练,先进行CAPI预训练,再在ImageNet-21K
数据集上微调。
✨ 主要特性
- RoPE配置:本模型实现了EVA风格的旋转位置嵌入(RoPE)。当处理与训练分辨率(224x224)不同的分辨率时,可以通过配置
pt_grid_size
参数来优化模型行为。- 在较高分辨率下进行推理或进行“浅层”微调时,建议显式设置
pt_grid_size=(16, 16)
(预训练期间的默认网格大小)。 - 在较高分辨率下进行激进微调时,将
pt_grid_size
保留为None
,以使模型适应新的分辨率。
- 在较高分辨率下进行推理或进行“浅层”微调时,建议显式设置
📦 安装指南
文档未提供安装步骤,故跳过此章节。
💻 使用示例
基础用法
图像分类
import birder
from birder.inference.classification import infer_image
(net, model_info) = birder.load_pretrained_model("rope_vit_reg4_b14_capi-imagenet21k", inference=True)
# Get the image size the model was trained on
size = birder.get_size_from_signature(model_info.signature)
# Create an inference transform
transform = birder.classification_transform(size, model_info.rgb_stats)
image = "path/to/image.jpeg" # or a PIL image, must be loaded in RGB format
(out, _) = infer_image(net, image, transform)
# out is a NumPy array with shape of (1, 19167), representing class probabilities.
图像嵌入
import birder
from birder.inference.classification import infer_image
(net, model_info) = birder.load_pretrained_model("rope_vit_reg4_b14_capi-imagenet21k", inference=True)
# Get the image size the model was trained on
size = birder.get_size_from_signature(model_info.signature)
# Create an inference transform
transform = birder.classification_transform(size, model_info.rgb_stats)
image = "path/to/image.jpeg" # or a PIL image
(out, embedding) = infer_image(net, image, transform, return_embedding=True)
# embedding is a NumPy array with shape of (1, 768)
检测特征图
from PIL import Image
import birder
(net, model_info) = birder.load_pretrained_model("rope_vit_reg4_b14_capi-imagenet21k", inference=True)
# Get the image size the model was trained on
size = birder.get_size_from_signature(model_info.signature)
# Create an inference transform
transform = birder.classification_transform(size, model_info.rgb_stats)
image = Image.open("path/to/image.jpeg")
features = net.detection_features(transform(image).unsqueeze(0))
# features is a dict (stage name -> torch.Tensor)
print([(k, v.size()) for k, v in features.items()])
# Output example:
# [('neck', torch.Size([1, 768, 16, 16]))]
高级用法
设置pt_grid_size
进行推理
# When running inference with a custom resolution (e.g., 336x336)
python predict.py --network rope_vit_reg4_b14 -t capi-imagenet21k --model-config '{"pt_grid_size":[16, 16]}' --size 336 ...
转换具有显式RoPE配置的模型
python tool.py convert-model --network rope_vit_reg4_b14 -t capi-imagenet21k --add-config '{"pt_grid_size":[16, 16]}'
📚 详细文档
模型详情
属性 | 详情 |
---|---|
模型类型 | 图像分类和检测骨干网络 |
模型统计信息 | 参数(M):100.5;输入图像大小:224 x 224 |
数据集 | ImageNet-21K(19167个类别) |
论文 |
- [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929)
- [Rotary Position Embedding for Vision Transformer](https://arxiv.org/abs/2403.13298)
- [Vision Transformers Need Registers](https://arxiv.org/abs/2309.16588)
- [Cluster and Predict Latent Patches for Improved Masked Image Modeling](https://arxiv.org/abs/2502.08769) |
🔧 技术细节
文档未提供足够的技术实现细节(未超过50字),故跳过此章节。
📄 许可证
本项目采用Apache-2.0许可证。
📖 引用
@misc{dosovitskiy2021imageworth16x16words,
title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale},
author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby},
year={2021},
eprint={2010.11929},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2010.11929},
}
@misc{heo2024rotarypositionembeddingvision,
title={Rotary Position Embedding for Vision Transformer},
author={Byeongho Heo and Song Park and Dongyoon Han and Sangdoo Yun},
year={2024},
eprint={2403.13298},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2403.13298},
}
@misc{darcet2024visiontransformersneedregisters,
title={Vision Transformers Need Registers},
author={Timothée Darcet and Maxime Oquab and Julien Mairal and Piotr Bojanowski},
year={2024},
eprint={2309.16588},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2309.16588},
}
@misc{darcet2025clusterpredictlatentpatches,
title={Cluster and Predict Latent Patches for Improved Masked Image Modeling},
author={Timothée Darcet and Federico Baldassarre and Maxime Oquab and Julien Mairal and Piotr Bojanowski},
year={2025},
eprint={2502.08769},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.08769},
}
Nsfw Image Detection
Apache-2.0
基于ViT架构的NSFW图像分类模型,通过监督学习在ImageNet-21k数据集上预训练,并在80,000张图像上微调,用于区分正常和NSFW内容。
图像分类
Transformers

N
Falconsai
82.4M
588
Fairface Age Image Detection
Apache-2.0
基于Vision Transformer架构的图像分类模型,在ImageNet-21k数据集上预训练,适用于多类别图像分类任务
图像分类
Transformers

F
dima806
76.6M
10
Dinov2 Small
Apache-2.0
基于DINOv2方法训练的小尺寸视觉Transformer模型,通过自监督学习提取图像特征
图像分类
Transformers

D
facebook
5.0M
31
Vit Base Patch16 224
Apache-2.0
基于ImageNet-21k预训练和ImageNet微调的视觉变换器模型,用于图像分类任务
图像分类
V
google
4.8M
775
Vit Base Patch16 224 In21k
Apache-2.0
基于ImageNet-21k数据集预训练的视觉Transformer模型,用于图像分类任务。
图像分类
V
google
2.2M
323
Dinov2 Base
Apache-2.0
基于DINOv2方法训练的视觉Transformer模型,通过自监督学习提取图像特征
图像分类
Transformers

D
facebook
1.9M
126
Gender Classification
一个基于PyTorch和HuggingPics构建的图像分类模型,用于识别图像中的性别
图像分类
Transformers

G
rizvandwiki
1.8M
48
Vit Base Nsfw Detector
Apache-2.0
基于Vision Transformer (ViT)架构的图像分类模型,专门用于检测图像是否包含NSFW(不安全)内容。
图像分类
Transformers

V
AdamCodd
1.2M
47
Vit Hybrid Base Bit 384
Apache-2.0
混合视觉变换器(ViT)模型结合了卷积网络和Transformer架构,用于图像分类任务,在ImageNet上表现出色。
图像分类
Transformers

V
google
992.28k
6
Gender Classification 2
这是一个基于PyTorch框架和HuggingPics工具生成的图像分类模型,专门用于性别分类任务。
图像分类
Transformers

G
rizvandwiki
906.98k
32
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98