CIFAR-10 Image Classifier
This model classifies images into 10 categories using a Convolutional Neural Network (CNN).
Model Description
- Architecture: Custom CNN with 3 convolutional blocks
- Dataset: CIFAR-10 (60,000 32x32 color images)
- Classes: airplane, car, bird, cat, deer, dog, frog, horse, ship, truck
- Test Accuracy: 79.35%
Usage
import torch
from PIL import Image
import torchvision.transforms as transforms
# Load model
model = torch.load('cifar10_cnn.pth')
model.eval()
# Prepare image
transform = transforms.Compose([
transforms.Resize((32, 32)),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
img = Image.open('your_image.jpg')
img_tensor = transform(img).unsqueeze(0)
# Predict
with torch.no_grad():
output = model(img_tensor)
predicted_class = output.argmax(dim=1).item()
Training
- Epochs: 15
- Optimizer: Adam
- Learning Rate: 0.001
- Batch Size: 32
License
This model is released under the MIT License.