ILSVRC/imagenet-1k
Viewer • Updated • 1.43M • 102k • 1.2k
Run timm/emo2_1m.in1k on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/timm/emo2_1m.in1k. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/timm/emo2_1m.in1k on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use timm/emo2_1m.in1k with timm:
import timm
model = timm.create_model("hf-hub:timm/emo2_1m.in1k", pretrained=True)How to use timm/emo2_1m.in1k with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="timm/emo2_1m.in1k")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("timm/emo2_1m.in1k")
model = AutoModelForImageClassification.from_pretrained("timm/emo2_1m.in1k", device_map="auto")An EMOv2 image classification model. EMOv2 extends the EMO Inverted Residual Mobile Block (iRMB) with a parameter-sharing spanning attention mechanism that mixes local window attention with a strided global attention path. Trained on ImageNet-1k by the paper authors. The official checkpoint was converted to the timm state-dict layout.
features_only=True.from urllib.request import urlopen
from PIL import Image
import torch
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model('emo2_1m.in1k', pretrained=True)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model(
'emo2_1m.in1k',
pretrained=True,
features_only=True,
)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
for o in output:
# print shape of each feature map in output
# e.g.:
# torch.Size([1, 32, 56, 56])
# torch.Size([1, 48, 28, 28])
# torch.Size([1, 80, 14, 14])
# torch.Size([1, 180, 7, 7])
print(o.shape)
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model(
'emo2_1m.in1k',
pretrained=True,
num_classes=0, # remove classifier nn.Linear
)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_features) shaped tensor
# or equivalently (without needing to set num_classes=0)
output = model.forward_features(transforms(img).unsqueeze(0))
# output is an unpooled (1, 180, 7, 7) shaped tensor
output = model.forward_head(output, pre_logits=True)
# output is a (1, num_features) shaped tensor
ImageNet-1k validation accuracy evaluated in timm (bicubic interpolation, crop_pct=0.875).
| Model | Params (M) | Image Size | Top-1 | Top-5 |
|---|---|---|---|---|
| emo_1m.in1k | 1.36 | 224 | 71.490 | 90.366 |
| emo_2m.in1k | 2.38 | 224 | 75.122 | 92.196 |
| emo_5m.in1k | 5.11 | 224 | 78.422 | 93.970 |
| emo_6m.in1k | 6.17 | 224 | 78.984 | 94.156 |
| emo2_1m.in1k | 1.46 | 224 | 72.322 | 90.788 |
| emo2_1m.dist_in1k | 1.46 | 224 | 73.484 | 91.188 |
| emo2_2m.in1k | 2.38 | 224 | 75.774 | 92.714 |
| emo2_2m.dist_in1k | 2.38 | 224 | 76.678 | 92.988 |
| emo2_5m.in1k | 5.13 | 224 | 79.442 | 94.458 |
| emo2_5m.dist_in1k | 5.13 | 224 | 80.852 | 95.010 |
| emo2_5m_512.dist_in1k | 5.13 | 512 | 82.920 | 96.106 |
@article{zhang2025emov2,
title={EMOv2: Pushing 5M Vision Model Frontier},
author={Zhang, Jiangning and Hu, Teng and He, Haoyang and Xue, Zhucun and Wang, Yabiao and Wang, Chengjie and Liu, Yong and Li, Xiangtai and Tao, Dacheng},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
year={2025},
publisher={IEEE}
}
@inproceedings{zhang2023rethinking,
title={Rethinking Mobile Block for Efficient Attention-based Models},
author={Zhang, Jiangning and Li, Xiangtai and Li, Jian and Liu, Liang and Xue, Zhucun and Zhang, Boshen and Jiang, Zhengkai and Huang, Tianxin and Wang, Yabiao and Wang, Chengjie},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
pages={1389--1400},
year={2023}
}
@misc{rw2019timm,
author = {Ross Wightman},
title = {PyTorch Image Models},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
doi = {10.5281/zenodo.4414861},
howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
}