CIFAR-10 Image Classifier (ResNet-18)

Model klasifikasi gambar berbasis ResNet-18 yang di-fine-tune pada dataset CIFAR-10.

Kelas yang Didukung

airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck

Cara Penggunaan

import torch
from torchvision import models, transforms
from huggingface_hub import hf_hub_download
from PIL import Image

CLASSES = ("airplane", "automobile", "bird", "cat", "deer",
           "dog", "frog", "horse", "ship", "truck")

# Unduh model
model_path = hf_hub_download(repo_id="rifda83/cifar10-resnet18-classifier", filename="best_model.pth")

model = models.resnet18(weights=None)
model.fc = torch.nn.Linear(model.fc.in_features, 10)
model.load_state_dict(torch.load(model_path, map_location="cpu"))
model.eval()

transform = transforms.Compose([
    transforms.Resize((32, 32)),
    transforms.ToTensor(),
    transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])

image = Image.open("your_image.jpg").convert("RGB")
tensor = transform(image).unsqueeze(0)
with torch.no_grad():
    probs = torch.softmax(model(tensor), dim=1)[0]
print(CLASSES[probs.argmax()], f"100.0%")

Performa Model

Split Accuracy
Test ~88%
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 rifda83/cifar10-resnet18-classifier