Paper Defect Detection
Model Description
This model is designed for automated surface defect detection in manufacturing using a hybrid approach that combines classical machine learning and deep learning techniques.
Model Architecture
The model uses a hybrid architecture combining:
- Logistic Regression
- SVM
- Naive Bayes
- CNN
- Ensemble Voting Classifier
Feature Extraction Methods
- Histogram of Oriented Gradients (HOG)
- Gabor Filters
- Canny Edge Detection
- Wavelet Transforms
Performance
Model | Train Accuracy | Test Accuracy |
---|---|---|
Logistic Regression | 0.99 | 0.79 |
SVM | 0.86 | 0.80 |
Ensemble Model | 0.90 | 0.81 |
Limitations
- Performance may degrade for defect types not represented in the training data
- Variations in lighting or textures can affect classification accuracy
- This was a university project with room for improvement
Usage
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
import torch
from PIL import Image
from torchvision import transforms
model_name = "your-username/surface-defect-detection"
model = AutoModelForImageClassification.from_pretrained(model_name)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
# Preprocess the input image
transform = transforms.Compose([
transforms.Resize((128, 128)),
transforms.ToTensor()
])
image = Image.open("path/to/sample-image.jpg")
inputs = feature_extractor(images=image, return_tensors="pt")
# Perform inference
with torch.no_grad():
outputs = model(**inputs)
predicted_class = outputs.logits.argmax(-1).item()
print(f"Predicted Defect Class: {predicted_class}")
- Downloads last month
- 0
Inference API (serverless) does not yet support sklearn models for this pipeline type.
Evaluation results
- Ensemble Test Accuracyself-reported0.810
- F1 Scoreself-reported0.800