Deep learning image classification model trained on the STL-10 dataset, achieving 91.96% test accuracy using transfer learning with ResNet50.
This project implements a state-of-the-art image classifier capable of recognizing 10 different object categories:
- Airplane
- Bird
- Car
- Cat
- Deer
- Dog
- Horse
- Monkey
- Ship
- Truck
- Test Accuracy: 91.96%
- Training Accuracy: 99.08%
- Model Architecture: ResNet50 (pretrained on ImageNet)
- Dataset: STL-10 (5,000 training images, 8,000 test images)
- Training Time: ~2.5 hours on GPU (100 epochs)
- GUI Application: Easy-to-use graphical interface for image classification
- Command-line Tools: Quick prediction scripts for batch processing
- Pre-trained Model: Ready-to-use model with 91.96% accuracy
- Google Colab Support: Complete training pipeline for cloud training
- Python 3.8+
- PyTorch 1.9+
- torchvision
- Pillow
- tqdm
- matplotlib
- Clone the repository:
git clone https://github.com/freeknowledge2/Object-Recognition.git
cd Object-Recognition- Create virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Download the pre-trained model:
- The model file
best_model_STL10.ptshould be placed in the project root - Size: ~283 MB
- The model file
Launch the graphical interface for interactive image classification:
python gui_classifier.pyFeatures:
- Drag-and-drop image selection
- Real-time predictions with confidence scores
- Top-3 results display
- Support for PNG, JPG, JPEG, BMP, GIF formats
python quick_predict.py path/to/image.jpgpython use_model.pyInteractive menu options:
- Classify single image
- Process all images in test_images folder
- Process all images in train_images folder
- Specify custom folder path
The project includes pre-configured training scripts. However, for full training, Google Colab is recommended due to GPU requirements.
- Open the training notebook in Google Colab
- Upload
colab_training.py - Run the cells in order
- Model checkpoints will be automatically saved to Google Drive
See TRAINING.md for detailed training instructions.
SmartModel (ResNet50-based)
├── ResNet50 Backbone (pretrained on ImageNet)
└── Custom Classifier Head
├── Dropout(0.4)
├── Linear(2048 → 512)
├── ReLU + BatchNorm
├── Dropout(0.3)
├── Linear(512 → 256)
├── ReLU + BatchNorm
├── Dropout(0.2)
└── Linear(256 → 10)
- Optimizer: AdamW (lr=0.0003, weight_decay=0.01)
- Scheduler: CosineAnnealingLR (T_max=100, eta_min=1e-6)
- Loss Function: CrossEntropyLoss with label smoothing (0.1)
- Batch Size: 64
- Epochs: 100
- Data Augmentation:
- RandomCrop(96, padding=12)
- RandomHorizontalFlip(p=0.5)
- RandomRotation(15°)
- ColorJitter(brightness=0.3, contrast=0.3, saturation=0.3, hue=0.1)
- RandomGrayscale(p=0.1)
Object-Recognition/
├── gui_classifier.py # GUI application
├── quick_predict.py # Quick CLI prediction
├── use_model.py # Full-featured CLI tool
├── colab_training.py # Google Colab training script
├── best_model_STL10.pt # Pre-trained model weights
├── training_results.png # Training curves visualization
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── README.md # This file
└── docs/
├── TRAINING.md # Training guide
├── API.md # API documentation
└── BENCHMARKS.md # Performance benchmarks
The model shows excellent performance across all categories with minimal confusion between similar classes (e.g., dog/cat, car/truck).
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| Airplane | 0.94 | 0.93 | 0.93 |
| Bird | 0.89 | 0.91 | 0.90 |
| Car | 0.95 | 0.94 | 0.94 |
| Cat | 0.88 | 0.87 | 0.87 |
| Deer | 0.91 | 0.92 | 0.91 |
| Dog | 0.90 | 0.89 | 0.89 |
| Horse | 0.93 | 0.95 | 0.94 |
| Monkey | 0.92 | 0.91 | 0.91 |
| Ship | 0.95 | 0.96 | 0.95 |
| Truck | 0.93 | 0.92 | 0.92 |
Comparison with published STL-10 results:
| Method | Test Accuracy |
|---|---|
| This Implementation | 91.96% |
| Literature Average | 80-85% |
| ResNet50 (baseline) | 78.3% |
| VGG-16 | 74.2% |
- Training Guide - Detailed instructions for training models
- API Documentation - Python API reference
- Benchmarks - Performance analysis and comparisons
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- STL-10 dataset creators
- PyTorch team for the deep learning framework
- ResNet architecture by He et al.
- Google Colab for providing free GPU resources
freeknowledge2
- GitHub: @freeknowledge2
If you use this code in your research, please cite:
@software{stl10_classifier,
author = {freeknowledge2},
title = {STL-10 Image Classifier with 91.96% Accuracy},
year = {2025},
url = {https://github.com/freeknowledge2/Object-Recognition}
}For questions or issues, please open an issue on GitHub or contact through the repository.
Built with PyTorch and passion for computer vision.
