AbdullahImran commited on
Commit
f88a971
·
verified ·
1 Parent(s): 3bed3b0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -0
README.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - defect-detection
6
+ - image-classification
7
+ - machine-learning
8
+ - quality-control
9
+ - ensemble-learning
10
+ - neural-networks
11
+ license: apache-2.0
12
+ datasets:
13
+ - custom_paper_surface_defect
14
+ pipeline_tag: image-classification
15
+ model-index:
16
+ - name: Paper Defect Detection
17
+ results:
18
+ - task:
19
+ type: image-classification
20
+ name: Surface Defect Detection
21
+ metrics:
22
+ - type: accuracy
23
+ value: 0.81
24
+ name: Ensemble Test Accuracy
25
+ - type: f1
26
+ value: 0.80
27
+ name: F1 Score
28
+ ---
29
+
30
+ # Surface Defect Detection and Classification Model
31
+
32
+ ## Model Description
33
+
34
+ This model is designed for automated surface defect detection in manufacturing using a hybrid approach that combines classical machine learning and deep learning techniques.
35
+
36
+ ### Model Architecture
37
+
38
+ The model uses a hybrid architecture combining:
39
+ - Logistic Regression
40
+ - SVM
41
+ - Naive Bayes
42
+ - CNN
43
+ - Ensemble Voting Classifier
44
+
45
+ ### Feature Extraction Methods
46
+ - Histogram of Oriented Gradients (HOG)
47
+ - Gabor Filters
48
+ - Canny Edge Detection
49
+ - Wavelet Transforms
50
+
51
+ ## Performance
52
+
53
+ | Model | Train Accuracy | Test Accuracy |
54
+ |--------------------|----------------|---------------|
55
+ | Logistic Regression| 0.99 | 0.79 |
56
+ | SVM | 0.86 | 0.80 |
57
+ | Ensemble Model | 0.90 | 0.81 |
58
+
59
+ ## Limitations
60
+
61
+ - Performance may degrade for defect types not represented in the training data
62
+ - Variations in lighting or textures can affect classification accuracy
63
+ - This was a university project with room for improvement
64
+
65
+ ## Usage
66
+
67
+ ```python
68
+ from transformers import AutoModelForImageClassification, AutoFeatureExtractor
69
+ import torch
70
+ from PIL import Image
71
+ from torchvision import transforms
72
+
73
+ model_name = "your-username/surface-defect-detection"
74
+ model = AutoModelForImageClassification.from_pretrained(model_name)
75
+ feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
76
+
77
+ # Preprocess the input image
78
+ transform = transforms.Compose([
79
+ transforms.Resize((128, 128)),
80
+ transforms.ToTensor()
81
+ ])
82
+
83
+ image = Image.open("path/to/sample-image.jpg")
84
+ inputs = feature_extractor(images=image, return_tensors="pt")
85
+
86
+ # Perform inference
87
+ with torch.no_grad():
88
+ outputs = model(**inputs)
89
+ predicted_class = outputs.logits.argmax(-1).item()
90
+
91
+ print(f"Predicted Defect Class: {predicted_class}")
92
+ ```