Run this model with HF Jobs
Run timm/test_convnext3.r160_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:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/timm/test_convnext3.r160_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.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/timm/test_convnext3.r160_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.
Instructions to use timm/test_convnext3.r160_in1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use timm/test_convnext3.r160_in1k with timm:
import timm model = timm.create_model("hf-hub:timm/test_convnext3.r160_in1k", pretrained=True) - Transformers
How to use timm/test_convnext3.r160_in1k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="timm/test_convnext3.r160_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/test_convnext3.r160_in1k") model = AutoModelForImageClassification.from_pretrained("timm/test_convnext3.r160_in1k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add model
Browse filesFiles changed (4)
- README.mdAdded+156
- config.jsonAdded+35
- model.safetensorsAdded+3
- pytorch_model.binAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156---tags:- image-classification- timmlibrary_name: timmlicense: apache-2.0datasets:- imagenet-1k---# Model card for test_convnext3.r160_in1k
A very small test ConvNeXt image classification model for testing and sanity checks. Trained on ImageNet-1k by Ross Wightman.
## Model Details- **Model Type:** Image classification / feature backbone- **Model Stats:** - Params (M): 0.5 - GMACs: 0.1 - Activations (M): 0.6 - Image size: 160 x 160- **Dataset:** ImageNet-1k- **Papers:** - PyTorch Image Models: https://github.com/huggingface/pytorch-image-models- **Original:** https://github.com/huggingface/pytorch-image-models
## Model Usage### Image Classification```pythonfrom urllib.request import urlopenfrom PIL import Imageimport timm
img = Image.open(urlopen( 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
model = timm.create_model('test_convnext3.r160_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)```
### Feature Map Extraction```pythonfrom urllib.request import urlopenfrom PIL import Imageimport timm
img = Image.open(urlopen( 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
model = timm.create_model( 'test_convnext3.r160_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, 40, 40]) # torch.Size([1, 64, 20, 20]) # torch.Size([1, 96, 10, 10]) # torch.Size([1, 128, 5, 5])
print(o.shape)```
### Image Embeddings```pythonfrom urllib.request import urlopenfrom PIL import Imageimport timm
img = Image.open(urlopen( 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
model = timm.create_model( 'test_convnext3.r160_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 unpooled, a (1, 128, 5, 5) shaped tensor
output = model.forward_head(output, pre_logits=True)# output is a (1, num_features) shaped tensor```
## Model Comparison### By Top-1
|model |img_size|top1 |top5 |param_count||--------------------------------|--------|------|------|-----------||test_convnext3.r160_in1k |192 |54.558|79.356|0.47 ||test_convnext2.r160_in1k |192 |53.62 |78.636|0.48 ||test_convnext2.r160_in1k |160 |53.51 |78.526|0.48 ||test_convnext3.r160_in1k |160 |53.328|78.318|0.47 ||test_convnext.r160_in1k |192 |48.532|74.944|0.27 ||test_nfnet.r160_in1k |192 |48.298|73.446|0.38 ||test_convnext.r160_in1k |160 |47.764|74.152|0.27 ||test_nfnet.r160_in1k |160 |47.616|72.898|0.38 ||test_efficientnet.r160_in1k |192 |47.164|71.706|0.36 ||test_efficientnet_evos.r160_in1k|192 |46.924|71.53 |0.36 ||test_byobnet.r160_in1k |192 |46.688|71.668|0.46 ||test_efficientnet_evos.r160_in1k|160 |46.498|71.006|0.36 ||test_efficientnet.r160_in1k |160 |46.454|71.014|0.36 ||test_byobnet.r160_in1k |160 |45.852|70.996|0.46 ||test_efficientnet_ln.r160_in1k |192 |44.538|69.974|0.36 ||test_efficientnet_gn.r160_in1k |192 |44.448|69.75 |0.36 ||test_efficientnet_ln.r160_in1k |160 |43.916|69.404|0.36 ||test_efficientnet_gn.r160_in1k |160 |43.88 |69.162|0.36 ||test_vit2.r160_in1k |192 |43.454|69.798|0.46 ||test_resnet.r160_in1k |192 |42.376|68.744|0.47 ||test_vit2.r160_in1k |160 |42.232|68.982|0.46 ||test_vit.r160_in1k |192 |41.984|68.64 |0.37 ||test_resnet.r160_in1k |160 |41.578|67.956|0.47 ||test_vit.r160_in1k |160 |40.946|67.362|0.37 |
## Citation```bibtex@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}}}```1234567891011121314151617181920212223242526272829303132333435{ "architecture": "test_convnext3", "num_classes": 1000, "num_features": 128, "pretrained_cfg": { "tag": "r160_in1k", "custom_load": false, "input_size": [ 3, 160, 160 ], "fixed_input_size": false, "interpolation": "bicubic", "crop_pct": 0.95, "crop_mode": "center", "mean": [ 0.5, 0.5, 0.5 ], "std": [ 0.5, 0.5, 0.5 ], "num_classes": 1000, "pool_size": [ 5, 5 ], "first_conv": "stem.0", "classifier": "head.fc" }}123version https://git-lfs.github.com/spec/v1oid sha256:d3457627c4b93ba2496c245504376310cc2228b90e6acea73dfce75f9e7164edsize 1880536123version https://git-lfs.github.com/spec/v1oid sha256:6f6de631cdf6f30c777d74e7b99d6f743016cf3577d1e37f3e9be81fdb282c52size 1896278README.mdAdded+156
config.jsonAdded+35
model.safetensorsAdded+3
pytorch_model.binAdded+3