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| 5 |
+
---
|
| 6 |
+
# Waste Identifer Classifcation Model
|
| 7 |
+
**By Amanda Sim**
|
| 8 |
+
|
| 9 |
+
# Context
|
| 10 |
+
This classification model aims to identify items and categorize them based on how they should be disposed of. Using YOLOv11,
|
| 11 |
+
this model fine-tunes previously trained datasets from Roboflow to fit new classes: recycle, trash, compost, and specialized disposal.
|
| 12 |
+
This model is intented to be used to help people correctly dispose of their items and can be used for smart bins, which detected the item a
|
| 13 |
+
person is holding and opens to the appropriate bin or for apps where the user can take a photo of the item and identify where it goes and how
|
| 14 |
+
to dispose of it.
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Training Data
|
| 19 |
+
#### Datasets
|
| 20 |
+
1. [Classifcation waste Computer Vision Model](https://universe.roboflow.com/gkhang/classification-waste) by GKHANG
|
| 21 |
+
|
| 22 |
+
**Classes**: 10
|
| 23 |
+
|
| 24 |
+
**Images**: 10,289
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
2. [Trash Computer Vision Dataset](https://universe.roboflow.com/baile/trash-izcuy) by BAILE
|
| 28 |
+
|
| 29 |
+
**Classes**: 48
|
| 30 |
+
|
| 31 |
+
**Images**: 101
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
#### Class Distribution
|
| 35 |
+
After merging the two datasets, I reorganized the classes into their new perspective classes seen in the table below.
|
| 36 |
+
| Recycle - 6,640 - 5,033 = 1,607 | Trash - 1,023 | Compost - 1,814 | Specialized Disposal - 1,026 | Deleted - 27 |
|
| 37 |
+
|---|---|---|---|---|
|
| 38 |
+
| Glass <br> Paper <br> Cardboard <br> Metal <br> Plastic <br> Glass <br> Drink can <br> Pop tab <br> Clear plastic bottle<br> Food can <br> Glass bottle <br> Glass jar <br> Other plastic bottle <br> Normal paper <br> Other carton <br> Other plastic wrapper <br> Aerosol <br> Aluminium foil <br> Drink carton <br> Paper bag <br> Toilet tube <br> Corrugated carton <br> Metal lid <br> Spread tub <br> Meal carton | Broken glass <br> Gloves <br> Masks <br> Cigarette <br> Plastic film <br> Foam cup <br> Disposable food container <br> Crisp packet <br> Metal bottle cap <br> Plastic lid <br> Plastic straws <br> Plastic utensils <br> Paper cup <br> Aluminium blister pack <br> Garbage bag <br> Tissues <br> Styrofoam piece <br> Paper straw <br> Single use carrier bag <br> Squeezable tube <br> Rope & string <br> Shoe <br> 6 pack rings <br> Disposable plastic cup | Biodegradable <br> Food waste <br> Egg carton | Syringe <br> Medicines <br> Metal bottle cap <br> Battery | Plastic bottle caps <br> Glass cup <br> Unlabeled litter <br> Other plastic |
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
This is the final class distributions
|
| 42 |
+
|Class | Train | Valid | Test | Total |
|
| 43 |
+
|-----------------------|------:|------:|------:|------:|
|
| 44 |
+
|Recycle | 992 | 324 | 234 | 1,607 |
|
| 45 |
+
|Trash | 626 | 223 | 151 | 1,023 |
|
| 46 |
+
|Compost | 1,151 | 389 | 269 | 1,814 |
|
| 47 |
+
|Specialized Disposal | 667 | 219 | 140 | 1,026 |
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
#### Annotation Process
|
| 51 |
+
For the compost class, some images included items that could not be composted (ex, red meat). I reviewed all the images and
|
| 52 |
+
moved non-compostable food waste to the trash category. <br>
|
| 53 |
+
|
| 54 |
+
For the classes I chose to delete, the first one being plastic bottle caps, from Google searches, it is generally
|
| 55 |
+
recommended to keep your bottle caps on your bottles when recycling, but for recycling plastic bottle caps, there were
|
| 56 |
+
specific requirements on what size can and cannot be recycled. For example, according to the Seattle Public Utilities,
|
| 57 |
+
loose bottle caps less than 3 inches in diameter go into the trash
|
| 58 |
+
([Seattle Public Utilities](https://www.seattle.gov/utilities/your-services/collection-and-disposal/where-does-it-go#/a-z )).
|
| 59 |
+
However, from the images alone, it’s difficult to interpret the size of the caps, so for less confusion in training,
|
| 60 |
+
I choose to opt out of including them. For glass cups, they cannot be recycled and generally recommended to donate them;
|
| 61 |
+
however, since there are only 3 images in this class, rather than adding a new “donate” class and risk significant class imbalance,
|
| 62 |
+
I choose to delete them. Lastly, for both unlabelled litter and other plastic, it was difficult to identify these items, so I chose
|
| 63 |
+
to delete them to minimize confusion. <br>
|
| 64 |
+
|
| 65 |
+
For the recycle class, it came up to a total of 6,640 images, but because the rest of the classes were within the 1,000 range,
|
| 66 |
+
and I wanted to try to prevent any false negatives and accuracy issues from imbalanced classes, I chose to delete 5,033 images
|
| 67 |
+
from the class and ended up with 1,607. <br>
|
| 68 |
+
|
| 69 |
+
#### Train/Valid/Test Split
|
| 70 |
+
- **Train**: 3,421 images (64%)
|
| 71 |
+
- **Valid**: 1,145 images (21%)
|
| 72 |
+
- **Test**: 791 images (15%)
|
| 73 |
+
|
| 74 |
+
#### Augmentations
|
| 75 |
+
- None
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
# Training Procedure
|
| 80 |
+
- **Framework**: Ultralytics
|
| 81 |
+
- **Hardware**: NVIDIA A100-SXM4-80GB
|
| 82 |
+
- **Batch Size**: 64
|
| 83 |
+
- **Epochs**: 50
|
| 84 |
+
- **Image Size**: 640
|
| 85 |
+
- **Patience**: 10
|
| 86 |
+
- **Preprocessing**: None
|
| 87 |
+
|
| 88 |
+
- _Early Stopping_: 38 epochs
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
# Evaluation Results
|
| 93 |
+
**Overall Breakdown**
|
| 94 |
+
| Top 1 Accuracy | F1-Score | Precision | Recall |
|
| 95 |
+
|-----------------------|---------:|----------:|-------:|
|
| 96 |
+
| 0.962 | 0.96 | 0.96 | 0.96 |
|
| 97 |
+
|
| 98 |
+
**Per-Class Breakdown**
|
| 99 |
+
| Class | Precision | Recall | F1-Score |
|
| 100 |
+
|-----------------------|----------:|-------:|---------:|
|
| 101 |
+
| Recycle | 0.98 | 0.96 | 0.97 |
|
| 102 |
+
| Trash | 0.95 | 0.91 | 0.93 |
|
| 103 |
+
| Compost | 0.98 | 0.99 | 0.98 |
|
| 104 |
+
| Specialized Disposal | 0.98 | 0.99 | 0.98 |
|
| 105 |
+
|
| 106 |
+
**Class Examples**
|
| 107 |
+
- Recycle
|
| 108 |
+
<img src='Recycle Class.png' alt="recycle class images" width="200" height="200">
|
| 109 |
+
- Trash
|
| 110 |
+
<img src='Trash Class.png' alt="trash class images" width="200" height="200">
|
| 111 |
+
- Compost
|
| 112 |
+
<img src='Compost Class.png' alt="compost class images" width="200" height="200">
|
| 113 |
+
- Specialized Disposal
|
| 114 |
+
<img src='Specialized Disposal Class.png' alt="specialized disposal class images" width="200" height="200">
|
| 115 |
+
|
| 116 |
+
**Confusion Matrix**
|
| 117 |
+
<img src='confusion_matrix_normalized.png' alt="Normalized Comfusion Matrix" width="500">
|
| 118 |
+
|
| 119 |
+
**Train/Loss and Val/Loss Curves**
|
| 120 |
+
<img src='results.png' alt="Train/Loss and Val/Loss Curves" width="500">
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
**Peformance Analysis**
|
| 124 |
+
|
| 125 |
+
From this model, the overall performance indicate high accuracy, with the top 1 accuracy being 0.962 and each class having a F1-score
|
| 126 |
+
in the 0.9 range. From the confusion matrix, we can see a perfect diagonal, which indicates the model was able to accurately predict
|
| 127 |
+
the items correctly. However we do see a few false negatives and positives, specifically where the model mixed up trash and specalized disposal is the highest, but this is very minor.
|
| 128 |
+
Looking at the train/loss curve shows that the model is learning effectively, with the downward shape curve and decreasing spikes as the
|
| 129 |
+
longer the model trains. From the metrics/accuracy_top1 curve we see large spikes towards the beginning of the training process but the
|
| 130 |
+
spikes slowly decreases as it trains longer, which indicates the model is improving it’s accuracy and showing stable performance.
|
| 131 |
+
For the validation loss curve, we see extremely high spikes towards the beginning, but the spikes slowly decreases as more training time
|
| 132 |
+
is applied. Lastly, for the metrics/accuracy_top5, this shows up as a horizontal line at 1 due to the fact that I only have 4 classes.
|
| 133 |
+
Overall, my model indicates high accuracy and no cases of overfitting, however, the model could benefit from longer training time to
|
| 134 |
+
allow the curves to smoothen out further and reach an eventual straight horizontal line.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
# Limitations and Biases
|
| 139 |
+
|
| 140 |
+
**Failure Cases**
|
| 141 |
+
- Struggled at identifying compost majority of the time
|
| 142 |
+
- ex: misidentifed bananas as recycle
|
| 143 |
+
- Confused specialized disposal for trash
|
| 144 |
+
- ex: items belonging in the trash class featured in images identified as specialized disposal
|
| 145 |
+
- someone wearing gloves while holding a syringe
|
| 146 |
+
|
| 147 |
+
**Limitation**
|
| 148 |
+
- Decisions on which classes belong in which were made based on Seattle's disposal guidelines, which can’t be used worldwide or statewide due to different disposal requirements and regulations.
|
| 149 |
+
- Model lacks representation and diversity in types of items in each class
|
| 150 |
+
|
| 151 |
+
**Poor Performing Class: Compost**
|
| 152 |
+
- Majority of images in the compost class feature pixelated or low-quality images, making it difficult for the model to identify items in this class correctly.
|