🚀 图像特征提取模型transformers
本项目引入了基于多模态自回归目标预训练的AIMv2系列视觉模型。AIMv2预训练简单直接,能够有效进行训练和扩展。该模型在多个多模态理解基准测试中表现出色,在开放词汇目标检测和指代表达理解等任务上也有优秀的表现。
🚀 快速开始
本项目提供了transformers
库,可用于图像特征提取。下面是使用该库的基本步骤。
✨ 主要特性
- 在大多数多模态理解基准测试中,性能优于OAI CLIP和SigLIP。
- 在开放词汇目标检测和指代表达理解任务上,性能优于DINOv2。
- 具有强大的识别性能,AIMv2 - 3B在使用冻结主干的情况下,在ImageNet上达到了89.5%的准确率。
📦 安装指南
文档未提供具体安装步骤,可参考transformers
库的官方文档进行安装。
💻 使用示例
基础用法
PyTorch
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained(
"apple/aimv2-1B-patch14-448",
)
model = AutoModel.from_pretrained(
"apple/aimv2-1B-patch14-448",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
JAX
import requests
from PIL import Image
from transformers import AutoImageProcessor, FlaxAutoModel
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained(
"apple/aimv2-1B-patch14-448",
)
model = FlaxAutoModel.from_pretrained(
"apple/aimv2-1B-patch14-448",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="jax")
outputs = model(**inputs)
📚 详细文档
模型信息
属性 |
详情 |
库名称 |
transformers |
许可证 |
apple - amlr |
评估指标 |
accuracy |
任务类型 |
image - feature - extraction |
标签 |
vision、image - feature - extraction、mlx、pytorch |
模型名称 |
aimv2 - 1B - patch14 - 448 |
模型在不同数据集上的分类准确率
数据集名称 |
数据集类型 |
准确率 |
是否验证 |
imagenet - 1k |
imagenet - 1k |
89.0 |
false |
inaturalist - 18 |
inaturalist - 18 |
83.8 |
false |
cifar10 |
cifar10 |
99.4 |
false |
cifar100 |
cifar100 |
94.1 |
false |
food101 |
food101 |
97.2 |
false |
dtd |
dtd |
88.9 |
false |
oxford - pets |
oxford - pets |
97.1 |
false |
stanford - cars |
stanford - cars |
96.6 |
false |
camelyon17 |
camelyon17 |
93.5 |
false |
patch - camelyon |
patch - camelyon |
89.9 |
false |
rxrx1 |
rxrx1 |
9.2 |
false |
eurosat |
eurosat |
99.1 |
false |
fmow |
fmow |
65.9 |
false |
domainnet - infographic |
domainnet - infographic |
74.4 |
false |
引用信息
如果您觉得我们的工作有用,请考虑按以下方式引用:
@misc{fini2024multimodalautoregressivepretraininglarge,
author = {Fini, Enrico and Shukor, Mustafa and Li, Xiujun and Dufter, Philipp and Klein, Michal and Haldimann, David and Aitharaju, Sai and da Costa, Victor Guilherme Turrisi and Béthune, Louis and Gan, Zhe and Toshev, Alexander T and Eichner, Marcin and Nabi, Moin and Yang, Yinfei and Susskind, Joshua M. and El-Nouby, Alaaeldin},
url = {https://arxiv.org/abs/2411.14402},
eprint = {2411.14402},
eprintclass = {cs.CV},
eprinttype = {arXiv},
title = {Multimodal Autoregressive Pre-training of Large Vision Encoders},
year = {2024},
}
参考链接
[AIMv2 Paper
] [BibTeX
]
模型概述图

📄 许可证
本项目使用的许可证为apple-amlr
。