{"id":20263,"name":"RecycleNet","description":"Effective trash classification model using only a small number of annotated images.","url":"https://github.com/sangminwoo/RecycleNet","last_synced_at":"2026-05-25T16:00:46.885Z","repository":{"id":115582870,"uuid":"154774360","full_name":"sangminwoo/RecycleNet","owner":"sangminwoo","description":"Attentional Learning of Trash Classification","archived":false,"fork":false,"pushed_at":"2021-01-04T16:15:02.000Z","size":375452,"stargazers_count":42,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-05-16T12:04:41.280Z","etag":null,"topics":["attention","recyclenet","trash-classification","trashnet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sangminwoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-26T03:51:23.000Z","updated_at":"2025-10-13T07:35:04.000Z","dependencies_parsed_at":"2023-04-17T06:02:27.448Z","dependency_job_id":null,"html_url":"https://github.com/sangminwoo/RecycleNet","commit_stats":{"total_commits":53,"total_committers":2,"mean_commits":26.5,"dds":"0.24528301886792447","last_synced_commit":"62b27e23a54d921382c6f0ef3a4e0cbe89fca060"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sangminwoo/RecycleNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sangminwoo","download_url":"https://codeload.github.com/sangminwoo/RecycleNet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33400284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"sangminwoo","name":"Sangmin Woo","uuid":"33993419","kind":"user","description":"","email":"","website":"https://sangminwoo.github.io/","location":"Daejeon, Korea","twitter":null,"company":"KAIST","icon_url":"https://avatars.githubusercontent.com/u/33993419?u=d015b5b82369e9841dc29a930fdcbfbeff496081\u0026v=4","repositories_count":72,"last_synced_at":"2024-06-11T15:47:12.268Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/sangminwoo","funding_links":[],"total_stars":580,"followers":35,"following":17,"created_at":"2022-11-16T04:15:54.209Z","updated_at":"2024-06-11T15:47:14.181Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sangminwoo","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sangminwoo/repositories"},"packages":[],"commits":{"id":1254235,"full_name":"sangminwoo/RecycleNet","default_branch":"master","total_commits":53,"total_committers":2,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":26.5,"dds":0.24528301886792447,"past_year_total_commits":0,"past_year_total_committers":0,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":0.0,"past_year_dds":0.0,"last_synced_at":"2026-05-23T15:06:10.220Z","last_synced_commit":"62b27e23a54d921382c6f0ef3a4e0cbe89fca060","created_at":"2023-03-27T11:00:36.903Z","updated_at":"2026-05-23T15:05:58.717Z","committers":[{"name":"Woo Sangmin","email":"shmwoo9395@naver.com","login":null,"count":40},{"name":"Woo Sangmin","email":"shmwoo9395@gmail.com","login":"sangminwoo","count":13}],"past_year_committers":[],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-25T00:00:11.816Z","repositories_count":6241430,"commits_count":883275873,"contributors_count":34917808,"owners_count":1157376,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"sangminwoo/RecycleNet","html_url":"https://github.com/sangminwoo/RecycleNet","last_synced_at":"2026-05-04T06:01:18.384Z","status":"error","issues_count":1,"pull_requests_count":0,"avg_time_to_close_issue":null,"avg_time_to_close_pull_request":null,"issues_closed_count":0,"pull_requests_closed_count":0,"pull_request_authors_count":0,"issue_authors_count":1,"avg_comments_per_issue":2.0,"avg_comments_per_pull_request":null,"merged_pull_requests_count":0,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":0,"past_year_pull_requests_count":0,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":0,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0,"created_at":"2023-05-09T10:35:31.212Z","updated_at":"2026-05-04T06:01:18.410Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/sangminwoo%2FRecycleNet/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{"NONE":1},"pull_request_author_associations_count":{},"issue_authors":{"min-hieu":1},"pull_request_authors":{},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-14T00:00:12.120Z","repositories_count":14598745,"issues_count":34297912,"pull_requests_count":112289055,"authors_count":11261410,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{},"past_year_issue_authors":{},"past_year_pull_request_authors":{},"maintainers":[],"active_maintainers":[]},"events":{"total":{"ForkEvent":2,"WatchEvent":2},"last_year":{}},"keywords":["attention","recyclenet","trash-classification","trashnet"],"dependencies":[{"ecosystem":"pypi","filepath":"requirements.txt","sha":null,"kind":"manifest","created_at":"2023-04-17T06:02:27.008Z","updated_at":"2023-04-17T06:02:27.008Z","repository_link":"https://github.com/sangminwoo/RecycleNet/blob/master/requirements.txt","dependencies":[{"id":9049108074,"package_name":"opencv-python","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false},{"id":9049108075,"package_name":"matplotlib","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false},{"id":9049108076,"package_name":"numpy","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false},{"id":9049108077,"package_name":"scipy","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false},{"id":9049108078,"package_name":"albumentations","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false}]}],"score":4.454347296253507,"created_at":"2023-09-11T14:52:11.245Z","updated_at":"2026-05-25T16:00:46.891Z","avatar_url":"https://github.com/sangminwoo.png","language":"Python","category":"Industrial Ecology","sub_category":"Circular Economy and Waste","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"RecycleNet\n================================\nIn 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.\n\nUsing two methods for creating an ***effective trash classification model*** using only a small number of annotated trash images(2527).\n\n***1) Transfer learning: Using ImageNet pre-trained model***  \n***2) Effective feature learning with attention module***\n\nTo 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.\n\n-  Backbone Network: ResNet\n-  Attention Module: RecycleNet\n\nRequirements\n-----------\nInstall all the python dependencies using pip:\n```\n$ git clone https://github.com/sangminwoo/RecycleNet.git\n$ cd RecycleNet\n$ pip install -r requirements.txt\n```\n* PyTorch is not inside. Please go to [official website](https://pytorch.org/get-started/locally/).\n\nData Preparation(TrashNet[1]: https://github.com/garythung/trashnet)\n--------------------------------------------------------------------\n* Total: 2527 (contains 6 classes)\n  -  Glass 501\n  -  Paper 594\n  -  Cardboard 403\n  -  Plastic 482\n  -  Metal 410\n  -  Non-recyclable Trash 137\n\n* Train/Val/Test set: 70/13/17\n* Data Augmentation\n\n* :warning: You may use *additional_dataset.zip* as another version of dataset. But if you use both of them on training phase, it will increase intra-class variance thus will leads to decrease of accuracy. Maybe you can try to use it for just testing true-generalizability on totally different dataset.(In terms of real world problem, trashes have high intra-class variance so it's very important!)\n\nData Augmentation(Albumentations[4])\n------------------------------------\n```\n$ python augmentation.py --root_dir $ROOT --save_dir $SAVE --probability $PROB\n```\n**$ROOT**: 'dataset-resized/' (default)  \n**$SAVE**: 'augmented/' (default)  \n**$PROB**: low(default), mid, high (probability of applying the transform)  \n\nTraining\n---------\nWithout pre-train(Training from scratch)\n```\n$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE --no_pretrain\n```\n\nWithout Attention Module\n```\n$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE\n```\n\nWith Attention Module\n```\n$ python main.py --gpu $GPUNUM --arch $ARCHITECTURE --use_att --att_mode $ATT\n```\n**$GPUNUM**: 0; 0,1; 0,3; 0,1,2; whatever  \n**$ARCHITECTURE**: resnet18_base(default), resnet34_base, resnet52_base, resnet101_base, resnet152_base  \n**$ATT**: ours(default), cbam, se  \n\nYou can find more configurations in *main.py*.\n\nEvaluation\n----------\n```\n$ python main.py --gpu $GPUNUM --resume save/model_best.pth.tar --use_att -e\n```\n**$resume**: save/model_best.pth.tar(default) (If you have changed save path, you should change resume path as well.)  \n**$e** (or evaluate): set evaluation mode\n\nWebcam Inference\n----------------\n```\n$ python webcam.py --resume save/model_best_pth.tar\n```\n\nConfiguration\n-------------\n* Loss Function: Cross Entropy Loss\n* Optimizer: SGD\n* Initial Learning Rate: 2e-4\n* epochs: 100\n* For every 40 epochs, learning rate = learning rate * 1/10\n\nAttention Module\n----------------\n![Alt text](/images/Attention.jpg)\n\n* Attention Module\n  - **Attention mechanism** learns parameters with a high weight for important features and a low weight for unnecessary features.  \n  𝒙′′ = (𝒙,𝜽) ∗ 𝑨(𝒙′, ∅), 𝒘𝒉𝒆𝒓𝒆 𝟎 ≤ 𝑨(𝒙′, ∅) ≤ 𝟏.  \n  𝒙: Input Feature, 𝒙′: CNN or later features, 𝒙′′: Output Feature,  \n  θ, ∅: learable parameters, A: Attention operation\n  \n  - When looking at the network from a **forward perspective**, the features are refined through attention modules.  \n  (𝒅(𝒙, 𝜽)𝑨(𝒙′, ∅))/𝒅𝜽 = (𝒅(𝒙, 𝜽))/𝒅𝜽 ∗ 𝑨(𝒙′, ∅), 𝒘𝒉𝒆𝒓𝒆 𝟎 ≤ 𝑨(𝒙′, ∅) ≤ 𝟏.  \n  - From a **backward perspective**, the greater the attention value, the greater the gradient value, so effective learning is achieved.\n\n![Alt text](/images/Attention%20Visualization.jpg)\n\n* Attention Visualization\n  - **Visualization comparison** of feature map extracted after the last convolution block.\n  - **ResNet18 + Ours** vs. ResNet18(baseline)\n  - While **ResNet18 + Ours** successfully classified, ResNet18 failed classification.\n  - Feature map shows that when Attention module is inserted, it attend more precisely on the **object extent**.\n\nAblation Study\n--------------\n* Non Pre-trained Model vs. Pre-trained Model (Transfer Learning)\n\n|        Method        | Accuracy@1  | Parameters(M) |\n|----------------------|-------------|---------------|\n|       ResNet18       |   70.302    |      11.18    |\n|       ResNet34       |   64.965    |      21.29    |\n|       ResNet50       |   58.701    |      23.52    |\n| Pre-trained ResNet18 |   **90.023**    |      11.18    |\n| Pre-trained ResNet34 |   **93.271**    |      21.29    |\n| Pre-trained ResNet50 |   **93.735**    |      23.52    |\n\n\n* Attention Module(SENet vs. CBAM vs. Ours)\n\n|        Method        | Accuracy@1  | Parameters(M) |\n|----------------------|-------------|---------------|\n|  ResNet18 + SE[2]    |   87.703    |      11.27    |\n|  ResNet34 + SE[2]    |   88.863    |      21.45    |\n|  ResNet50 + SE[2]    |   91.879    |      26.05    |\n|  ResNet18 + CBAM[3]  |   79.814    |      11.27    |\n|  ResNet34 + CBAM[3]  |   81.439    |      21.45    |\n|  ResNet50 + CBAM[3]  |   82.135    |      26.05    |\n|  ResNet18 + Ours     |   **93.039**    |      11.24    |\n|  ResNet34 + Ours     |   **93.968**    |      21.35    |\n|  ResNet50 + Ours     |   **94.2**      |      24.15    |\n\n\n* Channel Attention \u0026 Spatial Attention\n\n|  Network ablation  | Accuracy@1  | Parameters(M) |\n|--------------------|-------------|---------------|\n|      ResNet18      |    90.023   |     11.18     |\n|    ResNet18 + s    |    92.807   |     11.20     |\n|  ResNet18 + s + c  |    **93.039**   |     11.24     |\n\n| Combination ablation | Accuracy@1  | Parameters(M) |\n|----------------------|-------------|---------------|\n|          Mul         |    91.647   |     11.24     |\n|          Max         |    92.575   |     11.24     |\n|          Sum         |    **93.039**   |     11.24     |\n\nConclusion\n----------\nWhile proposing deep-learning model which is specialized in trash classification, there was two difficult problems faced experimentally:\n\n*1) Insufficiency of data set*  \n*2) The absence of effective feature learning methods*  \nwas solved by **transfer learning and attention mechanism.**\n\nThe 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.\n\nReference\n----------\n| # | Reference      |                    Link                      |\n|---|----------------|----------------------------------------------|\n| 1 | TrashNet       | https://github.com/garythung/trashnet        |\n| 2 | SENet          | https://github.com/hujie-frank/SENet         |\n| 3 | CBAM           | https://github.com/Jongchan/attention-module |\n| 4 | Albumentations | https://github.com/albu/albumentations       |\n\nAcknowledgement\n---------------\nWe appreciate much the dataset [TrashNet](https://github.com/garythung/trashnet) and the well organized code [CBAM](https://github.com/Jongchan/attention-module). Our codebase is mostly built based on them.\n","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/20263","html_url":"https://ost.ecosyste.ms/projects/20263"}