Garbage Classification
Overview
Backgroud
Garbage classification refers to the separation of several types of different categories in accordance with the environmental impact of the use of the value of 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. I trained this model with PyTorch. I think the most different thing between using the transformer to train on an image and on a text is in the tokenizing step.
There are 3 steps to tokenize the image: 1. Split an image into a grid of sub-image patches 2. Embed each patch with a linear projection 3. Each embedded patch becomes a token, and the resulting sequence of embedded patches is the sequence you pass to the model.
I trained the model with 10 epochs, and I use Adam 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
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Code Demo
Code Demo is inside this repo
Repo
In this repo
Video Recording
- Downloads last month
- 412