File size: 4,227 Bytes
496fb01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9db07f7
496fb01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
title: E-Commerce Image Classifier
emoji: πŸ›’
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 8501
tags:
 - streamlit
license: apache-2.0
---

# E-Commerce Image Classifier πŸ›’

An intelligent image classification application powered by MediaPipe and Streamlit that automatically categorizes e-commerce product images using a pre-trained deep learning model.

## 🌟 Features

- **Real-time Image Classification**: Upload images and get instant classification results
- **Batch Processing**: Upload multiple images or entire directories
- **Interactive Navigation**: Browse through multiple images with intuitive arrow controls
- **Customizable Results**: Choose how many classification results to display (1-5)
- **Confidence Scores**: Visual progress bars showing prediction confidence
- **Modern UI**: Clean, responsive interface optimized for all screen sizes
- **Pre-loaded Samples**: Default images available for quick testing

## πŸš€ Live Demo

Try the live demo on Hugging Face Spaces: [Your Space URL]

## 🎯 How to Use

1. **Upload Images**: 
   - Choose between "Directory" mode to upload a folder of images
   - Or "Select Images" mode to pick individual files
   
2. **View Results**:
   - See the original image on the left
   - Classification results with confidence scores on the right
   
3. **Navigate**:
   - Use arrow buttons (⬅️ ➑️) to browse through multiple images
   - Current image counter shows your position in the gallery

4. **Customize**:
   - Adjust "Number of classes to display" in the sidebar (1-5)
   - View top predictions based on your preference

## πŸ› οΈ Tech Stack

- **Frontend**: Streamlit
- **ML Framework**: MediaPipe
- **Computer Vision**: OpenCV
- **Model**: Pre-trained TFLite classifier (ImageNet 1000 categories)
- **Language**: Python 3.12+

## πŸ“¦ Installation

### Local Setup

```bash
# Clone the repository
git clone https://github.com/travelmateen/image-classification-ecommerce
cd Image_Classifier

# Install dependencies
pip install -r requirements.txt

# Run the application
streamlit run streamlit_app.py
```

### Docker Deployment

```bash
# Build the Docker image
docker build -t image-classifier .

# Run the container
docker run -p 8501:8501 image-classifier

# Access at http://localhost:8501
```

## πŸ€— Deploy on Hugging Face Spaces

1. **Create a new Space**:
   - Go to [Hugging Face Spaces](https://huggingface.co/spaces)
   - Click "Create new Space"
   - Select "Streamlit" as the SDK

2. **Upload your files**:
   - `streamlit_app.py`
   - `requirements.txt`
   - `classifier.tflite`
   - `images/` folder (optional)
   - `README.md`

3. **Configure**:
   - The app will automatically deploy using the settings in this README's header
   - Wait for the build to complete
   - Your app will be live!

## πŸ“‹ Requirements

```
streamlit>=1.51.0
opencv-python-headless
mediapipe>=0.10.21
```

## ⚠️ Known Limitations

- Uses pre-trained MediaPipe general classifier
- Limited to 1000 ImageNet categories
- Not customized for specific product domains
- Maximum 10MB per image
- Best results with clear, single-subject images

## πŸ’‘ Tips for Best Results

- Use clear, well-lit images
- Single subject per image works best
- Avoid ambiguous or complex scenes
- Common objects and scenes perform better
- Good focus and resolution recommended

## πŸ”§ Model Information

- **Model**: MediaPipe Image Classifier
- **Format**: TensorFlow Lite (.tflite)
- **Categories**: 1000 ImageNet classes
- **Input Size**: Variable (automatically resized to 450x300 for display)
- **Architecture**: MobileNet-based

## πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

## πŸ™ Credits

**Developed by [Techtics.ai](https://techtics.ai)**

Built with:
- [MediaPipe](https://mediapipe.dev/) by Google
- [Streamlit](https://streamlit.io/)
- [OpenCV](https://opencv.org/)

## πŸ› Issues and Contributions

Found a bug or want to contribute? Please open an issue or submit a pull request on [GitHub](https://github.com/travelmateen/image-classification-ecommerce).

## πŸ“§ Contact

For questions or collaborations, visit [Techtics.ai](https://techtics.ai)

---

Made with ❀️ by Techtics.ai