đ Garbage Classification
This project focuses on garbage classification using an image classification model. It aims to separate different types of garbage, which is beneficial for material recycling, reducing waste disposal volume, and enhancing social civilization.
đ Quick Start
This README provides an overview of a garbage classification project, including background information, dataset details, model architecture, and future plans.
⨠Features
- Garbage Separation: Classify garbage into 6 categories: cardboard, glass, metal, paper, plastic, and trash.
- Image Classification Model: Based on the Vision Transformer (ViT) model, achieving 95% accuracy on the test set.
- Huggingface Integration: The model is available on Huggingface Space and has a corresponding model card.
đĻ Installation
The original README does not provide specific installation steps, so this section is skipped.
đģ Usage Examples
The original README does not provide code examples, so this section is skipped.
đ Documentation
Overview
Background
Garbage classification refers to the separation of several types of different categories in accordance with the environmental impact, the use value, the composition of garbage components, and the requirements of existing treatment methods.
The significance of garbage classification:
- Garbage classification reduces the mutual pollution between different garbage, which is beneficial to the recycling of materials.
- Garbage classification is conducive to reducing the final waste disposal volume.
- Garbage classification is conducive to enhancing the degree of social civilization.
Dataset
The garbage classification dataset is from Kaggle. There are totally 2467 pictures in this dataset. And this model is an image classification model for this dataset. There are 6 classes for this dataset, which are cardboard (393), glass (491), metal (400), paper(584), plastic (472), and trash(127).
Model
The model is based on the ViT model, which is short for the Vision Transformer. It was introduced in the paper An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale, which was introduced in June 2021 by a team of researchers at Google Brain. And first released in this repository. The model was trained with PyTorch.
There are 3 steps to tokenize the image:
- Split an image into a grid of sub - image patches
- Embed each patch with a linear projection
- Each embedded patch becomes a token, and the resulting sequence of embedded patches is the sequence you pass to the model.
The model was trained for 10 epochs, and Adam was used as the optimizer. The accuracy on the test set is 95%.
Huggingface Space
Huggingface space is here.
Huggingface Model Card
Huggingface model card is here.
Critical Analysis
- Next step: build a CNN model on this dataset and compare the accuracy and training time for these two models.
- Didn't use the Dataset package to store the image data. Want to find out how to use the Dataset package to handle image data.
Resource Links
Code Demo
[Code Demo](https://github.com/yuechen - yang/garbage-classification) is inside this repo.
Repo
In this repo.
Video Recording
The original README does not provide video recording details, so this section is skipped.
đ§ Technical Details
The model uses the Vision Transformer (ViT) architecture. The key difference in using a transformer for image training compared to text training lies in the tokenizing step. The image tokenizing process involves splitting the image into patches, embedding them, and creating a sequence of tokens for the model. The model was trained for 10 epochs with the Adam optimizer, achieving 95% accuracy on the test set.
đ License
The original README does not provide license information, so this section is skipped.