🚀 Transformers - 零樣本圖像分類模型
本項目引入了基於多模態自迴歸目標進行預訓練的AIMv2系列視覺模型。AIMv2預訓練簡單直接,易於訓練和有效擴展。該模型在多模態理解基準測試、開放詞彙目標檢測和指代表達理解等方面表現出色。
🚀 快速開始
模型信息
屬性 |
詳情 |
庫名稱 |
transformers |
許可證 |
apple-amlr |
任務類型 |
零樣本圖像分類 |
標籤 |
視覺、mlx、pytorch |
模型亮點
- 在大多數多模態理解基準測試中,性能優於OAI CLIP和SigLIP。
- 在開放詞彙目標檢測和指代表達理解方面,表現優於DINOv2。
- AIMv2 - 3B模型在使用凍結主幹的情況下,在ImageNet上達到了89.5%的識別準確率。

💻 使用示例
基礎用法
import requests
from PIL import Image
from transformers import AutoProcessor, AutoModel
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = ["Picture of a dog.", "Picture of a cat.", "Picture of a horse."]
processor = AutoProcessor.from_pretrained(
"apple/aimv2-large-patch14-224-lit",
)
model = AutoModel.from_pretrained(
"apple/aimv2-large-patch14-224-lit",
trust_remote_code=True,
)
inputs = processor(
images=image,
text=text,
add_special_tokens=True,
truncation=True,
padding=True,
return_tensors="pt",
)
outputs = model(**inputs)
probs = outputs.logits_per_image.softmax(dim=-1)
高級用法
JAX版本正在建設中。
📄 許可證
本項目使用的許可證為apple-amlr。
📚 詳細文檔
引用信息
如果您覺得我們的工作有用,請考慮引用我們的論文:
@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
]