For GEEN-1400 or First-Year Engineering Projects at the University of Colorado Boulder, we, Team-51, were tasked with creating a product that had a positive impact on sustainability especially on our campus.
We came up with the idea of a smart trash can that would sort your trash to help with the problem of waste being disposed of improperly using computer vision.
Below you will find all of the source code used to train and inference our AI model. The Usage section contains many examples and helpful visuals
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This is our project that we presented at the ITLL Design Expo.
Here is a depiction of a very rough prototype of our project.
This repository contains the triton_server submodule that you can use if you wish to inference a remote model. In this project, a remote triton server is being used.
If you would like to initilise the git lfs tc-triton-submodule after cloning the repo follow these steps.
- Make sure git lfs is installed
git lfs install
- cd into submodule directory
cd triton_server
- Initilize local configuration file & clone
git submodule init
git submodule update
Or you could just make it easy and just run
git clone --recurse-submodules https://github.com/Eilliw/trash-classification-public.git
This is intended to be run on a raspberry pi running on Debian bookworm
- Pi updates
sudo apt update
sudo apt upgrade
- Pi required packages
sudo apt install -y python3-picamera2 python3-rpi.gpio
- libcamera
Make sure libcamera is up to date and shows a preview from one of the follwing commands
libcamera-hello
libcamera-hello --qt-preview
- pigpiod
This package is heavily reccomended since it controls servos with minial twitch
sudo apt install pigpiod
Follow these instructions to get a local copy up and running. Much of the code will have to be changed to fix path issues.
- Clone the repo
git clone https://github.com/Eilliw/trash-classification-public.git
- cd into repo directory
- Create python venv
python3 -m venv venv --system-site-packages
- Install python dependencies
source venv/bin/activate
pip3 install -r edge_requirements.txt
- Edit
bin/run_edge_on_startup.sh
paths - Set Roboflow API key in
.env
ROBOFLOW_API_KEY="YOUR API KEY HERE"
- Run either testing script or running script
bash bin/run_testing.sh
bash bin/run_on_startup.sh
The dorito bag and the reciept are being classified as trash at 97.6% and 94.6% confidence respectively
The Celcius can above is being classified as recycling at 97% confidence
Of the above models trash-classification is being used as our main model as it is trained apon our dataset and the current version of our model is version 3. All models stored in the tc-triton-server are stored in the torchscript format using git lfs.
For more examples, please refer to the Documentation
Below you will find some simple documentation including flowcharts and explanations of code to a shallow extent.
During our expo we controlled when the trash can would open using a button. This Button has a call back that would take an image, output a model inference, and depending on the output, open one of the trashcan doors.
To testing our AI model's accuracy, see the image it was working with, and have a more acessible way to testing our product we created a GUI. This GUI was built with tkinter and automatically captures the most recent camera image. You click a button based on the classification of the image and it is saved to disk to later be uploaded to our dataset on Roboflow. The classification of said image is also shown to give you information on if the model already knows this object.
- Simple training Notebook
- Edge inference
- via Triton Server
- Via local tflite model
- Testing
- pi camera data collection
- Auto dataset upload
- Gui
- Voxel Fiftyone integration
- Triton server container script
- Post Expo
- Docker traning container
- Auto traning
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under an MIT License. See LICENSE
for more information.
Willie Chuter - [email protected]
Project Link: https://github.com/Eilliw/trash-classification-public