Skip to content

Waste image classification using CNN (MobileNetV2 & DenseNet121) on the TrashNet dataset with augmentation and class weighting.

Notifications You must be signed in to change notification settings

arielyosua/Waste-Classification-Using-Convolutional-Neural

Repository files navigation

🗑️ Waste Classification Using Convolutional Neural Network (CNN)

This project implements an image classification system to automatically classify waste into six categories using deep learning (CNN) with TensorFlow and Keras. The dataset used is TrashNet, which contains images of various types of waste.

📁 Project Structure

ML - TUBES/
├── Trashnet/                        # Original dataset (belum dipisah)
│   ├── cardboard/
│   ├── glass/
│   ├── metal/
│   ├── paper/
│   ├── plastic/
│   └── trash/
│
├── Trashnet_split/                 # Dataset setelah split: train/val/test
│   ├── train/
│   ├── val/
│   └── test/
│
├── ArielYosuaHasibuan_FP_ML2425_manual_book.pdf     # Manual book (penjelasan kode)
├── ArielYosuaHasibuan_FP_ML2425_paper.pdf           # Laporan akhir
├── ArielYosuaHasibuan_FP_ML2425_source_code.ipynb   # Notebook proyek
└── README.md                                        # Dokumentasi proyek (file ini)

🧾 Waste Categories

  • cardboard
  • glass
  • metal
  • paper
  • plastic
  • trash (minority class)

⚙️ Techniques Implemented

  • Data Splitting: 70% train, 17% val, 13% test
  • Image Preprocessing with ImageDataGenerator
  • Data Augmentation focused on minority class trash
  • Class Weighting to handle class imbalance
  • Transfer Learning using pretrained MobileNetV2 and DenseNet121
  • Fine-Tuning: Partial unfreezing of layers for performance improvement
  • Callbacks:
    • ModelCheckpoint (save best model)
    • EarlyStopping (prevent overfitting)
    • ReduceLROnPlateau (adjust learning rate)

🧠 Model Architectures

Model Notes
MobileNetV2 Lightweight, fast convergence
DenseNet121 Deeper model, higher final accuracy

📊 Performance Summary

Model Accuracy F1-Score Recall (Trash)
MobileNetV2 ~79% 0.77 0.67
DenseNet121 86% 0.86 0.83

📈 Evaluation

  • Confusion matrix for each model
  • Classification report: precision, recall, F1-score per class
  • Accuracy and loss graphs (training vs validation)

🛠 How to Run

  1. Clone this repository
    git clone https://github.com/arielyosua/Waste-Classification-Using-Convolutional-Neural.git cd Waste-Classification-Using-Convolutional-Neural

  2. Install dependencies
    pip install -r requirements.txt

  3. Make sure folder Trashnet is populated with original dataset images
    or download from TrashNet GitHub

  4. Run source code in Jupyter Notebook or Python script
    jupyter notebook ArielYosuaHasibuan_FP_ML2425_source_code.ipynb

  5. Output models will be saved as .h5 (MobileNetV2 and DenseNet121)

📄 Files Included

  • *_manual_book.pdf → Detailed code explanation
  • *_source_code.ipynb → Main training workflow
  • *_paper.pdf → Formal report of the final project

👨‍💻 Author

This project was created by Ariel Yosua Hasibuan for the ML2425 - Final Project
Program Studi Ilmu Komputer, Universitas Pertamina
If you find this useful or want to contribute, feel free to fork or raise an issue.


⭐️ Don't forget to star the repository if you like it!

About

Waste image classification using CNN (MobileNetV2 & DenseNet121) on the TrashNet dataset with augmentation and class weighting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published