Instructions to use saiadh57/pets-convnext-sagemaker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use saiadh57/pets-convnext-sagemaker with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="saiadh57/pets-convnext-sagemaker") 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("saiadh57/pets-convnext-sagemaker") model = AutoModelForImageClassification.from_pretrained("saiadh57/pets-convnext-sagemaker", device_map="auto") - Transformers.js
How to use saiadh57/pets-convnext-sagemaker with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-classification', 'saiadh57/pets-convnext-sagemaker'); - Notebooks
- Google Colab
- Kaggle
Upload model trained on Amazon SageMaker
Browse files- README.md +41 -0
- config.json +120 -0
- history.json +71 -0
- model.safetensors +3 -0
- onnx/model.onnx +3 -0
- preprocessor_config.json +22 -0
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: image-classification
|
| 5 |
+
base_model: facebook/convnext-tiny-224
|
| 6 |
+
datasets:
|
| 7 |
+
- timm/oxford-iiit-pet
|
| 8 |
+
tags:
|
| 9 |
+
- image-classification
|
| 10 |
+
- sagemaker
|
| 11 |
+
- oxford-pets
|
| 12 |
+
- onnx
|
| 13 |
+
- transformers.js
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Pet breed classifier (37 cat and dog breeds)
|
| 17 |
+
|
| 18 |
+
Fine-tuned on the [Oxford-IIIT Pet dataset](https://www.robots.ox.ac.uk/~vgg/data/pets/)
|
| 19 |
+
(80/20 stratified split; photo counts in the table below) with a SageMaker training job, for a
|
| 20 |
+
Distributed Computing class demo.
|
| 21 |
+
|
| 22 |
+
| | |
|
| 23 |
+
|---|---|
|
| 24 |
+
| base model | [facebook/convnext-tiny-224](https://huggingface.co/facebook/convnext-tiny-224) |
|
| 25 |
+
| epochs | 5 |
|
| 26 |
+
| validation accuracy | 93.2% |
|
| 27 |
+
| trained on | SageMaker training job `pets-pytorch-2026-11-10-18-15-53-005` (ml.g6.xlarge) |
|
| 28 |
+
| billable seconds | 214 |
|
| 29 |
+
| photos | 1,480 training / 370 validation |
|
| 30 |
+
|
| 31 |
+
## Use it
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from transformers import pipeline
|
| 35 |
+
classifier = pipeline("image-classification", model="saiadh57/pets-convnext-sagemaker")
|
| 36 |
+
classifier("my_cat.jpg")
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
**Breeds:** Abyssinian, Bengal, Birman, Bombay, British Shorthair, Egyptian Mau, Maine Coon, Persian, Ragdoll, Russian Blue, Siamese, Sphynx, American Bulldog, American Pit Bull Terrier, Basset Hound, Beagle, Boxer, Chihuahua, English Cocker Spaniel, English Setter, German Shorthaired, Great Pyrenees, Havanese, Japanese Chin, Keeshond, Leonberger, Miniature Pinscher, Newfoundland, Pomeranian, Pug, Saint Bernard, Samoyed, Scottish Terrier, Shiba Inu, Staffordshire Bull Terrier, Wheaten Terrier, Yorkshire Terrier.
|
| 40 |
+
|
| 41 |
+
Dataset: Parkhi et al., "Cats and Dogs", CVPR 2012; images under CC BY-SA 4.0.
|
config.json
ADDED
|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
768
|
| 19 |
+
],
|
| 20 |
+
"id2label": {
|
| 21 |
+
"0": "Abyssinian",
|
| 22 |
+
"1": "Bengal",
|
| 23 |
+
"2": "Birman",
|
| 24 |
+
"3": "Bombay",
|
| 25 |
+
"4": "British Shorthair",
|
| 26 |
+
"5": "Egyptian Mau",
|
| 27 |
+
"6": "Maine Coon",
|
| 28 |
+
"7": "Persian",
|
| 29 |
+
"8": "Ragdoll",
|
| 30 |
+
"9": "Russian Blue",
|
| 31 |
+
"10": "Siamese",
|
| 32 |
+
"11": "Sphynx",
|
| 33 |
+
"12": "American Bulldog",
|
| 34 |
+
"13": "American Pit Bull Terrier",
|
| 35 |
+
"14": "Basset Hound",
|
| 36 |
+
"15": "Beagle",
|
| 37 |
+
"16": "Boxer",
|
| 38 |
+
"17": "Chihuahua",
|
| 39 |
+
"18": "English Cocker Spaniel",
|
| 40 |
+
"19": "English Setter",
|
| 41 |
+
"20": "German Shorthaired",
|
| 42 |
+
"21": "Great Pyrenees",
|
| 43 |
+
"22": "Havanese",
|
| 44 |
+
"23": "Japanese Chin",
|
| 45 |
+
"24": "Keeshond",
|
| 46 |
+
"25": "Leonberger",
|
| 47 |
+
"26": "Miniature Pinscher",
|
| 48 |
+
"27": "Newfoundland",
|
| 49 |
+
"28": "Pomeranian",
|
| 50 |
+
"29": "Pug",
|
| 51 |
+
"30": "Saint Bernard",
|
| 52 |
+
"31": "Samoyed",
|
| 53 |
+
"32": "Scottish Terrier",
|
| 54 |
+
"33": "Shiba Inu",
|
| 55 |
+
"34": "Staffordshire Bull Terrier",
|
| 56 |
+
"35": "Wheaten Terrier",
|
| 57 |
+
"36": "Yorkshire Terrier"
|
| 58 |
+
},
|
| 59 |
+
"image_size": 224,
|
| 60 |
+
"initializer_range": 0.02,
|
| 61 |
+
"label2id": {
|
| 62 |
+
"Abyssinian": 0,
|
| 63 |
+
"American Bulldog": 12,
|
| 64 |
+
"American Pit Bull Terrier": 13,
|
| 65 |
+
"Basset Hound": 14,
|
| 66 |
+
"Beagle": 15,
|
| 67 |
+
"Bengal": 1,
|
| 68 |
+
"Birman": 2,
|
| 69 |
+
"Bombay": 3,
|
| 70 |
+
"Boxer": 16,
|
| 71 |
+
"British Shorthair": 4,
|
| 72 |
+
"Chihuahua": 17,
|
| 73 |
+
"Egyptian Mau": 5,
|
| 74 |
+
"English Cocker Spaniel": 18,
|
| 75 |
+
"English Setter": 19,
|
| 76 |
+
"German Shorthaired": 20,
|
| 77 |
+
"Great Pyrenees": 21,
|
| 78 |
+
"Havanese": 22,
|
| 79 |
+
"Japanese Chin": 23,
|
| 80 |
+
"Keeshond": 24,
|
| 81 |
+
"Leonberger": 25,
|
| 82 |
+
"Maine Coon": 6,
|
| 83 |
+
"Miniature Pinscher": 26,
|
| 84 |
+
"Newfoundland": 27,
|
| 85 |
+
"Persian": 7,
|
| 86 |
+
"Pomeranian": 28,
|
| 87 |
+
"Pug": 29,
|
| 88 |
+
"Ragdoll": 8,
|
| 89 |
+
"Russian Blue": 9,
|
| 90 |
+
"Saint Bernard": 30,
|
| 91 |
+
"Samoyed": 31,
|
| 92 |
+
"Scottish Terrier": 32,
|
| 93 |
+
"Shiba Inu": 33,
|
| 94 |
+
"Siamese": 10,
|
| 95 |
+
"Sphynx": 11,
|
| 96 |
+
"Staffordshire Bull Terrier": 34,
|
| 97 |
+
"Wheaten Terrier": 35,
|
| 98 |
+
"Yorkshire Terrier": 36
|
| 99 |
+
},
|
| 100 |
+
"layer_norm_eps": 1e-12,
|
| 101 |
+
"layer_scale_init_value": 1e-06,
|
| 102 |
+
"model_type": "convnext",
|
| 103 |
+
"num_channels": 3,
|
| 104 |
+
"num_stages": 4,
|
| 105 |
+
"out_features": [
|
| 106 |
+
"stage4"
|
| 107 |
+
],
|
| 108 |
+
"out_indices": [
|
| 109 |
+
4
|
| 110 |
+
],
|
| 111 |
+
"patch_size": 4,
|
| 112 |
+
"stage_names": [
|
| 113 |
+
"stem",
|
| 114 |
+
"stage1",
|
| 115 |
+
"stage2",
|
| 116 |
+
"stage3",
|
| 117 |
+
"stage4"
|
| 118 |
+
],
|
| 119 |
+
"transformers_version": "5.5.3"
|
| 120 |
+
}
|
history.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"history": [
|
| 3 |
+
{
|
| 4 |
+
"epoch": 1,
|
| 5 |
+
"train_loss": 3.4634249728658926,
|
| 6 |
+
"train_acc": 0.20923913043478262,
|
| 7 |
+
"val_loss": 3.064154529571533,
|
| 8 |
+
"val_acc": 0.6756756756756757,
|
| 9 |
+
"seconds": 10.89178466796875,
|
| 10 |
+
"images_per_sec": 152.62713903963754
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"epoch": 2,
|
| 14 |
+
"train_loss": 2.555748276088549,
|
| 15 |
+
"train_acc": 0.7778532608695652,
|
| 16 |
+
"val_loss": 1.9653766580530114,
|
| 17 |
+
"val_acc": 0.8567567567567568,
|
| 18 |
+
"seconds": 4.780801057815552,
|
| 19 |
+
"images_per_sec": 345.55967222398436
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"epoch": 3,
|
| 23 |
+
"train_loss": 1.6257723414379617,
|
| 24 |
+
"train_acc": 0.9110054347826086,
|
| 25 |
+
"val_loss": 1.3812899254463815,
|
| 26 |
+
"val_acc": 0.9135135135135135,
|
| 27 |
+
"seconds": 4.821037292480469,
|
| 28 |
+
"images_per_sec": 341.39205040690194
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"epoch": 4,
|
| 32 |
+
"train_loss": 1.2310751365578694,
|
| 33 |
+
"train_acc": 0.9504076086956522,
|
| 34 |
+
"val_loss": 1.2162863911809147,
|
| 35 |
+
"val_acc": 0.9297297297297298,
|
| 36 |
+
"seconds": 4.772476434707642,
|
| 37 |
+
"images_per_sec": 342.9579716447682
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"epoch": 5,
|
| 41 |
+
"train_loss": 1.1537121119706526,
|
| 42 |
+
"train_acc": 0.9510869565217391,
|
| 43 |
+
"val_loss": 1.1974056063471614,
|
| 44 |
+
"val_acc": 0.9324324324324325,
|
| 45 |
+
"seconds": 4.842451572418213,
|
| 46 |
+
"images_per_sec": 339.28143120792237
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"info": {
|
| 50 |
+
"args": {
|
| 51 |
+
"model_id": "facebook/convnext-tiny-224",
|
| 52 |
+
"epochs": 5,
|
| 53 |
+
"batch_size": 64,
|
| 54 |
+
"lr": 0.0002,
|
| 55 |
+
"weight_decay": 0.05,
|
| 56 |
+
"img_size": 224,
|
| 57 |
+
"augment": "strong",
|
| 58 |
+
"freeze_backbone": false,
|
| 59 |
+
"max_train_samples": 0,
|
| 60 |
+
"num_workers": -1,
|
| 61 |
+
"seed": 42,
|
| 62 |
+
"train_dir": "/opt/ml/input/data/train",
|
| 63 |
+
"val_dir": "/opt/ml/input/data/validation",
|
| 64 |
+
"model_dir": "/opt/ml/model"
|
| 65 |
+
},
|
| 66 |
+
"world_size": 1,
|
| 67 |
+
"device": "cuda:0",
|
| 68 |
+
"total_seconds": 30.247719764709473,
|
| 69 |
+
"gpu": "NVIDIA L4"
|
| 70 |
+
}
|
| 71 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6491fbe872785b2697301eff28c40a28b30ed99e69e6e39adbbf7b6112ee16db
|
| 3 |
+
size 111415628
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3f16814b817af9b2169d4ea506f6f3e646761f962485b5e693b5270b70b909d9
|
| 3 |
+
size 111458706
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_pct": 0.875,
|
| 3 |
+
"do_normalize": true,
|
| 4 |
+
"do_rescale": true,
|
| 5 |
+
"do_resize": true,
|
| 6 |
+
"image_mean": [
|
| 7 |
+
0.485,
|
| 8 |
+
0.456,
|
| 9 |
+
0.406
|
| 10 |
+
],
|
| 11 |
+
"image_processor_type": "ConvNextImageProcessor",
|
| 12 |
+
"image_std": [
|
| 13 |
+
0.229,
|
| 14 |
+
0.224,
|
| 15 |
+
0.225
|
| 16 |
+
],
|
| 17 |
+
"resample": 3,
|
| 18 |
+
"rescale_factor": 0.00392156862745098,
|
| 19 |
+
"size": {
|
| 20 |
+
"shortest_edge": 224
|
| 21 |
+
}
|
| 22 |
+
}
|