Visual-Attention-Network/van-small
141
1---2license: apache-2.03tags:4- vision5- image-classification6 7datasets:8- imagenet-1k9 10widget:11- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg12 example_title: Tiger13- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg14 example_title: Teapot15- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg16 example_title: Palace17 18---19 20# Van21 22Van model trained on imagenet-1k. It was introduced in the paper [Visual Attention Network](https://arxiv.org/abs/2202.09741) and first released in [this repository](https://github.com/Visual-Attention-Network/VAN-Classification). 23 24Disclaimer: The team releasing Van did not write a model card for this model so this model card has been written by the Hugging Face team.25 26## Model description27 28This paper introduces a new attention layer based on convolution operations able to capture both local and distant relationships. This is done by combining normal and large kernel convolution layers. The latter uses a dilated convolution to capture distant correlations.29 3031 32## Intended uses & limitations33 34You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=van) to look for35fine-tuned versions on a task that interests you.36 37### How to use38 39Here is how to use this model:40 41```python42>>> from transformers import AutoFeatureExtractor, VanForImageClassification43>>> import torch44>>> from datasets import load_dataset45 46>>> dataset = load_dataset("huggingface/cats-image")47>>> image = dataset["test"]["image"][0]48 49>>> feature_extractor = AutoFeatureExtractor.from_pretrained("Visual-Attention-Network/van-base")50>>> model = VanForImageClassification.from_pretrained("Visual-Attention-Network/van-base")51 52>>> inputs = feature_extractor(image, return_tensors="pt")53 54>>> with torch.no_grad():55... logits = model(**inputs).logits56 57>>> # model predicts one of the 1000 ImageNet classes58>>> predicted_label = logits.argmax(-1).item()59>>> print(model.config.id2label[predicted_label])60tabby, tabby cat61```62 63 64 65For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/van).