This project is an AI-powered waste classification system designed to identify types of waste using image classification. The system includes a trained model, a Flask backend API for classification, and a React Native frontend for uploading or capturing images for classification. The model was trained using TensorFlow and deployed locally for demonstration purposes.
-
Image Classification: Classifies waste into 12 categories:
- Battery
- Biological
- Brown-glass
- Cardboard
- Clothes
- Green-glass
- Metal
- Paper
- Plastic
- Shoes
- Trash
- White-glass
-
Mobile App:
- Upload images from the gallery.
- Capture images using the device camera.
- Displays the top classification result with the highest confidence score.
-
Backend:
- Flask API for classification.
- TensorFlow model integration.
- Handles image preprocessing and prediction.
- React Native (Expo)
- Expo Image Picker for gallery and camera access
- Flask
- TensorFlow
- Flask-CORS
- Local deployment for demo purposes
- Railway (optional for hosting the Flask backend)
- Node.js and npm installed
- Python 3.9+
- Expo CLI installed globally:
npm install -g expo-cli
- Install Python dependencies:
pip install -r requirements.txt
-
Clone the repository:
git clone https://github.com/your-repo/waste-classification cd waste-classification/backend -
Install dependencies:
pip install -r requirements.txt
-
Run the Flask API locally:
python app.py
-
Test the API using Postman or curl:
curl -X POST -F [email protected] http://127.0.0.1:5000/classify
-
Navigate to the frontend directory:
cd ../frontend -
Install dependencies:
npm install
-
Start the Expo server:
npx expo start
-
Download the Expo Go app on your Iphone and scan the QR code using the Iphone camera to view the app.
- Open the React Native app on your iPhone using Expo Go.
- Select an image from the gallery or take a picture.
- Press the "Classify Image" button.
- View the classification result, showing the type of waste with the highest confidence score.
- Architecture: MobileNetV2 pretrained on ImageNet with custom classification layers.
- Training Data: Kaggle Garbage Classification dataset.
- Output: Trained TensorFlow model (
waste_classified_epoch_10_val_accuracy_0.94.h5).
- Misclassifications may occur due to insufficient training data for certain categories.
- Aluminum cans may be classified as plastic due to dataset limitations.
- Requires local Flask backend for the React Native app to work.
- Dataset Expansion:
- Include more samples for underrepresented categories (e.g., aluminum cans).
- Model Optimization:
- Fine-tune the model with additional epochs and data augmentation.
- Deployment:
- Host the backend on a cloud platform like Railway or AWS.
- Build and deploy the React Native app using Expo EAS for a standalone iOS app.
waste-classification/
├── backend/
│ ├── app.py
│ ├── requirements.txt
│ ├── waste_classified_epoch_10_val_accuracy_0.94.h5
├── frontend/
│ ├── App.js
│ ├── package.json
│ ├── node_modules/
├── README.md
This project is licensed under the MIT License.