Update README.md
Browse files
README.md
CHANGED
@@ -26,6 +26,8 @@ model-index:
|
|
26 |
value: 0.8
|
27 |
name: F1 Score
|
28 |
library_name: sklearn
|
|
|
|
|
29 |
---
|
30 |
|
31 |
# Paper Defect Detection
|
@@ -61,33 +63,4 @@ The model uses a hybrid architecture combining:
|
|
61 |
|
62 |
- Performance may degrade for defect types not represented in the training data
|
63 |
- Variations in lighting or textures can affect classification accuracy
|
64 |
-
- This was a university project with room for improvement
|
65 |
-
|
66 |
-
## Usage
|
67 |
-
|
68 |
-
```python
|
69 |
-
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
|
70 |
-
import torch
|
71 |
-
from PIL import Image
|
72 |
-
from torchvision import transforms
|
73 |
-
|
74 |
-
model_name = "your-username/surface-defect-detection"
|
75 |
-
model = AutoModelForImageClassification.from_pretrained(model_name)
|
76 |
-
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
77 |
-
|
78 |
-
# Preprocess the input image
|
79 |
-
transform = transforms.Compose([
|
80 |
-
transforms.Resize((128, 128)),
|
81 |
-
transforms.ToTensor()
|
82 |
-
])
|
83 |
-
|
84 |
-
image = Image.open("path/to/sample-image.jpg")
|
85 |
-
inputs = feature_extractor(images=image, return_tensors="pt")
|
86 |
-
|
87 |
-
# Perform inference
|
88 |
-
with torch.no_grad():
|
89 |
-
outputs = model(**inputs)
|
90 |
-
predicted_class = outputs.logits.argmax(-1).item()
|
91 |
-
|
92 |
-
print(f"Predicted Defect Class: {predicted_class}")
|
93 |
-
```
|
|
|
26 |
value: 0.8
|
27 |
name: F1 Score
|
28 |
library_name: sklearn
|
29 |
+
metrics:
|
30 |
+
- accuracy
|
31 |
---
|
32 |
|
33 |
# Paper Defect Detection
|
|
|
63 |
|
64 |
- Performance may degrade for defect types not represented in the training data
|
65 |
- Variations in lighting or textures can affect classification accuracy
|
66 |
+
- This was a university project with room for improvement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|