https://github.com/gitarber/cnn-image-classifier
A CNN-based image classifier built with PyTorch and FastAPI. Features model training, evaluation metrics, visualizations, and a web interface for real-time predictions. Includes comprehensive documentation and Jupyter notebooks.
https://github.com/gitarber/cnn-image-classifier
cifar10 cnn computer-vision deep-learning fastapi image-classification machine-learning ml-project python pytorch
Last synced: about 2 months ago
JSON representation
A CNN-based image classifier built with PyTorch and FastAPI. Features model training, evaluation metrics, visualizations, and a web interface for real-time predictions. Includes comprehensive documentation and Jupyter notebooks.
- Host: GitHub
- URL: https://github.com/gitarber/cnn-image-classifier
- Owner: gitarber
- License: mit
- Created: 2025-03-25T22:56:27.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-25T23:00:20.000Z (about 1 year ago)
- Last Synced: 2025-06-13T03:46:27.149Z (12 months ago)
- Topics: cifar10, cnn, computer-vision, deep-learning, fastapi, image-classification, machine-learning, ml-project, python, pytorch
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CNN Image Classifier
A deep learning project that implements a Convolutional Neural Network (CNN) for image classification using PyTorch and FastAPI. The project includes model training, evaluation, visualization, and a web interface for real-time predictions.
## Features
- **Model Architecture**: Customizable CNN implementation with configurable layers
- **Data Pipeline**: Efficient data loading and preprocessing with augmentation
- **Training**: Configurable training loop with early stopping and checkpointing
- **Evaluation**: Comprehensive metrics and visualizations
- **Web Interface**: FastAPI-based web application for real-time predictions
- **Documentation**: Detailed documentation and interactive notebooks
## Documentation
- [Technical Documentation](docs/TECHNICAL.md) - Detailed technical specifications and implementation details
- [API Documentation](docs/API.md) - API endpoints and usage guide
- [Development Guide](docs/DEVELOPMENT.md) - Guide for developers and contributors
## Project Structure
```
cnn-image-classifier/
├── src/
│ ├── data/ # Data loading and preprocessing
│ ├── models/ # Model architecture and training
│ ├── utils/ # Utility functions
│ └── config.py # Configuration settings
├── app/ # FastAPI web application
├── docs/ # Documentation
├── notebooks/ # Jupyter notebooks
├── data/ # Dataset storage
├── models/ # Saved models
├── results/ # Training results and visualizations
└── logs/ # Training logs
```
## Installation
1. Clone the repository:
```bash
git clone https://github.com/gitarber/cnn-image-classifier.git
cd cnn-image-classifier
```
2. Create and activate a virtual environment:
```bash
python -m venv venv
# On Windows:
.\venv\Scripts\activate
# On Unix or MacOS:
source venv/bin/activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
## Usage
### Training the Model
```bash
python -m src.main
```
This will:
- Load and preprocess the CIFAR-10 dataset
- Train the CNN model
- Generate visualizations and metrics
- Save the best model
### Running the Web Interface
```bash
python -m app.main
```
Access the web interface at `http://localhost:8000/docs`
## Configuration
The project is highly configurable through `src/config.py`:
- Dataset parameters
- Model architecture
- Training settings
- Data augmentation
- Visualization options
## Results
The training process generates:
- Model checkpoints
- Training history plots
- Confusion matrix
- Feature maps
- Class activation maps
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request. See our [Development Guide](docs/DEVELOPMENT.md) for more details.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Author
- **Arber Shquti** - [GitHub](https://github.com/gitarber)