Seif-melz commited on
Commit
331e51d
·
verified ·
1 Parent(s): 6810490

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - computer-vision
4
+ - defect-detection
5
+ - pytorch
6
+ - onnx
7
+ library_name: pytorch
8
+ ---
9
+
10
+ # Defect Classifier (ResNet18)
11
+
12
+ Steel surface defect classification model trained on NEU-DET dataset.
13
+
14
+ ## Model Details
15
+
16
+ - **Architecture**: ResNet18
17
+ - **Classes**: 6 defect types (crazing, inclusion, patches, pitted_surface, rolled-in_scale, scratches)
18
+ - **Input**: 224x224 RGB images
19
+ - **Formats**: PyTorch (.pth), ONNX (.onnx)
20
+
21
+ ## Files
22
+
23
+ - `pytorch_model.pth`: PyTorch checkpoint
24
+ - `model.onnx`: ONNX format for deployment
25
+ - `metadata.json`: Model configuration
26
+ - `training_history.json`: Training metrics
27
+
28
+ ## Usage
29
+
30
+ ### PyTorch
31
+
32
+ ```python
33
+ import torch
34
+ from torchvision import models
35
+ from huggingface_hub import hf_hub_download
36
+
37
+ # Download model
38
+ model_path = hf_hub_download(repo_id="Seif-melz/defect-classifier-resnet18", filename="pytorch_model.pth")
39
+
40
+ # Load model
41
+ model = models.resnet18()
42
+ model.fc = torch.nn.Linear(model.fc.in_features, 6)
43
+ checkpoint = torch.load(model_path, map_location='cpu')
44
+ model.load_state_dict(checkpoint['model_state_dict'])
45
+ model.eval()
46
+ ```
47
+
48
+ ### ONNX
49
+
50
+ ```python
51
+ import onnxruntime as ort
52
+ from huggingface_hub import hf_hub_download
53
+
54
+ # Download ONNX model
55
+ model_path = hf_hub_download(repo_id="Seif-melz/defect-classifier-resnet18", filename="model.onnx")
56
+
57
+ # Load with ONNX Runtime
58
+ session = ort.InferenceSession(model_path)
59
+ ```
60
+
61
+ ## Training
62
+
63
+ See training history in `training_history.json` for detailed metrics.