ResNet-18 trained on CIFAR-10 (ONNX)

This is a ResNet-18 model trained on the CIFAR-10 dataset, exported to the ONNX format for easy deployment across different platforms.

Model Details

  • Architecture: ResNet-18 (modified for CIFAR-10 input size)
  • Framework: PyTorch → ONNX export
  • Input size: 3 × 224 × 224 RGB images
  • Number of classes: 10 (airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck)

Intended Use

This model is designed for educational purposes, demos, and quick prototyping of ONNX-based image classification workflows.

How to Use

import onnxruntime as ort
import numpy as np
from PIL import Image

# Load model
session = ort.InferenceSession("resnet18_cifar10.onnx")

# Preprocess image
def preprocess(img_path):
    img = Image.open(img_path).convert("RGB").resize((224, 224))
    img_data = np.array(img).astype(np.float32) / 255.0
    img_data = np.transpose(img_data, (2, 0, 1))  # CHW format
    img_data = np.expand_dims(img_data, axis=0)   # Batch dimension
    return img_data

input_data = preprocess("example.jpg")

# Run inference
outputs = session.run(None, {"input": input_data})
pred_class = np.argmax(outputs[0])
print("Predicted class:", pred_class)
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

Dataset used to train shivamsharma120120/RenNEt18_CIFAR10