kunhsiang commited on
Commit
fb7f127
·
verified ·
1 Parent(s): a45b636

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +87 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - image-classification
5
+ - pytorch
6
+ - simpsons
7
+ - convnext
8
+ datasets:
9
+ - custom
10
+ metrics:
11
+ - accuracy
12
+ ---
13
+
14
+ # NYCU_ML_2025_ImageClassification
15
+
16
+ ## Model Description
17
+
18
+ This is a **convnextv2_base.fcmae_ft_in22k_in1k (2023 - 推薦首選, timm)** model fine-tuned for **Simpsons character classification**.
19
+
20
+ - **Developed by:** NYCU ML Course 2025
21
+ - **Model type:** Image Classification
22
+ - **Framework:** PyTorch + timm
23
+ - **Best Validation Accuracy:** 0.9934
24
+
25
+ ## Training Details
26
+
27
+ ### Hyperparameters
28
+
29
+ | Parameter | Value |
30
+ |-----------|-------|
31
+ | Image Resolution | 256 |
32
+ | Batch Size | 80 |
33
+ | Learning Rate | 0.0001 |
34
+ | Optimizer | AdamW |
35
+ | Weight Decay | 0.01 |
36
+ | Scheduler | CosineAnnealingLR |
37
+ | Label Smoothing | 0.1 |
38
+ | Epochs | 15 |
39
+ | CutMix | False |
40
+ | HEM-TA | False |
41
+
42
+ ### Dataset
43
+
44
+ - **Number of Classes:** 50
45
+ - **Training Samples:** 87236
46
+ - **Validation Samples:** 9693
47
+
48
+ ### Classes
49
+
50
+ ```
51
+ abraham_grampa_simpson, agnes_skinner, apu_nahasapeemapetilon, barney_gumble, bart_simpson, brandine_spuckler, carl_carlson, charles_montgomery_burns, chief_wiggum, cletus_spuckler, comic_book_guy, disco_stu, dolph_starbeam, duff_man, edna_krabappel, fat_tony, gary_chalmers, gil, groundskeeper_willie, homer_simpson...
52
+ ```
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ import torch
58
+ import timm
59
+ from PIL import Image
60
+ from torchvision import transforms
61
+
62
+ # Load model
63
+ model = timm.create_model('convnextv2_base.fcmae_ft_in22k_in1k',
64
+ pretrained=False,
65
+ num_classes=50)
66
+ model.load_state_dict(torch.load('pytorch_model.pth', map_location='cpu'))
67
+ model.eval()
68
+
69
+ # Preprocess
70
+ transform = transforms.Compose([
71
+ transforms.Resize(294),
72
+ transforms.CenterCrop(256),
73
+ transforms.ToTensor(),
74
+ transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
75
+ ])
76
+
77
+ # Predict
78
+ img = Image.open('your_image.jpg').convert('RGB')
79
+ input_tensor = transform(img).unsqueeze(0)
80
+ with torch.no_grad():
81
+ output = model(input_tensor)
82
+ pred = output.argmax(dim=1).item()
83
+ ```
84
+
85
+ ## License
86
+
87
+ MIT License