SmartBin is an AI-powered waste classification system that leverages deep learning models to identify and categorize different types of waste. This project provides a RESTful API built with FastAPI and supports multiple state-of-the-art deep learning models for image classification.
The deep learning models used in this project are trained using the Garbage Classification repository. This repository contains a comprehensive dataset processing pipeline, model selection, training scripts, and evaluation tools to generate high-accuracy waste classification models.
SmartBin supports the following deep learning models for waste classification:
- DenseNet -
densenet201 - EfficientNet -
efficientnet_b7 - GoogLeNet -
GoogLeNet - LeNet -
LeNet - MobileNetV2 -
mobilenet_v2 - MobileNetV3 -
mobilenet_v3_large - ResNet -
resnet50 - AlexNet -
AlexNet - ShuffleNetV2 -
shufflenet_v2_x2_0 - VGG -
vgg - RegNet -
regnet_x_32gf
Each model processes an input image and predicts the most probable waste category. The models are optimized for both GPU and CPU execution, automatically detecting the available hardware.
Since the model weights are too large to be stored directly in the repository, we have provided a Google Drive link to download them. Follow these steps to properly set up the weights for the backend:
- Access the model weights from the following Google Drive link:
Download Model Weights - Download all files in the folder.
- Navigate to the backend directory in your local project:
cd path/to/SmartBin/backend - Create a new folder named
weightsinside the backend directory:mkdir weights
- Place all downloaded
.pthor.ptmodel weight files into theweights/directory. - Ensure that the folder structure looks like this:
SmartBin/ ├── backend/ │ ├── weights/ │ │ ├── AlexNet.pth │ │ ├── DenseNet.pth │ │ ├── ...
-
Install Dependencies
- Ensure Docker and Docker Compose are installed on your system.
- If using a GPU, install the NVIDIA Container Toolkit:
sudo apt-get install -y nvidia-container-toolkit
-
Clone the Repository
git clone https://github.com/AlanY1an/Smartbin cd smartbin -
Build and Run Containers
docker compose up --build -d
This will:
- Build the Docker images
- Start the FastAPI backend
- Start the frontend
- Enable GPU acceleration if supported
-
Verify Deployment
- Backend API:
http://127.0.0.1:8000/docs - Frontend UI:
http://127.0.0.1:3000
- Backend API:
-
Check GPU Availability (Optional)
docker exec -it <backend-container-id> nvidia-smi
-
Stop and Remove Containers
docker compose down
-
Install Prerequisites
- Python (>= 3.8)
- Node.js (>= 18)
- Git
-
Clone the Repository
git clone https://github.com/your-repo/smartbin.git cd smartbin -
Run the Backend
cd backend pip install -r requirements.txt uvicorn app:app --host 0.0.0.0 --port 8000 --reload- The API will be available at:
http://127.0.0.1:8000/docs
- The API will be available at:
-
Run the Frontend
cd frontend npm install npm run dev- The frontend UI will be available at:
http://127.0.0.1:3000
- The frontend UI will be available at:
The project includes an interactive API documentation via Swagger UI:
- Open http://127.0.0.1:8000/docs in your browser.
- Support for real-time image classification via a mobile app
- Expansion of the dataset for improved model accuracy
- Integration with AWS for scalable deployment
This project is licensed under the MIT License. See LICENSE for details.
