Defect Classifier (ResNet18)
Steel surface defect classification model trained on NEU-DET dataset.
Model Details
- Architecture: ResNet18
- Classes: 6 defect types (crazing, inclusion, patches, pitted_surface, rolled-in_scale, scratches)
- Input: 224x224 RGB images
- Formats: PyTorch (.pth), ONNX (.onnx)
Files
pytorch_model.pth: PyTorch checkpointmodel.onnx: ONNX format for deploymentmetadata.json: Model configurationtraining_history.json: Training metrics
Usage
PyTorch
import torch
from torchvision import models
from huggingface_hub import hf_hub_download
# Download model
model_path = hf_hub_download(repo_id="Seif-melz/defect-classifier-resnet18", filename="pytorch_model.pth")
# Load model
model = models.resnet18()
model.fc = torch.nn.Linear(model.fc.in_features, 6)
checkpoint = torch.load(model_path, map_location='cpu')
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
ONNX
import onnxruntime as ort
from huggingface_hub import hf_hub_download
# Download ONNX model
model_path = hf_hub_download(repo_id="Seif-melz/defect-classifier-resnet18", filename="model.onnx")
# Load with ONNX Runtime
session = ort.InferenceSession(model_path)
Training
See training history in training_history.json for detailed metrics.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support