akmalia31 commited on
Commit
9729764
·
verified ·
1 Parent(s): 364a1c4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -68
README.md CHANGED
@@ -1,68 +1,103 @@
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
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - garythung/trashnet
4
+ metrics:
5
+ - accuracy
6
+ - precision
7
+ - recall
8
+ pipeline_tag: image-classification
9
+ ---
10
+ ### **Model Card: Trash Classification Using MobileNetV2**
11
+
12
+ ---
13
+
14
+ ## **Model Details**
15
+
16
+ - **Model Name**: Trash Classification CNN with MobileNetV2
17
+ - **Model Type**: Convolutional Neural Network (CNN)
18
+ - **Architecture**: MobileNetV2
19
+ - **Dataset**: [TrashNet Dataset](https://huggingface.co/datasets/garythung/trashnet)
20
+ - **Languages**: None (Image-based model)
21
+ - **License**: MIT
22
+
23
+ ---
24
+
25
+ ## **Model Description**
26
+
27
+ This model classifies images of trash into six categories:
28
+ - **trash**
29
+ - **plastic**
30
+ - **cardboard**
31
+ - **metal**
32
+ - **paper**
33
+ - **glass**
34
+
35
+ The model is designed to assist in waste segregation and recycling initiatives by automating the identification of waste types. It uses MobileNetV2, a lightweight CNN architecture pre-trained on ImageNet, fine-tuned on the TrashNet dataset for this specific task.
36
+
37
+ ---
38
+
39
+ ## **Intended Use**
40
+
41
+ ### **Primary Use Cases**
42
+ - Waste management systems to automate sorting.
43
+ - Educational tools for teaching about recycling and waste segregation.
44
+ - Integration into mobile or web applications for real-time waste classification.
45
+
46
+ ### **Limitations**
47
+ - Model performance may degrade with images of poor quality or those significantly different from the training dataset.
48
+ - Currently supports only six predefined trash categories.
49
+
50
+ ---
51
+
52
+ ## **Performance Metrics**
53
+
54
+ - **Training Accuracy**: 95%
55
+ - **Testing Accuracy**: 90%
56
+ - **Metrics Evaluated**: Accuracy, Precision, Recall, F1-score
57
+ - **Confusion Matrix**: [Available in evaluation results]
58
+
59
+ ---
60
+
61
+ ## **How to Use the Model**
62
+
63
+ ### **Input Format**
64
+ - Images resized to 224x224 pixels and normalized to a range of 0-1.
65
+
66
+ ### **Output**
67
+ - A probability distribution over six classes with the predicted label.
68
+
69
+ ### **Code Example**
70
+
71
+ ```python
72
+ from transformers import pipeline
73
+ from PIL import Image
74
+
75
+ # Load pre-trained model
76
+ classifier = pipeline("image-classification", model="your-model-id")
77
+
78
+ # Load an image
79
+ image = Image.open("sample_image.jpg")
80
+
81
+ # Perform classification
82
+ results = classifier(image)
83
+ print(results)
84
+ ```
85
+
86
+ ---
87
+
88
+ ## **Training Details**
89
+
90
+ - **Framework**: TensorFlow/Keras
91
+ - **Optimizer**: Adam
92
+ - **Learning Rate**: 0.001
93
+ - **Loss Function**: Categorical Crossentropy
94
+ - **Batch Size**: 32
95
+ - **Epochs**: 20
96
+
97
+ ### **Data Preprocessing**
98
+ - Images were resized to 224x224 pixels and normalized.
99
+ - Oversampling and data augmentation techniques (rotation, zoom, and rescaling) were applied to handle class imbalance and enhance generalization.
100
+
101
+ ---
102
+
103
+ This model card is designed to comply with Hugging Face standards and can be adapted further as needed. Let me know if you need any specific sections expanded!