Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,140 @@
|
|
1 |
-
---
|
2 |
-
license: cc
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
tags:
|
4 |
+
- image-classification
|
5 |
+
- pytorch
|
6 |
+
- defect-detection
|
7 |
+
- manufacturing
|
8 |
+
- quality-control
|
9 |
+
language:
|
10 |
+
- ko
|
11 |
+
datasets:
|
12 |
+
- custom
|
13 |
+
metrics:
|
14 |
+
- accuracy
|
15 |
+
library_name: pytorch
|
16 |
+
pipeline_tag: image-classification
|
17 |
+
---
|
18 |
+
|
19 |
+
# μμ₯곡μ λΆλν λΆλ₯ λͺ¨λΈ (Assembly Process Defect Classification)
|
20 |
+
|
21 |
+
μ΄ λͺ¨λΈμ μμ₯곡μ μμ λ°μνλ λ€μν λΆλ μ νμ λΆλ₯νκΈ° μν΄ ResNet50 μν€ν
μ²λ₯Ό κΈ°λ°μΌλ‘ νμΈνλλ λͺ¨λΈμ
λλ€.
|
22 |
+
|
23 |
+
## λͺ¨λΈ μ 보
|
24 |
+
|
25 |
+
- **μν€ν
μ²**: ResNet50
|
26 |
+
- **ν΄λμ€ μ**: 24κ°
|
27 |
+
- **μ
λ ₯ ν¬κΈ°**: 224x224 RGB μ΄λ―Έμ§
|
28 |
+
- **λΆλ₯ μΉ΄ν
κ³ λ¦¬**: 12κ°μ§ λΆλ μ ν Γ 2κ°μ§ νμ§ μν (λΆλν/μν)
|
29 |
+
|
30 |
+
## λΆλ₯ ν΄λμ€
|
31 |
+
|
32 |
+
### λΆλ μ νλ³ λΆλ₯
|
33 |
+
- **κ³ μ λΆλ**: λΆλν(0), μν(1)
|
34 |
+
- **κ³ μ ν λΆλ**: λΆλν(2), μν(3)
|
35 |
+
- **λ¨μ°¨**: λΆλν(4), μν(5)
|
36 |
+
- **μ€ν¬λμΉ**: λΆλν(6), μν(7)
|
37 |
+
- **μ€λ§ λΆλ**: λΆλν(8), μν(9)
|
38 |
+
- **μ°κ³ λΆλ**: λΆλν(10), μν(11)
|
39 |
+
- **μΈκ΄ μμ**: λΆλν(12), μν(13)
|
40 |
+
- **μ 격 λΆλ**: λΆλν(14), μν(15)
|
41 |
+
- **μ₯μ°© λΆλ**: λΆλν(16), μν(17)
|
42 |
+
- **체결 λΆλ**: λΆλν(18), μν(19)
|
43 |
+
- **ν€λ° λΆλ**: λΆλν(20), μν(21)
|
44 |
+
- **ν λ³ν**: λΆλν(22), μν(23)
|
45 |
+
|
46 |
+
## μ¬μ©λ²
|
47 |
+
|
48 |
+
### λͺ¨λΈ λ‘λ λ° μΆλ‘
|
49 |
+
|
50 |
+
```python
|
51 |
+
import torch
|
52 |
+
from torchvision import models, transforms
|
53 |
+
from PIL import Image
|
54 |
+
|
55 |
+
# λͺ¨λΈ λ‘λ
|
56 |
+
model = models.resnet50(num_classes=24)
|
57 |
+
model.fc = torch.nn.Linear(model.fc.in_features, 24)
|
58 |
+
model.load_state_dict(torch.load('pytorch_model.bin', map_location='cpu'))
|
59 |
+
model.eval()
|
60 |
+
|
61 |
+
# μ΄λ―Έμ§ μ μ²λ¦¬
|
62 |
+
transform = transforms.Compose([
|
63 |
+
transforms.Resize((224, 224)),
|
64 |
+
transforms.ToTensor(),
|
65 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406],
|
66 |
+
std=[0.229, 0.224, 0.225])
|
67 |
+
])
|
68 |
+
|
69 |
+
# μΆλ‘
|
70 |
+
img = Image.open('your_image.jpg').convert('RGB')
|
71 |
+
input_tensor = transform(img).unsqueeze(0)
|
72 |
+
|
73 |
+
with torch.no_grad():
|
74 |
+
outputs = model(input_tensor)
|
75 |
+
predicted_class = torch.argmax(outputs, dim=1).item()
|
76 |
+
|
77 |
+
# ν΄λμ€λͺ
λ§€ν
|
78 |
+
class_names = {
|
79 |
+
0: 'κ³ μ λΆλ_λΆλν', 1: 'κ³ μ λΆλ_μν',
|
80 |
+
2: 'κ³ μ ν λΆλ_λΆλν', 3: 'κ³ μ ν λΆλ_μν',
|
81 |
+
4: 'λ¨μ°¨_λΆλν', 5: 'λ¨μ°¨_μν',
|
82 |
+
6: 'μ€ν¬λμΉ_λΆλν', 7: 'μ€ν¬λμΉ_μν',
|
83 |
+
8: 'μ€λ§ λΆλ_λΆλν', 9: 'μ€λ§ λΆλ_μν',
|
84 |
+
10: 'μ°κ³ λΆλ_λΆλν', 11: 'μ°κ³ λΆλ_μν',
|
85 |
+
12: 'μΈκ΄ μμ_λΆλν', 13: 'μΈκ΄ μμ_μν',
|
86 |
+
14: 'μ 격 λΆλ_λΆλν', 15: 'μ 격 λΆλ_μν',
|
87 |
+
16: 'μ₯μ°© λΆλ_λΆλν', 17: 'μ₯μ°© λΆλ_μν',
|
88 |
+
18: '체결 λΆλ_λΆλν', 19: '체결 λΆλ_μν',
|
89 |
+
20: 'ν€λ° λΆλ_λΆλν', 21: 'ν€λ° λΆλ_μν',
|
90 |
+
22: 'ν λ³ν_λΆλν', 23: 'ν λ³ν_μν'
|
91 |
+
}
|
92 |
+
|
93 |
+
print(f"μμΈ‘ κ²°κ³Ό: {class_names[predicted_class]}")
|
94 |
+
```
|
95 |
+
|
96 |
+
### νκΉ
νμ΄μ€ Transformers λΌμ΄λΈλ¬λ¦¬ μ¬μ©
|
97 |
+
|
98 |
+
```python
|
99 |
+
from transformers import AutoConfig
|
100 |
+
import torch
|
101 |
+
from torchvision import models
|
102 |
+
|
103 |
+
# μ€μ λ‘λ
|
104 |
+
config = AutoConfig.from_pretrained('your-username/defect-classification-resnet50')
|
105 |
+
|
106 |
+
# λͺ¨λΈ λ‘λ
|
107 |
+
model = models.resnet50(num_classes=config.num_classes)
|
108 |
+
model.fc = torch.nn.Linear(model.fc.in_features, config.num_classes)
|
109 |
+
model.load_state_dict(torch.hub.load_state_dict_from_url(
|
110 |
+
'https://huggingface.co/your-username/defect-classification-resnet50/resolve/main/pytorch_model.bin',
|
111 |
+
map_location='cpu'
|
112 |
+
))
|
113 |
+
```
|
114 |
+
|
115 |
+
## λͺ¨λΈ μ±λ₯
|
116 |
+
|
117 |
+
- **μ νλ**: 0.7509
|
118 |
+
- **κ²μ¦ λ°μ΄ν°μ
**: [λ°μ΄ν°μ
μ 보 μ
λ ₯]
|
119 |
+
|
120 |
+
## μ νμ¬ν
|
121 |
+
|
122 |
+
- μ΄ λͺ¨λΈμ νΉμ μ μ‘° νκ²½μμ μμ§λ λ°μ΄ν°λ‘ νμ΅λμμΌλ―λ‘, λ€λ₯Έ νκ²½μμλ μ±λ₯μ΄ λ¬λΌμ§ μ μμ΅λλ€.
|
123 |
+
- μ€μ μ΄μ νκ²½μμ μ¬μ©νκΈ° μ μ μΆ©λΆν ν
μ€νΈλ₯Ό κΆμ₯ν©λλ€.
|
124 |
+
|
125 |
+
## λΌμ΄μ μ€
|
126 |
+
|
127 |
+
CC BY-NC
|
128 |
+
|
129 |
+
## μΈμ©
|
130 |
+
|
131 |
+
μ΄ λͺ¨λΈμ μ¬μ©νμ λ€λ©΄ λ€μκ³Ό κ°μ΄ μΈμ©ν΄μ£ΌμΈμ:
|
132 |
+
|
133 |
+
```
|
134 |
+
@misc{vehicle-assembly-process-defect-detection-model,
|
135 |
+
title={Assembly Process Defect Classification with ResNet50},
|
136 |
+
author={doyoon kwon},
|
137 |
+
year={2025},
|
138 |
+
url={https://huggingface.co/23smartfactory/vehicle-assembly-process-defect-detection-model}
|
139 |
+
}
|
140 |
+
```
|