An open API service indexing awesome lists of open source software.

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.

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.

![Python](https://img.shields.io/badge/Python-3.12-blue.svg)
![TensorFlow](https://img.shields.io/badge/TensorFlow-2.x-orange.svg)
![Streamlit](https://img.shields.io/badge/Streamlit-1.x-red.svg)
![License](https://img.shields.io/badge/License-MIT-green.svg)

---

## 🚀 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!**