{"id":20264,"name":"trashnet","description":"Dataset of images of trash. Torch-based CNN for garbage image classification.","url":"https://github.com/garythung/trashnet","last_synced_at":"2026-04-27T00:01:23.125Z","repository":{"id":41866984,"uuid":"87667522","full_name":"garythung/trashnet","owner":"garythung","description":"Dataset of images of trash; Torch-based CNN for garbage image classification","archived":false,"fork":false,"pushed_at":"2023-06-02T03:39:01.000Z","size":41622,"stargazers_count":695,"open_issues_count":8,"forks_count":204,"subscribers_count":27,"default_branch":"master","last_synced_at":"2026-04-04T13:01:43.097Z","etag":null,"topics":["convolutional-neural-networks","dataset","deep-learning","garbage","image-classification","torch","trash"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/garythung.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":"2017-04-08T22:16:08.000Z","updated_at":"2026-03-30T14:37:00.000Z","dependencies_parsed_at":"2023-09-21T19:57:47.603Z","dependency_job_id":null,"html_url":"https://github.com/garythung/trashnet","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"6fa2b878c6c1b4304b91109070ce0edf9279bb31"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/garythung/trashnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garythung","download_url":"https://codeload.github.com/garythung/trashnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31853276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"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":"garythung","name":"Gary Thung","uuid":"7055455","kind":"user","description":"","email":"","website":null,"location":"New York City","twitter":"garythung","company":null,"icon_url":"https://avatars.githubusercontent.com/u/7055455?u=e02dd0459e996e81e30bddc43a53a9ebb23e953d\u0026v=4","repositories_count":4,"last_synced_at":"2023-03-25T02:18:24.444Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/garythung","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2023-03-25T02:18:24.488Z","updated_at":"2023-03-25T02:18:24.488Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garythung","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garythung/repositories"},"packages":[],"commits":{"id":1254236,"full_name":"garythung/trashnet","default_branch":"master","total_commits":8,"total_committers":1,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":8.0,"dds":0.0,"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-04-02T12:01:34.413Z","last_synced_commit":"6fa2b878c6c1b4304b91109070ce0edf9279bb31","created_at":"2023-03-27T11:00:40.008Z","updated_at":"2026-04-02T12:01:34.392Z","committers":[{"name":"Gary Thung","email":"garythung","login":"garythung","count":8}],"past_year_committers":[],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-04T00:00:07.631Z","repositories_count":6211886,"commits_count":927467835,"contributors_count":35800990,"owners_count":1145528,"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":"garythung/trashnet","html_url":"https://github.com/garythung/trashnet","last_synced_at":"2025-09-03T07:34:02.327Z","status":"active","issues_count":6,"pull_requests_count":3,"avg_time_to_close_issue":63310664.0,"avg_time_to_close_pull_request":null,"issues_closed_count":1,"pull_requests_closed_count":0,"pull_request_authors_count":3,"issue_authors_count":6,"avg_comments_per_issue":3.1666666666666665,"avg_comments_per_pull_request":0.3333333333333333,"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:37:53.831Z","updated_at":"2025-09-03T07:34:02.327Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/garythung%2Ftrashnet/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{"NONE":6},"pull_request_author_associations_count":{"NONE":3},"issue_authors":{"nhammad":1,"iamshuvra":1,"luclt12706":1,"AnirudhDagar":1,"bemoregt":1,"geom16011":1},"pull_request_authors":{"OctavDM":1,"altanai":1,"Sam8239":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-03-13T00:00:08.721Z","repositories_count":13689400,"issues_count":34658244,"pull_requests_count":113057692,"authors_count":11198532,"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":30,"WatchEvent":101,"IssueCommentEvent":1},"last_year":{"ForkEvent":17,"WatchEvent":49,"IssueCommentEvent":1}},"keywords":["convolutional-neural-networks","dataset","deep-learning","garbage","image-classification","torch","trash"],"dependencies":[],"score":6.555356891810665,"created_at":"2023-09-11T14:52:11.249Z","updated_at":"2026-04-27T00:01:23.127Z","avatar_url":"https://github.com/garythung.png","language":"Lua","category":"Industrial Ecology","sub_category":"Circular Economy and Waste","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"# trashnet\nCode (only for the convolutional neural network) and dataset for mine and [Mindy Yang](http://github.com/yangmindy4)'s final project for [Stanford's CS 229: Machine Learning class](http://cs229.stanford.edu). Our paper can be found [here](https://cs229.stanford.edu/proj2016/report/ThungYang-ClassificationOfTrashForRecyclabilityStatus-report.pdf). The convolutional neural network results on the poster are dated since we continued working after the end of the quarter and  were able to achieve around 75% test accuracy (with 70/13/17 train/val/test split) after changing the weight initialization to the Kaiming method.\n\n## Dataset\nThis repository contains the dataset that we collected. The dataset spans six classes: glass, paper, cardboard, plastic, metal, and trash. Currently, the dataset consists of 2527 images:\n- 501 glass\n- 594 paper\n- 403 cardboard\n- 482 plastic\n- 410 metal\n- 137 trash\n\nThe pictures were taken by placing the object on a white posterboard and using sunlight and/or room lighting. The pictures have been resized down to 512 x 384, which can be changed in `data/constants.py` (resizing them involves going through step 1 in usage). The devices used were Apple iPhone 7 Plus, Apple iPhone 5S, and Apple iPhone SE.\n\nThe size of the original dataset, ~3.5GB, exceeds the git-lfs maximum size so it has been uploaded to Google Drive. If you are planning on using the Python code to preprocess the original dataset, then download `dataset-original.zip` from the link below and place the unzipped folder inside of the `data` folder.\n\n**If you are using the dataset, please give a citation of this repository. The dataset can be downloaded [here](https://huggingface.co/datasets/garythung/trashnet).**\n\n## Installation\n### Lua setup\nWe wrote code in [Lua](http://lua.org) using [Torch](http://torch.ch); you can find installation instructions\n[here](http://torch.ch/docs/getting-started.html). You'll need the following Lua packages:\n\n- [torch/torch7](http://github.com/torch/torch7)\n- [torch/nn](http://github.com/torch/nn)\n- [torch/optim](http://github.com/torch/optim)\n- [torch/image](http://github.com/torch/image)\n- [torch/gnuplot](http://github.com/torch/gnuplot)\n\nAfter installing Torch, you can install these packages by running the following:\n\n```bash\n# Install using Luarocks\nluarocks install torch\nluarocks install nn\nluarocks install optim\nluarocks install image\nluarocks install gnuplot\n```\n\nWe also need [@e-lab](http://github.com/e-lab)'s [weight-init module](http://github.com/e-lab/torch-toolbox/blob/master/Weight-init/weight-init.lua), which is already included in this repository.\n\n### CUDA support\nBecause training takes awhile, you will want to use a GPU to get results in a reasonable amount of time. We used CUDA with a GTX 650 Ti with CUDA. To enable GPU acceleration with CUDA, you'll first need to install CUDA 6.5 or higher. Find CUDA installations [here](http://developer.nvidia.com/cuda-downloads).\n\nThen you need to install following Lua packages for CUDA:\n- [torch/cutorch](http://github.com/torch/cutorch)\n- [torch/cunn](http://github.com/torch/cunn)\n\nYou can install these packages by running the following:\n\n```bash\nluarocks install cutorch\nluarocks install cunn\n```\n\n### Python setup\nPython is currently used for some image preprocessing tasks. The Python dependencies are:\n- [NumPy](http://numpy.org)\n- [SciPy](http://scipy.org)\n\nYou can install these packages by running the following:\n\n```bash\n# Install using pip\npip install numpy scipy\n```\n\n## Usage\n\n### Step 1: Prepare the data\nUnzip `data/dataset-resized.zip`.\n\nIf adding more data, then the new files must be enumerated properly and put into the appropriate folder in `data/dataset-original` and then preprocessed. Preprocessing the data involves deleting the `data/dataset-resized` folder and then calling `python resize.py` from `trashnet/data`. This will take around half an hour.\n\n### Step 2: Train the model\nTODO\n\n### Step 3: Test the model\nTODO\n\n### Step 4: View the results\nTODO\n\n## Contributing\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -m 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request\n\n## Acknowledgments\n- Thanks to the Stanford CS 229 autumn 2016-2017 teaching staff for a great class!\n- [@e-lab](http://github.com/e-lab) for their [weight-init Torch module](http://github.com/e-lab/torch-toolbox/blob/master/Weight-init/weight-init.lua)\n\n## TODOs\n- finish the Usage portion of the README\n- add specific results (and parameters used) that were achieved after the CS 229 project deadline\n- add saving of confusion matrix data and creation of graphic to `plot.lua`\n- rewrite the data preprocessing to only reprocess new images if the dimensions have not changed\n","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/20264","html_url":"https://ost.ecosyste.ms/projects/20264"}