๐ AIMv2 Vision Models
The AIMv2 family of vision models is pre - trained with a multimodal autoregressive objective, offering high - performance solutions for various vision tasks.
๐ Quick Start
The AIMv2 models are designed to be used with the transformers
library. They are pre - trained using a multimodal autoregressive objective, which makes them effective for a wide range of vision tasks.
โจ Features
- Multimodal Performance: Outperforms OAI CLIP and SigLIP on the majority of multimodal understanding benchmarks.
- Open - Vocabulary Tasks: Outperforms DINOv2 on open - vocabulary object detection and referring expression comprehension.
- Strong Recognition: AIMv2 - 3B achieves 89.5% on ImageNet using a frozen trunk.
๐ฆ Installation
Since the models are part of the transformers
library, you can install it using pip
:
pip install transformers
๐ป 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-large-patch14-448",
)
model = AutoModel.from_pretrained(
"apple/aimv2-large-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-large-patch14-448",
)
model = FlaxAutoModel.from_pretrained(
"apple/aimv2-large-patch14-448",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="jax")
outputs = model(**inputs)
๐ Documentation
Model Information
Property |
Details |
Library Name |
transformers |
Model Type |
image - feature - extraction |
License |
apple - amlr |
Metrics |
accuracy |
Tags |
vision, image - feature - extraction, mlx, pytorch |
Performance Metrics
The aimv2-large-patch14-448
model has the following performance on different classification tasks:
Dataset |
Accuracy |
imagenet - 1k |
87.9 |
inaturalist - 18 |
81.3 |
cifar10 |
99.1 |
cifar100 |
92.4 |
food101 |
96.6 |
dtd |
88.9 |
oxford - pets |
96.5 |
stanford - cars |
96.6 |
camelyon17 |
94.1 |
patch - camelyon |
89.6 |
rxrx1 |
7.4 |
eurosat |
98.6 |
fmow |
62.8 |
domainnet - infographic |
72.7 |
๐ License
This project is licensed under 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},
}