fastai
classification
waste
resnet
mikaelapisani6 commited on
Commit
b67ede0
·
1 Parent(s): 0330013

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +165 -1
README.md CHANGED
@@ -7,4 +7,168 @@ tags:
7
  - waste
8
  - fastai
9
  - resnet
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  - waste
8
  - fastai
9
  - resnet
10
+ ---
11
+
12
+ ---
13
+
14
+ ### Model Description
15
+ A machine learning model for waste classification
16
+
17
+ - **Developed by:** rootstrap
18
+ - **Model type:** classifier
19
+ - **License:** ?
20
+
21
+ ## Waste Classifier Model
22
+ The aim is to build a model for waste classification that identifies among the different classes:
23
+
24
+ - cardboard
25
+ - compost
26
+ - glass
27
+ - metal
28
+ - paper
29
+ - plastic
30
+ - trash
31
+
32
+ This machine learning model will help people to improve their decision when classifying trash
33
+
34
+
35
+ **Fastai** is a deep learning library which provides high-level components that can quickly and easily provide state-of-the-art results in standard deep learning domains.
36
+
37
+ It has two main design goals:
38
+
39
+ To be approachable and rapidly productive
40
+ To be also configurable.
41
+
42
+ ### Model Sources
43
+
44
+ - **Repository:** [https://github.com/rootstrap/fastai-waste-classifier](https://github.com/rootstrap/fastai-waste-classifier)
45
+ - **Demo [optional]:** [TODO]()
46
+
47
+ ## Uses
48
+
49
+ At Rootstrap we classify waste. We found that people were straggled to classify correctly,
50
+ and then we end up not recycling most of the generated waste at the office, since if there were items in the wrong basket,
51
+ all the basket should not be classified.
52
+ Because of this reason, we created an app to help people at our company to classify waste.
53
+
54
+ ### Direct Use
55
+
56
+ ```bash
57
+ model = load_learner(f'result-resnet34.pkl')
58
+ model.predict()
59
+ ```
60
+
61
+ ## Bias, Risks, and Limitations
62
+
63
+ Take into account that the model has been trained mostly with images that have white background, and also that contains only one object. So,
64
+ you won't be able to classify several objects at the same time, or pictures that have one object above another.
65
+ This does not aim to replace humans to classify trash, at least for now, instead it is a tool to help them to better classify.
66
+
67
+ ## How to Get Started with the Model
68
+
69
+ You can use the following Google
70
+
71
+ ## Training Details
72
+
73
+ ### Training Data
74
+ The data is already splitted in train and test folders. Inside each folder contains one folder for each class. Those images were obtained using Bing searcher using the api HTTP.
75
+ You can find the code used to download the images at [this](https://colab.research.google.com/drive/1JvAYFx1DIEi1MMyI-tuCfE2eHMSKisKT?usp=sharing) Google Colab.
76
+ You can find the final dataset splitted into train and test [rootstrap-org/waste-classifier](https://huggingface.co/datasets/rootstrap-org/waste-classifier) in a Google Drive folder.
77
+
78
+ Split into train/test
79
+ You can find the code for the classifier [resnet-model.ipynb](resnet-model.ipynb)
80
+ To load the model in the file [result-resnet34.pkl](result-resnet34.pkl)
81
+
82
+ The model has been trained to classify waste into 6 classes.
83
+ This repository contains the dataset that we collected.
84
+ Currently, the dataset consists of 2527 images:
85
+ - 501 glass
86
+ - 594 paper
87
+ - 403 cardboard
88
+ - 482 plastic
89
+ - 410 metal
90
+ - 137 trash
91
+
92
+ The dataset was built joining images search on the internet using Bing plus some images taken manually, in addition to images from [Trashnet dataset](https://github.com/garythung/trashnet)
93
+ If you are using the dataset, please give a citation of this repository. The dataset can be downloaded at [rootstrap-org/waste-classifier](rootstrap-org/waste-classifier).
94
+
95
+ ### Training Procedure
96
+ You can find the code for training at [resnet-model.ipynb](https://github.com/rootstrap/fastai-waste-classifier/blob/main/resnet-model.ipynb)
97
+ Training the model using resnet50: ResNet34 is a convolutional neural network(CNN) that has 34 layers. It has been already trained with images from the ImageNet database. It classifies 1000 object from very broad categories, such as pencil or animals. The input size of the network is 224x224.
98
+
99
+ ## Evaluation and Results
100
+ The model reaches an accuracy of 0.98, here we can see the confusion matrix:
101
+ ![confusion_matrix](https://github.com/rootstrap/fastai-waste-classifier/blob/main/classification_matrix_resnet34.png)
102
+
103
+
104
+ #### Summary
105
+
106
+ {{ results_summary | default("", true) }}
107
+
108
+ ## Model Examination [optional]
109
+
110
+ <!-- Relevant interpretability work for the model goes here -->
111
+
112
+ {{ model_examination | default("[More Information Needed]", true)}}
113
+
114
+ ## Environmental Impact
115
+
116
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
117
+
118
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
119
+
120
+ - **Hardware Type:** {{ hardware | default("[More Information Needed]", true)}}
121
+ - **Hours used:** {{ hours_used | default("[More Information Needed]", true)}}
122
+ - **Cloud Provider:** {{ cloud_provider | default("[More Information Needed]", true)}}
123
+ - **Compute Region:** {{ cloud_region | default("[More Information Needed]", true)}}
124
+ - **Carbon Emitted:** {{ co2_emitted | default("[More Information Needed]", true)}}
125
+
126
+ ## Technical Specifications [optional]
127
+
128
+ ### Model Architecture and Objective
129
+
130
+ {{ model_specs | default("[More Information Needed]", true)}}
131
+
132
+ ### Compute Infrastructure
133
+
134
+ {{ compute_infrastructure | default("[More Information Needed]", true)}}
135
+
136
+ #### Hardware
137
+
138
+ {{ hardware | default("[More Information Needed]", true)}}
139
+
140
+ #### Software
141
+
142
+ {{ software | default("[More Information Needed]", true)}}
143
+
144
+ ## Citation [optional]
145
+
146
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
147
+
148
+ **BibTeX:**
149
+
150
+ {{ citation_bibtex | default("[More Information Needed]", true)}}
151
+
152
+ **APA:**
153
+
154
+ {{ citation_apa | default("[More Information Needed]", true)}}
155
+
156
+ ## Glossary [optional]
157
+
158
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
159
+
160
+ {{ glossary | default("[More Information Needed]", true)}}
161
+
162
+ ## More Information [optional]
163
+
164
+ {{ more_information | default("[More Information Needed]", true)}}
165
+
166
+ ## Model Card Authors [optional]
167
+
168
+ {{ model_card_authors | default("[More Information Needed]", true)}}
169
+
170
+ ## Model Card Contact
171
+
172
+ {{ model_card_contact | default("[More Information Needed]", true)}}
173
+
174
+