dboris commited on
Commit
d7dc237
·
verified ·
1 Parent(s): cb49ee9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +104 -0
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - image-classification
5
+ - dog-breeds
6
+ - fine-grained
7
+ - arcface
8
+ - convnext
9
+ - pytorch
10
+ datasets:
11
+ - stanford-dogs
12
+ metrics:
13
+ - accuracy
14
+ pipeline_tag: image-classification
15
+ model-index:
16
+ - name: Petus Breed Classifier (convnextv2_tiny)
17
+ results:
18
+ - task:
19
+ type: image-classification
20
+ dataset:
21
+ name: Stanford Dogs
22
+ type: stanford-dogs
23
+ metrics:
24
+ - name: Top-1 Accuracy (Val)
25
+ type: accuracy
26
+ value: 91.4
27
+ - name: Top-5 Accuracy (Val)
28
+ type: accuracy
29
+ value: 99.2
30
+ ---
31
+
32
+ # Petus Breed Classifier (convnextv2_tiny)
33
+
34
+ Dog breed classifier trained on Stanford Dogs (120 breeds) using **convnextv2_tiny** backbone with **ArcFace** angular margin loss and progressive resizing.
35
+
36
+ ## Model Details
37
+
38
+ | Property | Value |
39
+ |----------|-------|
40
+ | Backbone | convnextv2_tiny |
41
+ | Loss | ArcFace (s=30.0, m=0.3) |
42
+ | Parameters | 28,323,200 |
43
+ | Input Size | 336px |
44
+ | Val Top-1 | **91.4%** |
45
+ | Val Top-5 | **99.2%** |
46
+ | Training | 2-phase (frozen head → unfrozen backbone) |
47
+ | Progressive Resize | 224 → 336px |
48
+
49
+ ## Training Recipe (v3)
50
+
51
+ 1. **Phase 1**: Frozen backbone, train ArcFace head only (2 epochs)
52
+ 2. **Phase 2**: Unfreeze backbone with 1/100th LR, cosine annealing (48 epochs)
53
+ - 3-epoch linear LR warmup after unfreeze
54
+ - Progressive resize from 224→336 mid-training
55
+ - ArcFace angular margin loss (no MixUp/CutMix needed)
56
+ - Early stopping with patience=10
57
+
58
+ ## Usage
59
+
60
+ ```python
61
+ import torch
62
+ from torchvision import transforms
63
+ from PIL import Image
64
+
65
+ # Load model
66
+ checkpoint = torch.load("convnextv2_tiny_best.pt", map_location="cpu")
67
+
68
+ # Preprocess
69
+ transform = transforms.Compose([
70
+ transforms.Resize(384), # 336 * 1.14
71
+ transforms.CenterCrop(336),
72
+ transforms.ToTensor(),
73
+ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
74
+ ])
75
+
76
+ image = Image.open("dog.jpg").convert("RGB")
77
+ input_tensor = transform(image).unsqueeze(0)
78
+
79
+ # Inference
80
+ model.eval()
81
+ with torch.no_grad():
82
+ logits = model(input_tensor)
83
+ pred = logits.argmax(dim=1).item()
84
+ confidence = logits.softmax(dim=1).max().item()
85
+ ```
86
+
87
+ ## Breeds
88
+
89
+ 120 dog breeds from the Stanford Dogs dataset (synsets from ImageNet).
90
+
91
+ ## Citation
92
+
93
+ ```bibtex
94
+ @misc{petus-breed-ml,
95
+ author = {199 Biotechnologies},
96
+ title = {Petus Breed Classifier},
97
+ year = {2026},
98
+ url = {https://github.com/199-biotechnologies/petus-breed-ml}
99
+ }
100
+ ```
101
+
102
+ ## License
103
+
104
+ Apache 2.0