Skip to content

Commit a5ebb66

Browse files
Enhance README documentation and add MIT license
1 parent 48554d4 commit a5ebb66

2 files changed

Lines changed: 112 additions & 36 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Om & Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 91 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,97 @@
1-
# PlasticDetect AI (V1)
1+
# ♻️ PlasticDetect AI
22

3-
A mobile-first PWA that identifies plastic waste from a photo using a real
4-
trained MobileNetV2 model running entirely on-device via TensorFlow.js —
5-
no photo ever leaves the phone.
3+
[![TensorFlow.js](https://img.shields.io/badge/TensorFlow.js-FF6F00?style=for-the-badge&logo=tensorflow&logoColor=white)](https://www.tensorflow.org/js)
4+
[![Teachable Machine](https://img.shields.io/badge/Google_Teachable_Machine-4285F4?style=for-the-badge&logo=google&logoColor=white)](https://teachablemachine.withgoogle.com/)
5+
[![PWA](https://img.shields.io/badge/PWA-Ready-5A0FC8?style=for-the-badge&logo=pwa&logoColor=white)](https://web.dev/progressive-web-apps/)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)
7+
8+
An intelligent, privacy-first **Progressive Web Application (PWA)** that detects and classifies plastic waste categories in real-time directly on your mobile device using **TensorFlow.js** and **MobileNetV2**.
9+
10+
---
11+
12+
## 🌟 Key Features
13+
14+
- 🔒 **100% On-Device & Privacy-Preserving:** AI inference runs entirely client-side in the browser via TensorFlow.js — no images or camera feeds are ever sent to an external server.
15+
- 🏷️ **9 Plastic Resin Classifications:** Identifies PET, HDPE, PVC, LDPE, PP, PS, PLA, ABS, and PC with real-time confidence scores.
16+
- 📱 **Mobile-First Progressive Web App (PWA):** Installable on Android & iOS home screens with full offline support enabled by service worker caching.
17+
- ♻️ **Recycling & Disposal Guide:** Provides recycling recommendations, resin codes, and decomposition insights for detected plastic types.
18+
- 🌓 **Modern UI:** Responsive design with smooth animations, dark/light theme switching, and live camera / photo upload support.
19+
- 🛡️ **Heuristic Fallback:** Intelligent fallback mechanism ensuring graceful degradation if WebGL or model initialization fails.
20+
21+
---
22+
23+
## 🧠 AI Pipeline & Dataset Curation
24+
25+
1. **Dataset Collection:**
26+
- Manually curated and labeled image datasets gathered across real-world plastic items, resin codes, packaging materials, and varying lighting conditions.
27+
2. **Model Training:**
28+
- Trained via **Google Teachable Machine** using transfer learning on a **MobileNetV2** deep convolutional neural network backbone.
29+
3. **Model Export & Optimization:**
30+
- Converted into TensorFlow.js graph model format (`model.json` + binary weights) for fast, hardware-accelerated WebGL inference in mobile browsers.
31+
32+
---
33+
34+
## 🏗️ Architecture & Tech Stack
635

7-
## Run it
8-
```bash
9-
cd plasticdetect-ai
10-
python3 -m http.server 8000
11-
```
12-
Open `http://localhost:8000` (camera needs a secure context — localhost is
13-
fine; for phone testing, deploy over HTTPS, e.g. GitHub Pages or Netlify).
14-
15-
## What's real
16-
- **Classifier**: MobileNetV2 transfer learning, trained via Google Teachable
17-
Machine (9 classes: PET/HDPE/PC/PP/LDPE/ABS/PLA/PS/PVC). Converted to
18-
TensorFlow.js, runs client-side.
19-
- Loads once, cached in memory for the session; service worker caches the
20-
model + tfjs runtime for offline use after first visit.
21-
- Confidence breakdown shown for every class, not just the top prediction.
22-
- Heuristic fallback (color/brightness/texture) only kicks in if the model
23-
or TF.js fails to load — you'll see a banner if that happens.
24-
- Everything else (camera, gallery, history, dark mode, PWA) — fully working.
25-
26-
## Not yet covered
27-
Mixed / multi-layer plastic — no public labeled dataset exists for this
28-
class; the app's guide/info screens still describe it, but the live
29-
classifier can't predict it (falls into "Unknown" at low confidence instead).
30-
31-
## Folder structure
3236
```
3337
plasticdetect-ai/
34-
├── index.html
35-
├── manifest.json / service-worker.js
36-
├── css/styles.css
38+
├── index.html # Main UI & responsive interface
39+
├── manifest.json # PWA configuration & app metadata
40+
├── service-worker.js # Offline caching for assets & model weights
41+
├── css/
42+
│ └── styles.css # Responsive styling & theme variables
3743
├── js/
38-
│ ├── data.js # plastic knowledge base
39-
│ ├── classifier.js # real model + heuristic fallback
40-
│ ├── model/ # tfjs model.json + weights.bin + class_map.json
41-
│ └── app.js
44+
│ ├── app.js # UI controller, camera streams & event handling
45+
│ ├── classifier.js # TensorFlow.js model loader & inference engine
46+
│ ├── data.js # Plastic resin knowledge base & disposal guide
47+
│ └── model/ # Trained TF.js model files & class mappings
48+
│ ├── model.json
49+
│ ├── weights.bin
50+
│ └── class_map.json
51+
└── icons/ # PWA app icons
52+
```
53+
54+
| Component | Technology |
55+
|---|---|
56+
| **Frontend** | Vanilla JavaScript (ES6+), HTML5, CSS3 |
57+
| **Machine Learning** | TensorFlow.js, MobileNetV2, Google Teachable Machine |
58+
| **Offline & Storage** | Service Workers, Cache API, Web Manifest |
59+
| **Acceleration** | WebGL / GPU-accelerated browser execution |
60+
61+
---
62+
63+
## 🚀 Quick Start
64+
65+
### 1. Clone the repository
66+
```bash
67+
git clone https://github.com/omukinkar18-hub/plasticdetect-ai.git
68+
cd plasticdetect-ai
69+
```
70+
71+
### 2. Run locally
72+
Start any local HTTP server:
73+
74+
```bash
75+
# Using Python
76+
python3 -m http.server 8000
77+
78+
# Or using Node.js / npx
79+
npx serve .
4280
```
81+
82+
Open `http://localhost:8000` in your browser.
83+
84+
> [!NOTE]
85+
> Accessing the camera requires a secure context (`localhost` or `HTTPS`). For testing on mobile devices, deploy via GitHub Pages or an HTTPS-enabled host.
86+
87+
---
88+
89+
## 🤝 Contributing
90+
91+
Contributions, feedback, and dataset expansions are welcome! Feel free to open an issue or submit a pull request.
92+
93+
---
94+
95+
## 📄 License
96+
97+
This project is open-source and available under the [MIT License](LICENSE).

0 commit comments

Comments
 (0)