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 checkpoint
  • model.onnx: ONNX format for deployment
  • metadata.json: Model configuration
  • training_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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support