๐ Transformers Library - AIMv2 Vision Models
This library provides access to the AIMv2 family of vision models, pre - trained with a multimodal autoregressive objective. These models offer high - performance in various vision tasks and outperform several state - of - the - art models on multiple benchmarks.
๐ Quick Start
Introduction
[AIMv2 Paper
] [BibTeX
]
We introduce the AIMv2 family of vision models pre - trained with a multimodal autoregressive objective. AIMv2 pre - training is simple and straightforward to train and scale effectively. Some AIMv2 highlights include:
- Outperforms OAI CLIP and SigLIP on the majority of multimodal understanding benchmarks.
- Outperforms DINOv2 on open - vocabulary object detection and referring expression comprehension.
- Exhibits strong recognition performance with AIMv2 - 3B achieving 89.5% on ImageNet using a frozen trunk.
โจ Features
- High - Performance: Outperforms many existing models on multiple vision benchmarks.
- Multimodal: Pre - trained with a multimodal autoregressive objective.
- Scalable: Easy to train and scale.
๐ฆ Installation
The document doesn't provide installation steps, so this section is skipped.
๐ป Usage Examples
Basic Usage
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-3B-patch14-448",
)
model = AutoModel.from_pretrained(
"apple/aimv2-3B-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-3B-patch14-448",
)
model = FlaxAutoModel.from_pretrained(
"apple/aimv2-3B-patch14-448",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="jax")
outputs = model(**inputs)
๐ Documentation
Model Information
Property |
Details |
Library Name |
transformers |
License |
apple - amlr |
Metrics |
accuracy |
Pipeline Tag |
image - feature - extraction |
Tags |
vision, image - feature - extraction, mlx, pytorch |
Model Performance
The model aimv2 - 3B - patch14 - 448
has the following performance on different classification tasks:
Dataset |
Accuracy |
imagenet - 1k |
89.5% |
inaturalist - 18 |
85.9% |
cifar10 |
99.5% |
cifar100 |
94.5% |
food101 |
97.4% |
dtd |
89.0% |
oxford - pets |
97.4% |
stanford - cars |
96.7% |
camelyon17 |
93.4% |
patch - camelyon |
89.9% |
rxrx1 |
9.5% |
eurosat |
98.9% |
fmow |
66.1% |
domainnet - infographic |
74.8% |
๐ License
The library uses the apple - amlr
license.
๐ Citation
If you find our work useful, please consider citing us as:
@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},
}