Home

Awesome

RecycleNet

In the era of mass production and mass consumption, trash disposal has become an important national issue. With this trend, the social and economic importance of trash collection and reusing is increasing. An alternative is to allow the machine to classify automatically once the user discharge the trash regardless of the material.

Using two methods for creating an effective trash classification model using only a small number of annotated trash images(2527).

1) Transfer learning: Using ImageNet pre-trained model
2) Effective feature learning with attention module

To demonstrate that the proposed methodologies were effective, a large number of ablation studies were conducted and were more effective than state-of-the-art attention modules.

Requirements

Install all the python dependencies using pip:

$ git clone https://github.com/sangminwoo/RecycleNet.git
$ cd RecycleNet
$ pip install -r requirements.txt

Data Preparation(TrashNet[1]: https://github.com/garythung/trashnet)

Data Augmentation(Albumentations[4])

$ python augmentation.py --root_dir $ROOT --save_dir $SAVE --probability $PROB

$ROOT: 'dataset-resized/' (default)
$SAVE: 'augmented/' (default)
$PROB: low(default), mid, high (probability of applying the transform)

Training

Without pre-train(Training from scratch)

$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE --no_pretrain

Without Attention Module

$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE

With Attention Module

$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE --use_att --att_mode $ATT

$GPUNUM: 0; 0,1; 0,3; 0,1,2; whatever
$ARCHITECTURE: resnet18_base(default), resnet34_base, resnet52_base, resnet101_base, resnet152_base
$ATT: ours(default), cbam, se

You can find more configurations in main.py.

Evaluation

$ python main.py --gpu $GPUNUM --resume save/model_best.pth.tar --use_att -e

$resume: save/model_best.pth.tar(default) (If you have changed save path, you should change resume path as well.)
$e (or evaluate): set evaluation mode

Webcam Inference

$ python webcam.py --resume save/model_best_pth.tar

Configuration

Attention Module

Alt text

Alt text

Ablation Study

MethodAccuracy@1Parameters(M)
ResNet1870.30211.18
ResNet3464.96521.29
ResNet5058.70123.52
Pre-trained ResNet1890.02311.18
Pre-trained ResNet3493.27121.29
Pre-trained ResNet5093.73523.52
MethodAccuracy@1Parameters(M)
ResNet18 + SE[2]87.70311.27
ResNet34 + SE[2]88.86321.45
ResNet50 + SE[2]91.87926.05
ResNet18 + CBAM[3]79.81411.27
ResNet34 + CBAM[3]81.43921.45
ResNet50 + CBAM[3]82.13526.05
ResNet18 + Ours93.03911.24
ResNet34 + Ours93.96821.35
ResNet50 + Ours94.224.15
Network ablationAccuracy@1Parameters(M)
ResNet1890.02311.18
ResNet18 + s92.80711.20
ResNet18 + s + c93.03911.24
Combination ablationAccuracy@1Parameters(M)
Mul91.64711.24
Max92.57511.24
Sum93.03911.24

Conclusion

While proposing deep-learning model which is specialized in trash classification, there was two difficult problems faced experimentally:

1) Insufficiency of data set
2) The absence of effective feature learning methods
was solved by transfer learning and attention mechanism.

The methodology proposed through quantitative and qualitative assessments was experimentally significant. Because the proposed method exhibits significant performance improvements without significantly increasing the number of parameters, it is expected that the experimental value is also high for other applications.

Reference

#ReferenceLink
1TrashNethttps://github.com/garythung/trashnet
2SENethttps://github.com/hujie-frank/SENet
3CBAMhttps://github.com/Jongchan/attention-module
4Albumentationshttps://github.com/albu/albumentations

Acknowledgement

We appreciate much the dataset TrashNet and the well organized code CBAM. Our codebase is mostly built based on them.