Skip to content

Bin-Detective/bindetective-ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Robin BinDetective Waste Classification Model

Robin is a model developed for waste classification, categorizing items into 10 distinct classes. The model has been fine-tuned using different architectures to find the best and optimal performance. Below, you’ll find links to specific branches for each model variant.


Available Models

Each model branch contains model information, documentation, training and validation details.

Variant Branch Model
EfficientNetV2S main-efficientnetv2s Kaggle
EfficientNetB0 efficientnetb0
ResNet50 mango-resnet50 Kaggle

Classes

  1. buah_sayuran (Fruits/Vegetables): Fruit/vegetable waste, peels, seeds
  2. daun (Leaves): Leaves, flowers, grass, garden waste
  3. elektronik (Electronics): Phones, pcb, cables, batteries, etc
  4. kaca (Glass): Glass bottles, broken glass
  5. kertas (Paper): Newspapers, cardboard, paper waste
  6. logam (Metal): Cans, forks, spoons
  7. makanan (Food): Food remnants, expired foods
  8. medis (Medical): Medical waste, masks, gloves, etc
  9. plastik (Plastic): Bottles, straw, plastic bags, etc
  10. tekstil (Textile): Clothes, fabric

Datasets

robin-base/
├── train/
│   ├── buah_sayuran/
│   ├── daun/
│   ├── elektronik/
│   └── ...
├── val/
│   ├── buah_sayuran/
│   ├── daun/
│   ├── elektronik/
│   └── ...
└── test/
    ├── buah_sayuran/
    ├── daun/
    ├── elektronik/
    └── ...

The dataset is balanced with a 1:1 ratio for each class and split into 70/20/10 for training, validation, and testing, consisting of 30,000 images in total.

Model Details

  • Base model: EfficientNetV2S (pretrained on ImageNet)
  • Frozen Layers: Initial layers up to block 143 (block4f_bn)
  • Custom layers: Global Average Pooling, Dropout (0.5), Dense (10 classes, softmax)
  • Input size: 224,224,3
  • Optimizer: Adam
  • Loss: Categorical Crossentropy
Total params: 20344170 (77.61 MB)
Trainable params: 18468850 (70.45 MB)
Non-trainable params: 1875320 (7.15 MB)

Performance

The current robin_efficientnetv2s test accuracy and performance metrics for each class are as follows:

              precision    recall  f1-score   support
buah_sayuran       0.95      0.91      0.93       301
        daun       0.98      0.98      0.98       301
  elektronik       0.99      0.98      0.99       301
        kaca       0.94      0.97      0.95       301
      kertas       0.96      0.96      0.96       301
       logam       0.94      0.97      0.95       301
     makanan       0.91      0.95      0.93       301
       medis       0.97      0.97      0.97       301
     plastik       0.95      0.89      0.92       301
     tekstil       0.99      0.99      0.99       301

    accuracy                           0.96      3010
   macro avg       0.96      0.96      0.96      3010
weighted avg       0.96      0.96      0.96      3010

Confusion matrix:

image

Requirements

  • TensorFlow 2.15
  • Python 3.x
  • Keras
  • NumPy

Workflow

Here’s a simple explanation of the workflow for the Robin model:

+-------------------+        +-----------------------------+        +-----------------------------+
| Collect Dataset   | -----> | Preprocess Dataset          | -----> | Model Development           |
| (30000+ images)   |        | - Resize images to 224x224  |        | - Select base architecture  |
+-------------------+        | - Normalize pixel values    |        | - Load pretrained weights   |
                             | - Balance each dataset      |        | - Freeze initial layers     |
                             |   class (1:1)               |        | - Add custom layers         |
                             | - Split into Train/Val/Test |        | - Compile with optimizer    |
                             |   (70/20/10 ratio)          |        |   and loss function         |
                             +-----------------------------+        +-----------------------------+
                                                                                    |
                                                                                    v
                             +-----------------------------+        +------------------------------+
                             | Model Evaluation            | <----- | Model Training               |
                             | - Test on 10% dataset       |        | - Train on 70% dataset       |
                             | - Generate performance      |        | - Validate on 20% dataset    |
                             |   metrics                   |        | - Fine-tune                  |
                             +-----------------------------+        | - Save best-performing model |
                                             |                      +------------------------------+
                                             v
                             +--------------------------------+
                             | Troubleshoot                   |
                             | - Adjust hyperparameters       |
                             | - Fine-tune and analyze        |
                             |   performance for improvements |
                             +--------------------------------+
                                             |
                                             v
                             +----------------------------------+
                             | Deploy the Model                 |
                             | - Save the model in TensorFlow   |
                             |   SavedModel format              |
                             | - Deploy the model using FastAPI |
                             |   for waste classification       |
                             +----------------------------------+

About

This repository provides the machine learning models for the Bin Detective app, designed to classify waste into 10 categories. It includes model details, training documentation, and dataset information to support waste classification tasks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors