--- 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 1. Upload an image using the interface 2. The model will automatically resize it to 32×32 pixels 3. Get top-5 predictions with confidence scores 4. 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: ```bash pip install -r requirements.txt python app.py ``` To train your own model: ```bash 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.py` arguments) - Additional data augmentation techniques - Transfer learning from other datasets ## 📄 License This project is licensed under the Apache 2.0 License.