Spaces:
Sleeping
A newer version of the Gradio SDK is available: 6.27.0
title: CIFAR-100 ResNet-18 Classifier
emoji: πΌοΈ
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: ResNet-18 for CIFAR-100 classification (100 categories)
tags:
- computer-vision
- image-classification
- pytorch
- resnet
- cifar-100
πΌοΈ CIFAR-100 ResNet-18 Image Classifier
This Hugging Face Space demonstrates a ResNet-18 model optimized for CIFAR-100 image classification. The model can classify images into 100 different categories including animals, vehicles, plants, and household objects.
π Features
- Custom ResNet-18 Architecture: Adapted specifically for CIFAR-100's 32Γ32 input resolution
- 100 Class Classification: Covers a wide range of categories from the CIFAR-100 dataset
- Interactive Interface: Easy-to-use Gradio interface for real-time predictions
- Top-5 Predictions: Shows confidence scores for the most likely classes
- Technical Details: Comprehensive model information and architecture details
ποΈ Model Architecture
The model uses a modified ResNet-18 architecture with the following key features:
- Input: 32Γ32 RGB images (automatically resized)
- Residual Blocks: Skip connections for improved gradient flow
- Batch Normalization: Stable training and inference
- No Max Pooling: Optimized stem for small input resolution
- Adaptive Pooling: Global average pooling before classification
- 100 Output Classes: Full CIFAR-100 category coverage
π Training Features
The training pipeline includes advanced techniques:
- OneCycle Learning Rate: Cyclical learning rate scheduling
- Mixed Precision: Automatic mixed precision for efficiency
- Data Augmentation: Random crops, flips, and color jittering
- Label Smoothing: Improved generalization
- Gradient Clipping: Stable training dynamics
- Grad-CAM Visualization: Built-in attention visualization
π― CIFAR-100 Categories
The model classifies images into 100 categories including:
Animals: apple, aquarium_fish, baby, bear, beaver, bee, beetle, butterfly, camel, cattle, chimpanzee, cockroach, crab, crocodile, dinosaur, dolphin, elephant, flatfish, fox, hamster, kangaroo, leopard, lion, lizard, lobster, mouse, otter, porcupine, possum, rabbit, raccoon, ray, seal, shark, shrew, skunk, snail, snake, spider, squirrel, tiger, trout, turtle, whale, wolf, worm
Plants: maple_tree, oak_tree, palm_tree, pine_tree, willow_tree, orchid, poppy, rose, sunflower, tulip, orange, pear, sweet_pepper, mushroom
Vehicles: bicycle, bus, motorcycle, pickup_truck, train, streetcar, tank, tractor, rocket
Household: bed, bottle, bowl, can, chair, clock, couch, cup, house, keyboard, lamp, plate, table, telephone, television, wardrobe
Others: bridge, castle, cloud, forest, mountain, plain, road, sea, skyscraper
π§ Usage
- Upload an image using the interface
- The model will automatically resize it to 32Γ32 pixels
- Get top-5 predictions with confidence scores
- View detailed model information and technical specifications
π Repository Structure
era-resnet/
βββ app.py # Gradio interface
βββ model.py # ResNet-18 architecture
βββ train.py # Training script with advanced features
βββ requirements.txt # Python dependencies
βββ train.log # Training history and metrics
βββ README.md # This file
π Local Development
To run this app locally:
pip install -r requirements.txt
python app.py
To train your own model:
python train.py --epochs 100 --batch-size 128 --max-lr 0.1
π Training Performance
The model achieves competitive performance on CIFAR-100:
- Training includes 100 epochs with OneCycle scheduling
- Mixed precision training for efficiency
- Grad-CAM visualizations saved during training
- Comprehensive logging and checkpointing
π€ Contributing
Feel free to experiment with:
- Different architectures (modify
model.py) - Hyperparameter tuning (see
train.pyarguments) - Additional data augmentation techniques
- Transfer learning from other datasets
π License
This project is licensed under the Apache 2.0 License.