huytranduck commited on
Commit
5af89eb
·
verified ·
1 Parent(s): e3a1a69

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +69 -0
  2. config.json +245 -0
  3. model.safetensors +3 -0
  4. model_info.json +108 -0
  5. preprocessor_config.json +22 -0
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: transformers
5
+ tags:
6
+ - image-classification
7
+ - convnextv2
8
+ - pytorch
9
+ datasets:
10
+ - custom
11
+ metrics:
12
+ - accuracy
13
+ - f1
14
+ ---
15
+
16
+ # huytranduck/convnextv2_50x_dataset
17
+
18
+ ## Model Description
19
+
20
+ This is a fine-tuned ConvNeXtV2-Atto model for image classification with 100 classes.
21
+
22
+ ### Classes
23
+ ['Acacia melanoxylon', 'Acer saccharinum', 'Afzelia africana', 'Afzelia pachyloba', 'Afzelia quanzensis', 'Albizia lucida (Albizia lucidior)', 'Allophylus cobbe (Pometia pinnata)', 'Anisoptera costata (Anisoptera Robusta)', 'Apuleia\xa0leiocarpa', 'Artocarpus calophyllus (Artocarpus asperulus)', 'Artocarpus heterophyllus', 'Autranella congolensis', 'Berlinia bracteosa', 'Betula pendula', 'Bobgunnia fistuloides (Swartzia fistuloides)', 'Brachystegia sp', 'Burckella obovata', 'Burretiodendron tonkinense', 'Callitris columellaris', 'Calocedrus sp', 'Canarium album', 'Chrysophyllum sp', 'Cinnamomum camphora', 'Clarisia racemosa', 'Colophospermum mopane', 'Cunninghamia lanceolata', 'Cupressus funebris (Cupressus pendula)', 'Cylicodiscus gabunensis', 'Dalbergia cochinchinensis', 'Dalbergia oliveri', 'Detarium macrocarpum', 'Dialium bipindense', 'Didelotia africana', 'Diospyros mun', 'Diospyros salletii', 'Distemonanthus benthamianus', 'Engelhardia chrysolepis (Engelhardia roxburghiana)', 'Entandrophragma cylindricum', 'Entandrophragma utile', 'Erythrophleum fordii\xa0', 'Erythrophleum ivorense', 'Eucalyptus cladocalyx', 'Eucalyptus grandis', 'Eucalyptus microcorys', 'Eucalyptus saligna', 'Fokienia hodginsii', 'Fraxinus excelsior', 'Gilbertiodendron dewevrei', 'Guarea cedrata', 'Guibourtia coleosperma', 'Heritiera littoralis', 'Hevea brasiliensis', 'Homalium caryophyllaceum', 'Homalium foetidum', 'Hopea iriana', 'Hopea pierrei', 'Hymenaea courbaril', 'Hymenolobium heterocarpum', 'Juglans regia', 'Khaya senegalensis', 'Klainedoxa gabonensis', 'Lithocarpus ducampii', 'Lophira alata', 'Magnolia hypolampra', 'Martiodendron parviflorum', 'Milicia excelsa', 'Milicia regia', 'Millettia laurentii', 'Monopetalanthus letestui (Bikinia letestui)', 'Myracrodruon urundeuva', 'Myroxylon balsamum', 'Myroxylon balsamum_v2', 'Myroxylon peruiferum', 'Nauclea diderrichii', 'Pachyelasma tessmannii', 'Palaquium waburgianum', 'Pericopsis elata', 'Pinus sp', 'Piptadeniastrum africanum', 'Populus sp', 'Prunus serotina', 'Pterocarpus macrocarpus', 'Pterocarpus soyauxii', 'Pterocarpus sp', 'Qualea paraensis', 'Quercus petraea', 'Quercus robur', 'Quercus rubra', 'Samanea saman', 'Shorea hypochra (Anthoshorea hypochra)', 'Shorea roxburghii (Anthoshorea roxburghii)', 'Sindora cochinchinensis', 'Staudtia stipitata', 'Syzygium hemisphericum (Syzygium chanlos)', 'Tarrietia cochinchinensis (Heritiera cochinchinesis)', 'Tectona grandis', 'Terminalia superba', 'Tetraberlinia bifoliolata', 'Toona sureni', 'Xylia xylocarpa']
24
+
25
+ ## Training Details
26
+
27
+ - Base model: facebook/convnextv2-atto-1k-224
28
+ - Fine-tuned on custom dataset
29
+ - Number of classes: 100
30
+ - Image size: 224x224
31
+
32
+ ### Training Configuration
33
+ - Epochs: 2 (as specified in your code)
34
+ - Batch size: 64
35
+ - Learning rate: 1e-4
36
+ - Optimizer: AdamW
37
+ - Loss function: CrossEntropyLoss
38
+
39
+ ### Performance Metrics
40
+ - Metrics will be updated after evaluation
41
+
42
+
43
+ ## Usage
44
+
45
+ ```python
46
+ from transformers import ConvNextV2ForImageClassification, AutoImageProcessor
47
+ import torch
48
+ from PIL import Image
49
+
50
+ # Load model and processor
51
+ model = ConvNextV2ForImageClassification.from_pretained("huytranduck/convnextv2_50x_dataset")
52
+ processor = AutoImageProcessor.from_pretrained("huytranduck/convnextv2_50x_dataset")
53
+
54
+ # Load and preprocess image
55
+ image = Image.open("path_to_your_image.jpg")
56
+ inputs = processor(image, return_tensors="pt")
57
+
58
+ # Make prediction
59
+ with torch.no_grad():
60
+ outputs = model(**inputs)
61
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
62
+ predicted_class = torch.argmax(predictions, dim=-1)
63
+
64
+ print(f"Predicted class: {predicted_class.item()}")
65
+ ```
66
+
67
+ ## Training Code
68
+
69
+ The model was trained using PyTorch and Transformers library with custom data augmentation.
config.json ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ConvNextV2ForImageClassification"
4
+ ],
5
+ "depths": [
6
+ 2,
7
+ 2,
8
+ 6,
9
+ 2
10
+ ],
11
+ "drop_path_rate": 0.0,
12
+ "hidden_act": "gelu",
13
+ "hidden_sizes": [
14
+ 40,
15
+ 80,
16
+ 160,
17
+ 320
18
+ ],
19
+ "id2label": {
20
+ "0": "LABEL_0",
21
+ "1": "LABEL_1",
22
+ "2": "LABEL_2",
23
+ "3": "LABEL_3",
24
+ "4": "LABEL_4",
25
+ "5": "LABEL_5",
26
+ "6": "LABEL_6",
27
+ "7": "LABEL_7",
28
+ "8": "LABEL_8",
29
+ "9": "LABEL_9",
30
+ "10": "LABEL_10",
31
+ "11": "LABEL_11",
32
+ "12": "LABEL_12",
33
+ "13": "LABEL_13",
34
+ "14": "LABEL_14",
35
+ "15": "LABEL_15",
36
+ "16": "LABEL_16",
37
+ "17": "LABEL_17",
38
+ "18": "LABEL_18",
39
+ "19": "LABEL_19",
40
+ "20": "LABEL_20",
41
+ "21": "LABEL_21",
42
+ "22": "LABEL_22",
43
+ "23": "LABEL_23",
44
+ "24": "LABEL_24",
45
+ "25": "LABEL_25",
46
+ "26": "LABEL_26",
47
+ "27": "LABEL_27",
48
+ "28": "LABEL_28",
49
+ "29": "LABEL_29",
50
+ "30": "LABEL_30",
51
+ "31": "LABEL_31",
52
+ "32": "LABEL_32",
53
+ "33": "LABEL_33",
54
+ "34": "LABEL_34",
55
+ "35": "LABEL_35",
56
+ "36": "LABEL_36",
57
+ "37": "LABEL_37",
58
+ "38": "LABEL_38",
59
+ "39": "LABEL_39",
60
+ "40": "LABEL_40",
61
+ "41": "LABEL_41",
62
+ "42": "LABEL_42",
63
+ "43": "LABEL_43",
64
+ "44": "LABEL_44",
65
+ "45": "LABEL_45",
66
+ "46": "LABEL_46",
67
+ "47": "LABEL_47",
68
+ "48": "LABEL_48",
69
+ "49": "LABEL_49",
70
+ "50": "LABEL_50",
71
+ "51": "LABEL_51",
72
+ "52": "LABEL_52",
73
+ "53": "LABEL_53",
74
+ "54": "LABEL_54",
75
+ "55": "LABEL_55",
76
+ "56": "LABEL_56",
77
+ "57": "LABEL_57",
78
+ "58": "LABEL_58",
79
+ "59": "LABEL_59",
80
+ "60": "LABEL_60",
81
+ "61": "LABEL_61",
82
+ "62": "LABEL_62",
83
+ "63": "LABEL_63",
84
+ "64": "LABEL_64",
85
+ "65": "LABEL_65",
86
+ "66": "LABEL_66",
87
+ "67": "LABEL_67",
88
+ "68": "LABEL_68",
89
+ "69": "LABEL_69",
90
+ "70": "LABEL_70",
91
+ "71": "LABEL_71",
92
+ "72": "LABEL_72",
93
+ "73": "LABEL_73",
94
+ "74": "LABEL_74",
95
+ "75": "LABEL_75",
96
+ "76": "LABEL_76",
97
+ "77": "LABEL_77",
98
+ "78": "LABEL_78",
99
+ "79": "LABEL_79",
100
+ "80": "LABEL_80",
101
+ "81": "LABEL_81",
102
+ "82": "LABEL_82",
103
+ "83": "LABEL_83",
104
+ "84": "LABEL_84",
105
+ "85": "LABEL_85",
106
+ "86": "LABEL_86",
107
+ "87": "LABEL_87",
108
+ "88": "LABEL_88",
109
+ "89": "LABEL_89",
110
+ "90": "LABEL_90",
111
+ "91": "LABEL_91",
112
+ "92": "LABEL_92",
113
+ "93": "LABEL_93",
114
+ "94": "LABEL_94",
115
+ "95": "LABEL_95",
116
+ "96": "LABEL_96",
117
+ "97": "LABEL_97",
118
+ "98": "LABEL_98",
119
+ "99": "LABEL_99"
120
+ },
121
+ "image_size": 224,
122
+ "initializer_range": 0.02,
123
+ "label2id": {
124
+ "LABEL_0": 0,
125
+ "LABEL_1": 1,
126
+ "LABEL_10": 10,
127
+ "LABEL_11": 11,
128
+ "LABEL_12": 12,
129
+ "LABEL_13": 13,
130
+ "LABEL_14": 14,
131
+ "LABEL_15": 15,
132
+ "LABEL_16": 16,
133
+ "LABEL_17": 17,
134
+ "LABEL_18": 18,
135
+ "LABEL_19": 19,
136
+ "LABEL_2": 2,
137
+ "LABEL_20": 20,
138
+ "LABEL_21": 21,
139
+ "LABEL_22": 22,
140
+ "LABEL_23": 23,
141
+ "LABEL_24": 24,
142
+ "LABEL_25": 25,
143
+ "LABEL_26": 26,
144
+ "LABEL_27": 27,
145
+ "LABEL_28": 28,
146
+ "LABEL_29": 29,
147
+ "LABEL_3": 3,
148
+ "LABEL_30": 30,
149
+ "LABEL_31": 31,
150
+ "LABEL_32": 32,
151
+ "LABEL_33": 33,
152
+ "LABEL_34": 34,
153
+ "LABEL_35": 35,
154
+ "LABEL_36": 36,
155
+ "LABEL_37": 37,
156
+ "LABEL_38": 38,
157
+ "LABEL_39": 39,
158
+ "LABEL_4": 4,
159
+ "LABEL_40": 40,
160
+ "LABEL_41": 41,
161
+ "LABEL_42": 42,
162
+ "LABEL_43": 43,
163
+ "LABEL_44": 44,
164
+ "LABEL_45": 45,
165
+ "LABEL_46": 46,
166
+ "LABEL_47": 47,
167
+ "LABEL_48": 48,
168
+ "LABEL_49": 49,
169
+ "LABEL_5": 5,
170
+ "LABEL_50": 50,
171
+ "LABEL_51": 51,
172
+ "LABEL_52": 52,
173
+ "LABEL_53": 53,
174
+ "LABEL_54": 54,
175
+ "LABEL_55": 55,
176
+ "LABEL_56": 56,
177
+ "LABEL_57": 57,
178
+ "LABEL_58": 58,
179
+ "LABEL_59": 59,
180
+ "LABEL_6": 6,
181
+ "LABEL_60": 60,
182
+ "LABEL_61": 61,
183
+ "LABEL_62": 62,
184
+ "LABEL_63": 63,
185
+ "LABEL_64": 64,
186
+ "LABEL_65": 65,
187
+ "LABEL_66": 66,
188
+ "LABEL_67": 67,
189
+ "LABEL_68": 68,
190
+ "LABEL_69": 69,
191
+ "LABEL_7": 7,
192
+ "LABEL_70": 70,
193
+ "LABEL_71": 71,
194
+ "LABEL_72": 72,
195
+ "LABEL_73": 73,
196
+ "LABEL_74": 74,
197
+ "LABEL_75": 75,
198
+ "LABEL_76": 76,
199
+ "LABEL_77": 77,
200
+ "LABEL_78": 78,
201
+ "LABEL_79": 79,
202
+ "LABEL_8": 8,
203
+ "LABEL_80": 80,
204
+ "LABEL_81": 81,
205
+ "LABEL_82": 82,
206
+ "LABEL_83": 83,
207
+ "LABEL_84": 84,
208
+ "LABEL_85": 85,
209
+ "LABEL_86": 86,
210
+ "LABEL_87": 87,
211
+ "LABEL_88": 88,
212
+ "LABEL_89": 89,
213
+ "LABEL_9": 9,
214
+ "LABEL_90": 90,
215
+ "LABEL_91": 91,
216
+ "LABEL_92": 92,
217
+ "LABEL_93": 93,
218
+ "LABEL_94": 94,
219
+ "LABEL_95": 95,
220
+ "LABEL_96": 96,
221
+ "LABEL_97": 97,
222
+ "LABEL_98": 98,
223
+ "LABEL_99": 99
224
+ },
225
+ "layer_norm_eps": 1e-12,
226
+ "model_type": "convnextv2",
227
+ "num_channels": 3,
228
+ "num_stages": 4,
229
+ "out_features": [
230
+ "stage4"
231
+ ],
232
+ "out_indices": [
233
+ 4
234
+ ],
235
+ "patch_size": 4,
236
+ "stage_names": [
237
+ "stem",
238
+ "stage1",
239
+ "stage2",
240
+ "stage3",
241
+ "stage4"
242
+ ],
243
+ "torch_dtype": "float32",
244
+ "transformers_version": "4.52.4"
245
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ef086724791aacd5239ccd82af4c326efefbc43ba61cce72c00a52da0cca382
3
+ size 13694328
model_info.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "num_classes": 100,
3
+ "class_names": [
4
+ "Acacia melanoxylon",
5
+ "Acer saccharinum",
6
+ "Afzelia africana",
7
+ "Afzelia pachyloba",
8
+ "Afzelia quanzensis",
9
+ "Albizia lucida (Albizia lucidior)",
10
+ "Allophylus cobbe (Pometia pinnata)",
11
+ "Anisoptera costata (Anisoptera Robusta)",
12
+ "Apuleia\u00a0leiocarpa",
13
+ "Artocarpus calophyllus (Artocarpus asperulus)",
14
+ "Artocarpus heterophyllus",
15
+ "Autranella congolensis",
16
+ "Berlinia bracteosa",
17
+ "Betula pendula",
18
+ "Bobgunnia fistuloides (Swartzia fistuloides)",
19
+ "Brachystegia sp",
20
+ "Burckella obovata",
21
+ "Burretiodendron tonkinense",
22
+ "Callitris columellaris",
23
+ "Calocedrus sp",
24
+ "Canarium album",
25
+ "Chrysophyllum sp",
26
+ "Cinnamomum camphora",
27
+ "Clarisia racemosa",
28
+ "Colophospermum mopane",
29
+ "Cunninghamia lanceolata",
30
+ "Cupressus funebris (Cupressus pendula)",
31
+ "Cylicodiscus gabunensis",
32
+ "Dalbergia cochinchinensis",
33
+ "Dalbergia oliveri",
34
+ "Detarium macrocarpum",
35
+ "Dialium bipindense",
36
+ "Didelotia africana",
37
+ "Diospyros mun",
38
+ "Diospyros salletii",
39
+ "Distemonanthus benthamianus",
40
+ "Engelhardia chrysolepis (Engelhardia roxburghiana)",
41
+ "Entandrophragma cylindricum",
42
+ "Entandrophragma utile",
43
+ "Erythrophleum fordii\u00a0",
44
+ "Erythrophleum ivorense",
45
+ "Eucalyptus cladocalyx",
46
+ "Eucalyptus grandis",
47
+ "Eucalyptus microcorys",
48
+ "Eucalyptus saligna",
49
+ "Fokienia hodginsii",
50
+ "Fraxinus excelsior",
51
+ "Gilbertiodendron dewevrei",
52
+ "Guarea cedrata",
53
+ "Guibourtia coleosperma",
54
+ "Heritiera littoralis",
55
+ "Hevea brasiliensis",
56
+ "Homalium caryophyllaceum",
57
+ "Homalium foetidum",
58
+ "Hopea iriana",
59
+ "Hopea pierrei",
60
+ "Hymenaea courbaril",
61
+ "Hymenolobium heterocarpum",
62
+ "Juglans regia",
63
+ "Khaya senegalensis",
64
+ "Klainedoxa gabonensis",
65
+ "Lithocarpus ducampii",
66
+ "Lophira alata",
67
+ "Magnolia hypolampra",
68
+ "Martiodendron parviflorum",
69
+ "Milicia excelsa",
70
+ "Milicia regia",
71
+ "Millettia laurentii",
72
+ "Monopetalanthus letestui (Bikinia letestui)",
73
+ "Myracrodruon urundeuva",
74
+ "Myroxylon balsamum",
75
+ "Myroxylon balsamum_v2",
76
+ "Myroxylon peruiferum",
77
+ "Nauclea diderrichii",
78
+ "Pachyelasma tessmannii",
79
+ "Palaquium waburgianum",
80
+ "Pericopsis elata",
81
+ "Pinus sp",
82
+ "Piptadeniastrum africanum",
83
+ "Populus sp",
84
+ "Prunus serotina",
85
+ "Pterocarpus macrocarpus",
86
+ "Pterocarpus soyauxii",
87
+ "Pterocarpus sp",
88
+ "Qualea paraensis",
89
+ "Quercus petraea",
90
+ "Quercus robur",
91
+ "Quercus rubra",
92
+ "Samanea saman",
93
+ "Shorea hypochra (Anthoshorea hypochra)",
94
+ "Shorea roxburghii (Anthoshorea roxburghii)",
95
+ "Sindora cochinchinensis",
96
+ "Staudtia stipitata",
97
+ "Syzygium hemisphericum (Syzygium chanlos)",
98
+ "Tarrietia cochinchinensis (Heritiera cochinchinesis)",
99
+ "Tectona grandis",
100
+ "Terminalia superba",
101
+ "Tetraberlinia bifoliolata",
102
+ "Toona sureni",
103
+ "Xylia xylocarpa"
104
+ ],
105
+ "image_size": 224,
106
+ "model_type": "convnextv2-atto",
107
+ "metrics": {}
108
+ }
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
+ }