Upload 3 files
Browse files
README.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## **Trash Classification Using CNN (MobileNetV2)** 🗑️
|
2 |
+
|
3 |
+
---
|
4 |
+
|
5 |
+
### **Project Overview**
|
6 |
+
This project aims to classify images of trash into predefined categories using a Convolutional Neural Network (CNN) based on the MobileNetV2 architecture. The classification model is trained to assist in waste segregation and recycling processes by accurately identifying the type of trash in an image.
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
### **Features**
|
11 |
+
- Uses the MobileNetV2 architecture for efficient and accurate image classification.
|
12 |
+
- Classifies trash into six categories: **trash**, **plastic**, **cardboard**, **metal**, **paper**, and **glass**.
|
13 |
+
- Includes an automated pipeline for data preparation, model training, and evaluation.
|
14 |
+
- Employs techniques like **data augmentation** and **oversampling** to improve model performance.
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
### **Dataset**
|
19 |
+
The dataset is sourced from [Hugging Face - TrashNet Dataset](https://huggingface.co/datasets/garythung/trashnet), which contains labeled images of trash items categorized into six classes.
|
20 |
+
|
21 |
+
---
|
22 |
+
|
23 |
+
### **Steps Involved**
|
24 |
+
|
25 |
+
#### **1. Data Loading**
|
26 |
+
- The dataset is uploaded to Google Drive and accessed using Python's `os` library.
|
27 |
+
|
28 |
+
#### **2. Data Exploration**
|
29 |
+
- Analyze the dataset to understand class distributions and image counts for each category.
|
30 |
+
- Visualize sample images to gain insights into their patterns and variations.
|
31 |
+
|
32 |
+
#### **3. Data Splitting**
|
33 |
+
- Split the dataset into **training (70%)**, **validation (15%)**, and **testing (15%)** subsets to ensure robust training and evaluation.
|
34 |
+
|
35 |
+
#### **4. Data Preprocessing**
|
36 |
+
- Perform resizing, normalization, and balancing of classes using oversampling to handle class imbalances.
|
37 |
+
- Apply data augmentation techniques, including rotation, zooming, and rescaling, to enhance dataset diversity.
|
38 |
+
|
39 |
+
#### **5. Model Building**
|
40 |
+
- Utilize MobileNetV2, a lightweight and efficient CNN architecture pre-trained on ImageNet, for transfer learning.
|
41 |
+
- Fine-tune the model using the trash dataset to adapt it to the classification task.
|
42 |
+
|
43 |
+
#### **6. Model Training**
|
44 |
+
- Train the model using the prepared dataset, optimizing the loss function with an appropriate optimizer (e.g., Adam).
|
45 |
+
- Use validation data to monitor performance and avoid overfitting.
|
46 |
+
|
47 |
+
#### **7. Model Evaluation**
|
48 |
+
- Test the model on unseen data and evaluate its performance using metrics such as accuracy, precision, recall, and F1-score.
|
49 |
+
|
50 |
+
---
|
51 |
+
|
52 |
+
### **Requirements**
|
53 |
+
- Python 3.8 or later
|
54 |
+
- TensorFlow/Keras
|
55 |
+
- NumPy, Pandas, Matplotlib
|
56 |
+
- Google Colab or any Python-compatible IDE
|
57 |
+
|
58 |
+
### **Results**
|
59 |
+
- The final model achieved an accuracy of **90%** on the test set and **95%** on the train set.
|
60 |
+
|
61 |
+
---
|
62 |
+
|
63 |
+
## **Future Work**
|
64 |
+
- Improve model accuracy with additional data and advanced augmentation techniques.
|
65 |
+
- Deploy the model as a web application for real-time trash classification.
|
66 |
+
- Incorporate additional classes for more granular waste categorization.
|
67 |
+
|
68 |
+
---
|
Trash_Classification_CNN_Mobilenet_v2.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
cnn_trash_classification_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4b0e55f8aa6641ea98ab3980512888c8bd1a30369839f20e41ed43addb71d8c6
|
3 |
+
size 60895840
|