Eraly-ml commited on
Commit
50085da
·
verified ·
1 Parent(s): 8e4627d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +128 -0
README.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - issai/Central_Asian_Food_Dataset
5
+ language:
6
+ - en
7
+ metrics:
8
+ - accuracy
9
+ - F1
10
+ base_model:
11
+ - microsoft/resnet-50
12
+ pipeline_tag: image-classification
13
+ tags:
14
+ - classification
15
+ - image
16
+ - pytorch
17
+ - safetensors
18
+ - ResNet
19
+ library_name: transformers
20
+ ---
21
+
22
+ # ResNet-50 Model for Central Asian Image Classification
23
+
24
+ ## Model Description
25
+
26
+ This is a pre-trained ResNet-50 model fine-tuned on the Central Asian Food Dataset. The model is used for image classification across multiple classes. The data was split into training, validation, and test sets. The model was trained using gradient descent with an SGD optimizer and CrossEntropyLoss as the loss function.
27
+
28
+ ## Training Parameters
29
+
30
+ - **Epochs:** 25
31
+ - **Batch Size:** 32
32
+ - **Learning Rate:** 0.001
33
+ - **Optimizer:** SGD with momentum of 0.9
34
+ - **Loss Function:** CrossEntropyLoss
35
+
36
+ ## Results
37
+
38
+ ### Training and Validation, F1
39
+
40
+ | Stage | Loss (train) | Accuracy (train) | Loss (val) | Accuracy (val) |
41
+ |--------------|--------------|------------------|------------|----------------|
42
+ | Epoch 1 | 2.1171 | 47.00% | 0.8727 | 75.00% |
43
+ | Epoch 2 | 1.0462 | 69.00% | 0.6721 | 78.00% |
44
+ | ... | ... | ... | ... | ... |
45
+ | Epoch 25 | 0.4286 | 86.00% | 0.4349 | 86.00% |
46
+
47
+ **Model was trained on two T4 GPUs in a Kaggle notebook trained 36m 7s**
48
+ **Best validation accuracy:** 86,54%
49
+ ```
50
+ precision recall f1-score support
51
+
52
+ achichuk 0.91 0.98 0.94 41
53
+ airan-katyk 0.84 0.93 0.89 46
54
+ asip 0.78 0.57 0.66 37
55
+ bauyrsak 0.90 0.90 0.90 62
56
+ beshbarmak-w-kazy 0.71 0.84 0.77 44
57
+ beshbarmak-wo-kazy 0.86 0.69 0.76 61
58
+ chak-chak 0.94 0.94 0.94 93
59
+ cheburek 0.92 0.88 0.90 94
60
+ doner-lavash 0.77 1.00 0.87 20
61
+ doner-nan 0.86 0.82 0.84 22
62
+ hvorost 0.98 0.86 0.91 141
63
+ irimshik 0.96 0.94 0.95 175
64
+ kattama-nan 0.84 0.88 0.86 66
65
+ kazy-karta 0.72 0.78 0.75 46
66
+ kurt 0.86 0.97 0.91 61
67
+ kuyrdak 0.92 0.93 0.92 58
68
+ kymyz-kymyran 0.93 0.82 0.87 49
69
+ lagman-fried 0.86 0.95 0.90 38
70
+ lagman-w-soup 0.90 0.80 0.85 75
71
+ lagman-wo-soup 0.58 0.86 0.69 22
72
+ manty 0.91 0.95 0.93 63
73
+ naryn 0.97 0.99 0.98 84
74
+ nauryz-kozhe 0.88 0.96 0.92 52
75
+ orama 0.68 0.84 0.75 38
76
+ plov 0.95 0.98 0.97 101
77
+ samsa 0.91 0.93 0.92 106
78
+ shashlyk-chicken 0.68 0.65 0.66 62
79
+ shashlyk-chicken-v 0.74 0.76 0.75 33
80
+ shashlyk-kuskovoi 0.75 0.75 0.75 71
81
+ shashlyk-kuskovoi-v 0.53 0.79 0.64 29
82
+ shashlyk-minced-meat 0.74 0.69 0.72 42
83
+ sheep-head 0.75 0.94 0.83 16
84
+ shelpek 0.77 0.86 0.81 64
85
+ shorpa 0.95 0.88 0.91 80
86
+ soup-plain 0.96 0.94 0.95 71
87
+ sushki 0.83 1.00 0.91 43
88
+ suzbe 0.89 0.82 0.86 62
89
+ taba-nan 0.92 0.80 0.86 136
90
+ talkan-zhent 0.86 0.80 0.83 90
91
+ tushpara-fried 0.79 0.74 0.76 46
92
+ tushpara-w-soup 0.94 0.94 0.94 67
93
+ tushpara-wo-soup 0.92 0.87 0.89 91
94
+
95
+ accuracy 0.87 2698
96
+ macro avg 0.84 0.86 0.85 2698
97
+ weighted avg 0.88 0.87 0.87 2698
98
+ ```
99
+
100
+ ![confusion matrix](matrix.png)
101
+
102
+ ### Testing
103
+
104
+ After training, the model was tested on the test set:
105
+
106
+ - **Test accuracy:** 87%
107
+
108
+ ## Repository Structure
109
+
110
+ - `main.py` — Code for training and testing the model
111
+ - `model/` — Saved model in SafeTensors format
112
+
113
+ ## Usage Instructions
114
+
115
+ from transformers import AutoModelForImageClassification
116
+ from huggingface_hub import hf_hub_download
117
+ from safetensors.torch import load_file
118
+
119
+ repo_id = "Eraly-ml/centraasia-ResNet-50"
120
+ filename = "model.safetensors"
121
+
122
+ # Load model
123
+ ```
124
+ model_path = hf_hub_download(repo_id=repo_id, filename=filename)
125
+ model = AutoModelForImageClassification.from_pretrained(repo_id)
126
+ model.load_state_dict(load_file(model_path))
127
+ ```
128
+ My telegram @eralyf