MIDS Capstone Project Spring 2024

WasteWizard

Overview

Our project aims to tackle the critical issue of waste mismanagement through WasteWizard, an AI consumer app that leverages computer vision to enable users to upload images of waste and receive information on their appropriate waste categories and disposal methods. With the US recycling rate at just 32% (EPA 2018), optimizing waste sorting is urgent. WasteWizard accurately categorizes images of waste into 26 sub-categories of recyclables, e-waste, and hazardous materials, reducing reliance on manual labor and minimizing waste contamination. Ultimately, this innovation promises to empower users with clear waste sorting guidance, enhance recycling efficiency, decrease landfill overflow, and mitigate environmental hazards associated with improper waste disposal.

Motivation

Waste sorting is a crucial process, allowing us to differentiate trash, recyclables, and toxic waste which end up in landfills, recycling centers, and trash incinerators, respectively. The process of sorting begins in households, where families separate their trash from compostable and recyclable items, and continues in material recovery facilities where workers and machines sort the remaining waste into different categories themselves.

The United States recycling rate is currently at 32% (EPA 2018) with many households not sorting trash themselves, resulting in the material recovery facility workers going through enormous amounts of contaminated and sometimes hazardous waste. In this labor intensive process, some recyclable materials or hazardous materials for the environment can still find themselves in our already overused landfills. Additionally, many household items that are thrown into recycling bins are often not even recyclable, which not only increases the sorting workload at transfer centers but also causes a common misconception that people are using more recyclable items to be environmentally friendly than they really are.

Impact

Our waste sorting AI application promises significant impacts across various domains. By streamlining recycling processes, it simplifies waste management, enhancing the accessibility of recycling for individuals and commercial facilities alike. This not only promotes increased participation in waste sorting but also ensures higher accuracy in sorting practices. In waste processing facilities, the application fosters a safer and more efficient working environment by enabling automation in sorting tasks, reducing reliance on manual labor and minimizing potential hazards. Moreover, by curbing the amount of waste destined for landfills, the application contributes to the conservation of precious natural resources while mitigating environmental degradation. Material recovery facilities stand to benefit from improved sorting machine accuracy and efficiency, empowering workers to focus on higher-value tasks instead of manual sorting. Ultimately, the application's multifaceted impact extends beyond mere waste management, fostering sustainability and environmental stewardship across the board.

Methodology

In our data flow architecture, the process begins with users interacting with the UI, where they upload image files. These files are subsequently transferred to Amazon S3 for storage. Meanwhile, a Lambda function is actively monitoring for any file change events. Upon detection of such an event, the Lambda function triggers an EC2 instance, initiating the execution of our model on the uploaded files. The outcomes generated by the model are then persisted in an AWS DynamoDB table, which is established through AWS AppSync. Finally, the UI sends a request to AWS AppSync to access the data stored in the DynamoDB table, and AppSync promptly delivers the results back to the user's browser for display and further interaction.

For our waste sorting AI application, we've undertaken a complex multiclass image classification task spanning 26 waste categories, covering everything from cardboard to general trash, including subcategories within each. Our machine learning models predict the presence of all classes and employ a final conditional statement to determine recyclability. Following data merging in our processing pipeline, we executed several crucial preprocessing steps. We resized images, applying padding and eliminating transparency, background noise, and duplicate images to ensure uniformity and clarity. Subsequently, we normalized pixel values and partitioned the dataset into distinct training, testing, and validation subsets, maintaining an 80/20 split ratio. However, during the initial preprocessing phase, we encountered numerous images with incorrect labels, significantly impacting model performance. Through meticulous identification and removal of these problematic images from the dataset, we observed a marked improvement in the overall efficacy of our models.

In our machine learning approach, we leveraged a variety of tools and libraries to facilitate model development and deployment. AWS services, including EC2 for computing power, SageMaker for model training and deployment, and S3 buckets for efficient data storage, formed the backbone of our infrastructure. Python served as our primary programming language, with PyTorch and TensorFlow acting as core model frameworks. Additionally, we utilized a range of libraries such as Scikit-learn for machine learning tasks, along with essential packages like NumPy and Pandas for data manipulation and analysis. Visualization needs were met through Matplotlib, while our toolkit encompassed an array of other libraries tailored to specific requirements, ensuring comprehensive support for our waste sorting AI application development.

In our machine learning experimentation, we explored a diverse range of techniques to optimize model performance and address various challenges. To tackle class imbalance, we adjusted class weights, ensuring equitable representation of all waste categories. Additionally, we incorporated regularization methods to mitigate overfitting, penalizing large weights using the L2 norm and implementing dropout rates for enhanced generalization. Batch normalization and early stopping mechanisms further contributed to model stability and convergence. Hyperparameter tuning played a crucial role in fine-tuning model architecture and training parameters, including adjustments to layer configurations, learning rates, optimizers, and activation functions.

Leveraging transfer learning, we evaluated popular convolutional neural network architectures trained on our dataset, enhancing model efficiency and accuracy. Ensembling techniques, such as boosting of transfer learning models and voting among top-performing models, were utilized to harness collective predictive power. Furthermore, we implemented model checkpointing to save model states at different training stages, ensuring resilience against potential disruptions and facilitating model reproducibility and scalability.

Evaluation

In assessing the performance of our waste sorting image classification, we prioritize the Macro-F1 score as our primary evaluation metric. This choice stems from our recognition that the dataset's class distribution may not accurately reflect real-world scenarios, where users may submit images of certain classes more frequently than others. To ensure a balanced assessment across all classes, we opt for the Macro-F1 score, which assigns equal importance to each class without bias towards those with more instances in the dataset. This approach enables us to gauge the model's effectiveness in accurately classifying all waste categories, regardless of their prevalence in the training data, thus providing a more comprehensive measure of overall performance.

Last updated: April 18, 2024