Downloads · 30 days
0
kendrickfff/my_resnet50_garbage_classificationv1.2
my_resnet50_garbage_classificationv1.2 is a image classification model from kendrickfff. Use it when you need a label for an image. The card lists the license as mit.
This model is a garbage classification system built on the ResNet50 architecture, fine-tuned for classifying household garbage into 12 distinct categories: paper, cardboard, biological, metal, plastic, green-glass, br…
Downloads · 30 days
0
Access
Public
Updated Oct 7, 2024
Repo size
94.5 MB
Likes
0
Public
Click a slice to open those files.
.pth94.5 MB · 100%
From the Hugging Face model README
This model is a garbage classification system built on the ResNet50 architecture, fine-tuned for classifying household garbage into 12 distinct categories: paper, cardboard, biological, metal, plastic, green-glass, brown-glass, white-glass, clothes, shoes, batteries, and trash. The model was trained on a dataset sourced from the Kaggle Garbage Classification Dataset by Mostafa Abla. The purpose of this model is to assist in sorting household waste for better recycling efficiency.
Base Model: ResNet50 (pre-trained on ImageNet).
Modifications: The final fully connected layer was modified to output 12 classes instead of the default 1000 classes used in ImageNet.
This model is intended for environmental conservation efforts through waste sorting and recycling. It can be implemented in waste management systems, where a camera captures images of garbage and sorts them into appropriate categories for recycling.
While this model can help with waste sorting, there are some important considerations to keep in mind:
Optimizer: Adam optimizer with learning rate of 0.001 Loss Function: CrossEntropyLoss Scheduler: StepLR, decreasing the learning rate every 7 epochs by a factor of 0.1 Batch Size: 32 Number of Epochs: 20 Transformations: Training: RandomResizedCrop, RandomRotation, HorizontalFlip, ColorJitter, Normalization. Validation: Resize, CenterCrop, Normalization. The training was conducted on a single GPU to speed up computation.
The model was trained using the Kaggle Garbage Classification Dataset https://www.kaggle.com/datasets/mostafaabla/garbage-classification/data. The dataset contains 15,150 images of household garbage spread across 12 classes. The images were split into training and validation sets to evaluate the model performance.
The model's performance was evaluated on the validation set. Below are the key metrics:
Epoch 1/20 train Loss: 0.9568 Acc: 0.7011 valid Loss: 0.4934 Acc: 0.8481 Epoch 1 completed in 3542.73 seconds.
Epoch 2/20 train Loss: 0.6937 Acc: 0.7774 valid Loss: 0.3939 Acc: 0.8734 Epoch 2 completed in 3822.20 seconds.
Epoch 3/20 train Loss: 0.5917 Acc: 0.8094 valid Loss: 0.4377 Acc: 0.8663 Epoch 3 completed in 3805.78 seconds.
Epoch 4/20 train Loss: 0.5718 Acc: 0.8146 valid Loss: 0.3412 Acc: 0.8915 Epoch 4 completed in 3815.20 seconds.
Epoch 5/20 train Loss: 0.5109 Acc: 0.8331 valid Loss: 0.2614 Acc: 0.9172 Epoch 5 completed in 3812.79 seconds.
Epoch 6/20 train Loss: 0.4824 Acc: 0.8452 valid Loss: 0.2966 Acc: 0.9011 Epoch 6 completed in 3809.74 seconds.
Epoch 7/20 train Loss: 0.4697 Acc: 0.8447 valid Loss: 0.2439 Acc: 0.9221 Epoch 7 completed in 3819.44 seconds.
Epoch 8/20 train Loss: 0.3318 Acc: 0.8899 valid Loss: 0.1065 Acc: 0.9649 Epoch 8 completed in 3809.94 seconds.
Epoch 9/20 train Loss: 0.2785 Acc: 0.9068 valid Loss: 0.0926 Acc: 0.9714 Epoch 9 completed in 3821.37 seconds.
Epoch 10/20 train Loss: 0.2680 Acc: 0.9114 valid Loss: 0.0797 Acc: 0.9759 Epoch 10 completed in 3599.23 seconds.
Epoch 11/20 train Loss: 0.2371 Acc: 0.9216 valid Loss: 0.0738 Acc: 0.9762 Epoch 11 completed in 3578.04 seconds.
Epoch 12/20 train Loss: 0.2333 Acc: 0.9203 valid Loss: 0.0639 Acc: 0.9791 Epoch 12 completed in 3690.18 seconds.
Epoch 13/20 train Loss: 0.2198 Acc: 0.9254 valid Loss: 0.0555 Acc: 0.9827 Epoch 13 completed in 3107.97 seconds.
Epoch 14/20 train Loss: 0.2060 Acc: 0.9306 valid Loss: 0.0560 Acc: 0.9812 Epoch 14 completed in 3689.20 seconds.
Epoch 15/20 train Loss: 0.1962 Acc: 0.9352 valid Loss: 0.0490 Acc: 0.9843 Epoch 15 completed in 3664.71 seconds.
Epoch 16/20 train Loss: 0.1951 Acc: 0.9346 valid Loss: 0.0479 Acc: 0.9850 Epoch 16 completed in 3761.18 seconds.
Epoch 17/20 train Loss: 0.1880 Acc: 0.9368 valid Loss: 0.0455 Acc: 0.9852 Epoch 17 completed in 3822.19 seconds.
Epoch 18/20 train Loss: 0.1912 Acc: 0.9353 valid Loss: 0.0454 Acc: 0.9854 Epoch 18 completed in 3830.77 seconds.
Epoch 19/20 train Loss: 0.1811 Acc: 0.9396 valid Loss: 0.0438 Acc: 0.9854 Epoch 19 completed in 3745.39 seconds.
Epoch 20/20 train Loss: 0.1810 Acc: 0.9409 valid Loss: 0.0427 Acc: 0.9866 Epoch 20 completed in 3818.20 seconds. Training complete in 1239m 26s Best val Acc: 0.9866
Test Loss: 0.0427, Test Acc: 0.9866 Precision: 0.9866, Recall: 0.9866, F1 Score: 0.9866
The model showed high accuracy in predicting common categories such as plastic, paper, and metal, but bit struggled with classes like shoes and clothes, reflecting the challenges of web-scraped images for such categories.
This ResNet50-based garbage classification model shows promising performance for sorting household waste into multiple categories. It can be used in waste management systems to automate and optimize the recycling process. Future work includes improving data quality by collecting real-world garbage images, fine-tuning the model, and addressing potential biases.
Further details and the code for this model can be found in the experiment tracking system.