Cifar10 Resnet18 Classifier
Model klasifikasi gambar berbasis ResNet-18 yang di-fine-tune pada dataset CIFAR-10.
Model source
- Kind
- Other
- File size
- 42.7 MB
- Version
- vRevision e1c8337
- Updated
- Sep 17, 2026
- Downloads
- 0
- Source
- Hugging Face
Source description
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% |
Sources
1 source
Sources
1 sourceVerified Sep 17
Model artifacts
1 artifact
Model artifacts
1 artifactSource excerpts
2 excerpts
Source excerpts
2 excerpts--- license: apache-2.0 tags: - image-classification - pytorch - resnet - cifar10 datasets: - cifar10 metrics: - accuracy --- # 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 ```python 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% |
Source context: 0 downloads · 0 likes · Pipeline image-classification · Repo rifda83/cifar10-resnet18-classifier
