https://github.com/arsh-pixel-cmd/ai-image-classifier
AI Image Classifier is a web app that uses AI and deep learning to classify images in real-time. Built with Streamlit, TensorFlow (MobileNetV2), OpenCV, and NumPy, it allows users to upload single or multiple images and get the top-3 predictions with confidence scores instantly in the browser.
https://github.com/arsh-pixel-cmd/ai-image-classifier
docker numpy opencv python3 streamlit tensorflow2 uv
Last synced: 2 months ago
JSON representation
AI Image Classifier is a web app that uses AI and deep learning to classify images in real-time. Built with Streamlit, TensorFlow (MobileNetV2), OpenCV, and NumPy, it allows users to upload single or multiple images and get the top-3 predictions with confidence scores instantly in the browser.
- Host: GitHub
- URL: https://github.com/arsh-pixel-cmd/ai-image-classifier
- Owner: Arsh-pixel-cmd
- License: mit
- Created: 2025-09-12T17:58:52.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-12T19:38:55.000Z (9 months ago)
- Last Synced: 2025-09-12T20:52:25.808Z (9 months ago)
- Topics: docker, numpy, opencv, python3, streamlit, tensorflow2, uv
- Language: Python
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🖼️ AI Image Classifier
An AI-powered image classification web app built with **Streamlit**, **TensorFlow (MobileNetV2)**, **OpenCV**, and **NumPy**. Upload single or multiple images and get real-time AI predictions directly in your browser.




---
## 🚀 Features
- ✅ **Multi-image upload** with drag & drop support
- ✅ **MobileNetV2** pre-trained on ImageNet dataset (1000+ classes)
- ✅ **Top-3 predictions** with confidence percentages
- ✅ **Grid preview** for batch image processing
- ✅ **Real-time classification** with instant results
- ✅ **Error handling** for invalid file formats
- ✅ **Lightweight** - runs locally with zero setup complexity
---
## 🛠️ Tech Stack
| Component | Technology |
|-----------|------------|
| **Frontend/UI** | [Streamlit](https://streamlit.io/) |
| **AI Model** | TensorFlow Keras (MobileNetV2) |
| **Image Processing** | OpenCV, Pillow (PIL) |
| **Data Handling** | NumPy |
| **Package Manager** | uv |
---
## 📂 Project Structure
AI-image-classifier/
├── main.py # Streamlit application
├── pyproject.toml # Project metadata & dependencies
├── uv.lock # Lockfile for reproducible installs
├── README.md # Project documentation
└── .venv/ # Virtual environment (auto-created)
---
## ⚡ Quick Start
### Prerequisites
- Python 3.12 or higher
- uv package manager ([Install uv](https://docs.astral.sh/uv/getting-started/installation/))
### Installation
### 1️⃣ Clone the repository
```bash
git clone https://github.com/Arsh-pixel-cmd/AI-Image-Classifier.git
cd AI-Image-Classifier
```
### 2️⃣ Create virtual environment
```bash
uv venv --python 3.12
source .venv/bin/activate # On macOS/Linux
```
# On Windows (PowerShell):
```bash
.venv\Scripts\activate
```
### 3️⃣ Install dependencies
```bash
uv add streamlit opencv-python pillow tensorflow numpy
```
💻 For macOS with Apple Silicon (M1/M2/M3)
```bash
uv add tensorflow-macos tensorflow-metal
```
### **Access the app:**
```
- **Local:** http://localhost:8501
- **Network:** URL shown in terminal
```
---
## 🖥️ How It Works
1. **Upload Images** → Drag & drop or browse files (JPG, PNG, JPEG)
2. **Preprocessing** → Images resized to 224×224 pixels for MobileNetV2
3. **AI Classification** → Model predicts from 1000+ ImageNet classes
4. **Results Display** → Top-3 predictions with confidence scores
### Supported Formats
- JPG, JPEG, PNG
- Multiple images (batch processing)
- Maximum file size: 200MB per file
---
## 📊 Example Output
🖼️ **Predictions for "golden_retriever.jpg"**
- **Golden retriever:** 94.27%
- **Labrador retriever:** 3.81%
- **Nova Scotia duck tolling retriever:** 1.02%
---
## 🔧 Configuration
### Custom Model Settings
In `main.py`, modify these parameters:
```python
IMG_SIZE = (224, 224) # MobileNetV2 input size
TOP_K = 3 # Number of top predictions
CONFIDENCE_THRESHOLD = 0.01 # Minimum confidence to display
```
---
## 📈 Performance
- **Model Size:** ~14MB (MobileNetV2)
- **Inference Time:** ~100-300ms per image
- **Accuracy:** 71.3% top-1 on ImageNet validation
- **Classes:** 1000 ImageNet categories
---
## 🚀 Deployment Options
### Local Development
```bash
uv run streamlit run main.py
```
---
### Streamlit Cloud
1. Push to GitHub
2. Connect to [Streamlit Cloud](https://streamlit.io/cloud)
3. Deploy with one click
---
### Docker (Optional)
```dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY . .
RUN pip install uv && uv sync
EXPOSE 8501
CMD ["uv", "run", "streamlit", "run", "main.py", "--server.port=8501"]
```
---
## 📌 Roadmap
- [ ] **Export Results** → Download predictions as CSV/JSON
- [ ] **Confidence Charts** → Visual probability bars
- [ ] **Custom Models** → Upload your own trained models
- [ ] **Batch Analysis** → Process entire folders
- [ ] **API Endpoint** → REST API for programmatic access
- [ ] **Enhanced UI** → Dark mode, animations, themes
---
## 🤝 Contributing
1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
---
## 📄 License
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
---
## 👨💻 Author
**Arsh Mishra**
- 🚀 Passionate about AI, ML, and Full-Stack Development
- 💼 Building innovative solutions with modern tech stacks
- 📧 [LinkedIn](https://www.linkedin.com/in/arsh-mishra-030093325/)
- 🐙 [GitHub](https://github.com/Arsh-pixel-cmd)
---
## 🙏 Acknowledgments
- TensorFlow team for MobileNetV2 architecture
- Streamlit for the amazing web framework
- ImageNet dataset contributors
- Open source community
---
**⭐ Star this repo if you found it helpful!**