shi-labs / nat-base-in1k-224

huggingface.co
Total runs: 30
24-hour runs: 0
7-day runs: 1
30-day runs: 25
Model's Last Updated: November 19 2022
image-classification

Introduction of nat-base-in1k-224

Model Details of nat-base-in1k-224

NAT (base variant)

NAT-Base trained on ImageNet-1K at 224x224 resolution. It was introduced in the paper Neighborhood Attention Transformer by Hassani et al. and first released in this repository .

Model description

NAT is a hierarchical vision transformer based on Neighborhood Attention (NA). Neighborhood Attention is a restricted self attention pattern in which each token's receptive field is limited to its nearest neighboring pixels. NA is a sliding-window attention patterns, and as a result is highly flexible and maintains translational equivariance.

NA is implemented in PyTorch implementations through its extension, NATTEN .

model image

Source

Intended uses & limitations

You can use the raw model for image classification. See the model hub to look for fine-tuned versions on a task that interests you.

Example

Here is how to use this model to classify an image from the COCO 2017 dataset into one of the 1,000 ImageNet classes:

from transformers import AutoImageProcessor, NatForImageClassification
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

feature_extractor = AutoImageProcessor.from_pretrained("shi-labs/nat-base-in1k-224")
model = NatForImageClassification.from_pretrained("shi-labs/nat-base-in1k-224")

inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 1000 ImageNet classes
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])

For more examples, please refer to the documentation .

Requirements

Other than transformers, this model requires the NATTEN package.

If you're on Linux, you can refer to shi-labs.com/natten for instructions on installing with pre-compiled binaries (just select your torch build to get the correct wheel URL).

You can alternatively use pip install natten to compile on your device, which may take up to a few minutes. Mac users only have the latter option (no pre-compiled binaries).

Refer to NATTEN's GitHub for more information.

BibTeX entry and citation info
@article{hassani2022neighborhood,
    title        = {Neighborhood Attention Transformer},
    author       = {Ali Hassani and Steven Walton and Jiachen Li and Shen Li and Humphrey Shi},
    year         = 2022,
    url          = {https://arxiv.org/abs/2204.07143},
    eprint       = {2204.07143},
    archiveprefix = {arXiv},
    primaryclass = {cs.CV}
}

Runs of shi-labs nat-base-in1k-224 on huggingface.co

30
Total runs
0
24-hour runs
0
3-day runs
1
7-day runs
25
30-day runs

More Information About nat-base-in1k-224 huggingface.co Model

More nat-base-in1k-224 license Visit here:

https://choosealicense.com/licenses/mit

nat-base-in1k-224 huggingface.co

nat-base-in1k-224 huggingface.co is an AI model on huggingface.co that provides nat-base-in1k-224's model effect (), which can be used instantly with this shi-labs nat-base-in1k-224 model. huggingface.co supports a free trial of the nat-base-in1k-224 model, and also provides paid use of the nat-base-in1k-224. Support call nat-base-in1k-224 model through api, including Node.js, Python, http.

nat-base-in1k-224 huggingface.co Url

https://huggingface.co/shi-labs/nat-base-in1k-224

shi-labs nat-base-in1k-224 online free

nat-base-in1k-224 huggingface.co is an online trial and call api platform, which integrates nat-base-in1k-224's modeling effects, including api services, and provides a free online trial of nat-base-in1k-224, you can try nat-base-in1k-224 online for free by clicking the link below.

shi-labs nat-base-in1k-224 online free url in huggingface.co:

https://huggingface.co/shi-labs/nat-base-in1k-224

nat-base-in1k-224 install

nat-base-in1k-224 is an open source model from GitHub that offers a free installation service, and any user can find nat-base-in1k-224 on GitHub to install. At the same time, huggingface.co provides the effect of nat-base-in1k-224 install, users can directly use nat-base-in1k-224 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

nat-base-in1k-224 install url in huggingface.co:

https://huggingface.co/shi-labs/nat-base-in1k-224

Url of nat-base-in1k-224

nat-base-in1k-224 huggingface.co Url

Provider of nat-base-in1k-224 huggingface.co

shi-labs
ORGANIZATIONS

Other API from shi-labs

huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:June 08 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 01 2025