automated recycling system using computer vision...research was initially conducted in 1959 to...

32
Automated Recycling System Using Computer Vision Desi Tomaselli ECE-498: Capstone Design Project Advisor: Prof. Cotter November 25, 2019

Upload: others

Post on 02-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

Automated Recycling System

Using Computer Vision

Desi Tomaselli

ECE-498: Capstone Design Project

Advisor: Prof. Cotter

November 25, 2019

Page 2: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

Acknowledgements

Thanks to Professor Cotter for advising this project. I would not be where I am today

without your guidance and feedback.

i

Page 3: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

Contents

1 Introduction 1

2 Background 3

2.1 Classifications for Recycling . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3 Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3.1 Image Processing Methods . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3.2 Feature Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3.3 Classification Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.4 Processing and Computing Devices . . . . . . . . . . . . . . . . . . . . . . . 5

2.5 Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Design Requirements 7

3.1 Classifier System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.1.1 Classifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.1.2 Power Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1.3 Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1.4 Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1.5 Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2 Segregation System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2.1 Power Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2.2 Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2.3 Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2.4 Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Design Alternatives 11

ii

Page 4: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

4.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.1.1 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2.1 Feature Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2.2 Classification Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5 Design 16

5.1 Classifier System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.1.1 Raspberry Pi 3 Model B . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.1.2 TrashNet Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

5.1.3 Image Processing Methods . . . . . . . . . . . . . . . . . . . . . . . . 18

5.1.4 Feature Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

5.1.5 Classification Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.2 Segregation System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5.2.1 IR Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.2.2 Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.2.3 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6 Implementation Schedule 23

References 24

iii

Page 5: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

1 Introduction

Garbage is a global issue that all living species are affected by. It has become a consid-

erable issue the past decade due to garbage and pollution [30]. More specifically, humans

have been dumping plastics and other waste into oceans to create these massive garbage

patches in them. They are becoming so big that the “Great Pacific Garbage Patch (GPGP)

is a massive area of floating plastic debris that is more than twice the size of Texas” and “it

contains about 1.8 trillion pieces of plastic” [15]. This outstandingly dangerous number is

between “4 and 16 times the mass of plastic that scientists previously estimated” [15]. To

make the issue even worse, it is growing in size, exponentially [15].

However, this is not the only garbage patch that exists. This is “one of five ocean garbage

patches” that’s grown in size around the world “as people use more and more plastic, which

is not biodegradable and is used for everything from water bottles to shipping crates” [15].

This has become such a prominent issue that even researchers who were not initially going

to conduct a study on plastic pollution, ended up doing so because they were so alarmed

by the amount of plastic that got entangled on their devices for research on plankton. [29].

Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean.

Since then, devices and gear to measure the plankton has been tangled up with plastic almost

“669 times” and since then the occurrence has “skyrocketed in the past two decades” [29].

Scientists specifically say the occurrence “has increased by around ten times” [29].

With these staggering numbers and the ocean patches growing exponentially in size, it is

clear that action needs to occur to fix the issue. In fact, research shows that “plastics in the

ocean kill or harm more than 300,000 marine animals every year” [5]. And because of this,

it will become the “deadliest threat to [humanity]” if people do not rally together to fix it

since millions of people depend on the oceans [5]. Therefore, humanity needs to start fixing

1

Page 6: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

the issue and the first step to that is by preventing it from getting worse. One solution to

this is by having people recycle properly. Proper recycling takes time and effort from the

individual, but it is important for the environment as it helps reduce pollution caused by

waste and the need for raw materials [8]. But the issue with recycling is that it’s a manual

process and not many people think about it and when they do, they don’t do it correctly.

Therefore, this paper proposes a solution of an automated recycling system (ARS) using

computer vision to fix this global issue. This system will be able to identify and classify

objects using computer vision and separate the classified waste using sensors and containers.

This paper will discuss the design requirements for the system and the design alternatives

that were considered. Then it’ll go into more detail about the overall design of the system.

2

Page 7: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

2 Background

2.1 Classifications for Recycling

There are multiple classifications for recycling. They usually consist of metal, glass,

plastic, paper, cardboard, and organic waste. However, depending on the country, these

classifications may vary. For example, in Japan, they have one of the most complicated

recycling systems in the world. They have bins dedicated to plastic bottles, plastics, recycled

papers, cans, glass bottles, burnable garbage and non-burnable garbage. Whereas in the

United States, there are multiple variations of recycling containers, but the most common

ones are plastic bottles, paper and cardboard, metal cans, glass bottles, compost and other

waste. But because of this, it makes recycling inconsistent. Therefore to create a practical

system, it is important to determine classification standards of recycling so that anyone

around the world can use it. This topic will be discussed more in the design requirements

section (3.1.1).

2.2 Sensors

In the past, many of people have conducted experiments and studies on the topic of object

recognition systems to create waste segregation systems. The methodologies that were used

vary greatly since there is not one solution. These methods involve different kinds of sensors

to determine objects’ conductivity [11], weight and density characteristics [22]. Some people

even used light sensors to measure the colorization of objects by sending photons at them

and sensing the light spectrum of colors that were being reflected [22], while others used

cameras as sensors to determine the features and contours of objects and shapes in an image

[31], [35], [38]. In the design alternatives section (4) and the design section (5), I go into

more detail about what specifically people used and how they were able to use them.

3

Page 8: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

2.3 Computer Vision

For the people that used cameras as their sensors, they relied on images to give them

information about the objects that they were looking at. More specifically, they used com-

puter vision to help them identify objects within an image. Computer vision is a computer

science concept that enables a computer to identify objects autonomously. Many companies

like Tesla are utilizing this technique [19] to create self-driving cars since the car will need to

have the ability to identify people and objects while on the road. They used and considered

many concepts that I will be mentioning in my paper such as grayscale, threshold, SIFT,

and KNN to name a few that helps identify people and objects. These methodologies will

be discussed in more detail in the design section (5) since this is the route that I decided to

take.

2.3.1 Image Processing Methods

A subsection of computer vision involves some image processing techniques in order

to alter the image. Image processing is very important for extracting features within an

image as it makes it easier for computers to differentiate concrete objects from noise. Some

basic image processing methods include grayscale and thresholding. These are important

because they “remove unnecessary features from” images [35] and isolate the object “from

the background and eliminate noise” [30]. This will be discussed further in the design section

(5) of the paper since I will be using these methods to accomplish my goal.

2.3.2 Feature Extraction

As it was mentioned above, image processing techniques are very important for feature

extraction and like those techniques, there are many methods for feature extraction. In

computer vision, feature extraction is used to determine features within an image and to

4

Page 9: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

later be used to compare to similar features in other images. These methods are necessary in

the identification process of objects since the comparison of features will be a major reason

as to why one object in an image is classified as its classification. Some feature extraction

methods include SIFT and Hu moments that many people have previously explored [20],

[30], [31], [38]. These methodologies will be properly discussed in the design alternatives

section (4) and the design section (5).

2.3.3 Classification Methods

What comes after feature extraction is classification. There are multiple methods in

classifying objects. These classification methods are what combine and compare features to-

gether to classify objects. The methods that will be discussed will be the k-nearest neighbobr

(KNN) algorithm, the support vector machine (SVM) algorithm and convolutional neural

networks (CNN). People in the past have used these methods in their own systems to classify

objects [14], [27], [31], [35], [38], [13] and they were able to receive some promising results.

These methodologies will be discussed in more detail in the design (5) and design alternatives

(4) sections below.

2.4 Processing and Computing Devices

All of the methodologies (sensors and computer vision algorithms) that were discussed

above need a computational device that is capable of meeting their computational needs.

For instance, capacitive or light sensors [11] or even machine learning algorithms [30] in

conjunction with a microcontroller may be the only computational device necessary for the

system whereas a convolutional neural network (CNN) may require more computational

power [20], [9] involving a computer with a high clock speed for its central processing unit

(CPU) and a dedicated graphics processing unit (GPU) with several gigabytes of RAM.

However, that being said some like Popat [27], were able to use a Raspberry Pi for CNNs. It

5

Page 10: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

is also worth mentioning that some people choose CNNs over machine learning algorithms

for better accuracy [31], [20]. Therefore, due to simplicity and performance, I decided to use

a Raspberry Pi as the computational device that will be used for this system.

2.5 Datasets

Machine learning algorithms and CNNs both require datasets to train on. Therefore

choosing the right dataset for a specified project is very important as it will influence the

way these methods identify and classify objects or people. Some datasets were posted for

public use such as ImageNet [20], [31] and TrashNet [16], [38], [9] while others were privatized

[27]. But all datasets can be time consuming to create as it usually requires 100s of images

at a time per classification [38]. For CNNs it usually requires many more images since they

really benefit from training on bigger datasets.

6

Page 11: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

3 Design Requirements

3.1 Classifier System

3.1.1 Classifications

The classification system should be able to identify and classify objects that are metal,

plastic, glass and paper. These four categories were chosen for simplicity and performance

reasons [31]. In other papers such as Yang’s [38] and Aral’s [9], they used six different

classifications, glass, paper, metal, plastic, cardboard and trash since they both used the

same dataset, TrashNet [16]. However, it is important to know that they did not tackle the

problem of trying to separate their classified objects into six different containers. However,

the ones that did [35], [30], used minimal classifications. In Garcia’s paper [35], they only

had three types of inorganic waste to classify which was plastic bottles, plastic cutleries and

alumnium cans. In Salmador’s paper [30], they classified objects that were metal, glass,

plastic and paper. Since this was the case, I decided to choose the middle ground between

the previous projects that were created and determined to only classify objects that were

metal, plastic, glass and paper since those were the most common and it was not too many

classifications to try to separate into.

7

Page 12: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

3.1.2 Power Consumption

The power consumption of the device should be relatively low. One of the low power

consuming devices that exist is the Raspberry Pi 3 Model B. According to Raspberry Pi

Dramble [6], A Raspberry Pi 3 Model B should consume 260mA (1.4W) or less while idle

and under 400% CPU load, it should consume 730mA (3.7W). If a battery were to be

attached to this device, it would not be practical for it to contain only one AA battery [2] as

the machine would probably die after 9.2 hours while idle and 3.3 hours while under heavy

load [3]. It would also not be able to sustain for very long even with a laptop battery since

they tend to be 3x bigger [24]. Therefore, it is unlikely that the attachment of a battery will

occur, even though it would make the system more practical.

3.1.3 Speed

The system should be able to take pictures of an object from a camera every second at

minimum if it has to and those pictures should be sent to the trained model so that it can

classify the object into the 4 separate categories within 1 second. The ultimate reason for

these requirements is efficiency. It’s not practical if the system takes several minutes to take

pictures of objects and classify them. Therefore, it needs to be within this range of speed in

order stay efficient and practical. (ref)

3.1.4 Accuracy

The accuracy percentage of the system should be at least 80% or higher. In Silva’s paper

[31], they were able to achieve 88% with their KNN model so it is reasonable enough to

assume that 80% is not too high of a number to achieve. Also if it is below this percentage

then it will not be practical to use since it would be much easier to do manually.

8

Page 13: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

3.1.5 Cost

The overall system should relatively cheap. The cost should be less than $100 so that it’s

accessible to public facilities such as schools, libraries, hospitals, police stations, malls, etc....

With a more expensive system, it’d be difficult to manufacture and mass produce since it

could be very costly if they were to be bought in bulks. Fortunately, all that’s required

for the classification system is the Raspberry Pi 3 Model B and a 5MP compatible camera,

which costs at most $80 and $20 maximum respectively.

3.2 Segregation System

3.2.1 Power Consumption

The power consumption of the device should be relatively low so that it does not consume

excessive raw resources. A couple of motors should not draw an exceeding amount of power

in relation to the Raspberry Pi. However, like it was mentioned above, the likelihood of

attaching a battery to the system is unlikely since the system would only last a couple of

hours at most.

3.2.2 Speed

The speed of the segregation system should be as fast as the classification system is. If

the segregation system is slower than the classification system then it will be bottle-necking

the entire system, which is not desirable.

3.2.3 Accuracy

The accuracy of the segregation system should correspond to whatever the classification

system’s accuracy is since that system is the responsible for identifying objects. Therefore,

there should not be any inconsistency between the two systems. In other words, the segre-

9

Page 14: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

gation system should have an accuracy rate of 100% in relation to whatever declaration is

made about object by the classification system.

3.2.4 Cost

As it was mentioned above, the cost of the system should be relatively low to enable the

possibility of mass production so that many public facilities can buy them and use them.

The cost of the segregation system should be no more than $50 itself.

10

Page 15: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

4 Design Alternatives

4.1 Hardware

4.1.1 Sensors

When the project was initially being developed, the overarching question to be answered

was how to classify objects. There are two possible solutions to this problem. One was to

use sensing to identify and classify objects. These sensors could be capacitive, inductive,

infrared, proximity, light [22] and ultrasonic sensors. Depending on the sensor, it could

be determined what the object was made of based on the value that it returns [11]. For

example, an inductive sensor is great for detecting metals because it generates an oscillating

electromagnetic field and can detect the change in the field due to the metallic object. Or

a conductive sensor (Figure 1) measures the electric current between two electrodes, and it

sends a current through a given material. The more conductive the material is, the higher

conductivity values it produces [11]. Therefore, the values within certain ranges could be

used to determine whether an object is metallic or not.

Figure 1: Capacitive Sensor

However, despite knowing these facts about sensors, after doing intensive research, I

realized that recently more people used computer vision rather than sensors to achieve their

11

Page 16: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

classification and identification of objects [31], [27], [9], [20], [35], [14]. Therefore, since I

was more familiar with their research projects and I was taking a computer vision course, I

decided to choose computer vision over sensors as my methodology.

4.2 Software

As it was mentioned in the background section 2.3, people also use cameras as their

sensor and they rely on computer vision techniques to develop object recognition systems

to identify and classify objects. Below I will be mentioning the alternative computer vision

techniques that I explored, but did not end up pursuing for my system.

4.2.1 Feature Extraction

Hu Moments: One feature extraction method that was mentioned a few times in pa-

pers was Hu Moments [30], [35]. Generally, the way Hu Moments works is that it requires

a grayscaled image and it uses the concept of thresholding to separate the object from its

background [18]. It does this by taking the gray values of pixels within an image and it

determines the “moments” of an object by taking the integral of it [18]. Several ordered

moments can be calculated by taking multiple integrals of the object, which leads to spa-

tial, central, and central normalized moments. These moments can be compared to other

moments of other objects in images and that is how identification occurs using this method.

It can be read more about here [18].

I decided to not use Hu Moments because SIFT is the most efficient local descriptor

and it performs the best [23], [12]. “Moments... show the best performance among the low

dimensional descriptors,” [23] but “SIFT gives the best recognition rate” [12]. Therefore, I

decided to use SIFT over Hu Moments.

12

Page 17: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

4.2.2 Classification Methods

Support Vector Machine: One popular classification method that has been mentioned

a few times in papers [38], [30], [31] is the Support Vector Machine (SVM) algorithm. SVM

is a machine learning algorithm that’s used to identify and classify objects. It does this by

separating objects on hyperplanes for multi-dimensional data. Figure 2 depicts this concept.

A more detailed explaination can be found here [34], [12] and here [38].

Figure 2: Support Vector Machine (SVM) [34]

It was decided that it would be best to not use the SVM method for this project. Due

to Salmodor’s research project [30], he explains that classes can be “quite heterogenous”

meaning that they can overlap and a “partitioning algorithm like SVM is not a good option.”

SVM also scored a lower accuracy rate than KNN according to Silva [31]. Therefore, this

lead me to conclude that SVM is not the classification method that I want to use for this

type of project.

Convolutional Neural Networks Another popular method of classifying objects is by

using convolutional neural networks (CNN). This is often a popular choice because it is an

13

Page 18: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

effective and efficient way to give computer systems the ability to “learn” [31], [13]. They

learn upon given datasets and with every new iteration of data, it is able to identify what

something is or is not. These neural networks model the human brain (its neurons and

receptors) to replicate the process of learning in a human being. Figure 3 shows a depiction

of what a neural network looks like.

Figure 3: Fully Connected Neural Network [28]

These networks are a big portion of computer vision and help allow machines to identify

objects on their own. CNNs differ from regular neural networks because they have convo-

lutional layers in the network [28]. These convolutional layers are able to detect patterns

within an image. With each convolutional layer, there are a certain number of filters or

kernels that need to be specified and defined. While the first layer involves basic filters

to extract features and shapes, the deeper layers may be more specific and exist to detect

specific objects or regions in an image [28].

Filters, also known as kernels, are made of n by m matrices and they are initialized with

random numbers. When a filter is given an input, the filter slides across the input over an n

by m set of pixels until it has slid over every single pixel in an image. This is also known as

convolving (Figure 4). Therefore, in other words, the filter is convolving over each set of n

x m pixels of an image to determine its features. Eventually, after the image goes through

14

Page 19: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

every single layer, the object should be identified and classified. For more information and

details on CNNs, Prabhu [28] writes an article about them.

Figure 4: Convolving a Filter over an Image [28]

15

Page 20: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

5 Design

5.1 Classifier System

The overall design of the classifier system consists of using the k-nearest neighbor (KNN)

algorithm on a Raspberry Pi 3 Model B. I will apply the algorithm to a given dataset so that

it is capable of identifying and classifying objects in images that are taken from a camera

that is 5MP. The images from the camera will be fed into the model and it will return the

percentages of what the object could classify as: metal, glass, plastic or paper. The block

diagram can be seen in Figure 5.

Figure 5: Block Diagram for Classifier System

5.1.1 Raspberry Pi 3 Model B

One important decision that was made was deciding what device is capable of achieving

all the goals and objectives of this project while also meeting the design requirements. There

were two options: an Arduino and a Raspberry Pi. Based on research, I came to conclusion

16

Page 21: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

that the Raspberry Pi would be better suited for my project [27]. In the past, people used

the Pi more often for object detection because they argue that it has a better, more intuitive

interface when trying to program it. More specifically in Popat’s research paper [27], he

explained the Raspberry Pi as a “card-sized” computer that’s relatively inexpensive and

runs on an open-source Linux-based operating system. The Raspberry Pi also supports

Python code, making it easy to implement deep learning models built for Python. It is

also capable of running a convolutional neural network [27] in case the desired accuracy

percentages are not met. As explained in Aral’s research paper [9] and Silva’s research paper

[31], convolutional neural networks greatly improve the accuracy percentages. Therefore,

a Raspberry Pi 3 Model B satisfies all of the necessary design requirements and it has an

intuitive user interface, it is easy to program and it is powerful enough to run a CNN on it.

Figure 6 shows this applicable device.

Figure 6: Raspberry Pi 3 Model B

5.1.2 TrashNet Dataset

The dataset that was chosen for this project is called TrashNet, which was created and

provided by Gary Thung on Github [16]. He made this dataset for his own research purposes.

Thung and a research partner of his, Mindy Yang, [38] conducted an experiment to explore

17

Page 22: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

the possibility of classifying trash into different recycling categories through various machine

learning and computer vision algorithms. The dataset provides between 400-500 images for

multiple categories consisting of metal, glass, plastic, paper, cardboard and trash. However,

for this project, I will just be using the dataset to classify metal, glass, plastic and paper.

Therefore, this dataset fits all of my classification requirements and that is why I have decided

to use it.

5.1.3 Image Processing Methods

Grayscale: A common method that is used in computer vision is grayscale. Grayscaling

an image entails converting a colored image into shades of black and white. This occurs by

averaging all of the numbers represented in RGB for every pixel and returning it to every

corresponding pixel. This produces a gray pixeled image. A depiction of this concept can

be seen in Figure 7.

Figure 7: Concept of Grayscaling an Image

This method is used to help distinguish lines from noise in an image. The method is

commonly used because it is very easy to implement and it is the basis for many other

methods such as thresholding. As it was mentioned in the background section, 2.3.1, this

method is necessary for object identification because grayscaling an image isolates objects

18

Page 23: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

from the background and it eliminates noise from that image.

Thresholding: Thresholding is another common method that is used in computer vision.

Thresholding is a method that is used to convert grayscaled images into black and white

images. This occurs by determining a baseline for a pixel value. If a pixel value is below

the baseline then the pixel is set to 0. Otherwise if it is above, then the pixel is set to 1.

This process continues until all of the pixels have been set to either 0s or 1s. This method is

often used because it can help find the contours of shapes and lines in an image [30], which

is exactly what is needed for my project. Figure 8 helps depict this concept.

Figure 8: Concept of Thresholding an Image

5.1.4 Feature Extraction

SIFT: SIFT stands for Scale-Invariant Feature Transform which is an algorithm that

is commonly used for detecting features within images. It is often used because like the

title suggests, it works for objects in images of multiple scales, making it practical to use.

The way SIFT works is that it takes keypoints from another algorithm and finds patches of

pixels around those given keypoints [12]. These patches consist of pixel gradients within the

image [26]. These gradients are then used to create orientation historgrams - also known

as keypoint descriptors [12]. These orientation histograms contain important aspects of the

patches of pixels. These descriptors achieve robustness against contrast changes, rotations

and more [4]. Figure 9 shows a visual representation of SIFT and a more detailed explanation

of what SIFT is can be found on openCV’s documentation website [4].

19

Page 24: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

Figure 9: Concept of SIFT [26]

5.1.5 Classification Methods

KNN Algorithm: Due to simplicity, performance and computation requirements, I

decided to use the KNN algorithm as a baseline and build up from there. People [31] in

the past have produced results that are above 80%. KNN is an object classifier algorithm

that can be used to classify many different objects [36]. The purpose of the algorithm is to

train the algorithm on a dataset (many images) and get it to recognize and classify objects

depending on their features and characteristics that were defined for them. When there’s

an image of an object to identify, the algorithm determines where to place the datapoint

on the feature plane depending on its characteristics. Then it classifies the new object as

belonging to the most common class defined by the majority of its k nearest neighbors to

it by calculating the Euclidean distance between all of its points [31]. This concept can be

seen in Figure 10. Then the algorithm returns the percentages of every category that the

object in the image could be.

This algorithm is perfect for my system because it is simple, easy to implement, and easily

20

Page 25: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

applicable to many different situations [35]. It also has good performance (as mentioned

above) and it has low enough computational requirements to apply it to a microcontroller

such as a Raspberry Pi 3 Model B.

Figure 10: Concept of KNN [37]

5.2 Segregation System

The overall design of the segregation system consists of one sensor (IR proximity sensor),

a motor and 4 containers. When the object enters the segregation system, it starts the entire

system and the object is held in a waiting compartment so that the classifier system can

classify it and then as soon as it is classified, it is moved by the motor a certain direction

depending on the classification of it. Then it will fall into its corresponding container. Each

container corresponds to a given classification: metal, glass, plastic and paper. It also should

be noted that the segregation system will encase the classifier system in order for this to

work.

21

Page 26: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

5.2.1 IR Sensor

The IR sensor should be triggered when an object falls through the hole and it should

start the entire system by sending a signal to the Raspberry Pi. This signal wakes up the

classifier system so that the camera can take a picture of the object and the entire process

begins.

5.2.2 Motor

The motor should be able to move the object to the left or right in order to move the

object into its corresponding container [11]. In order to do so, the classifier system has

to determine what the object classifies as. Depending on the biggest percentage number

that is given, the motor will move a certain number of degrees to move the object to its

corresponding container within the system.

5.2.3 Environment

One of the most important aspects of this project consists of deciding the environment

at which the entire system will be in. In this case for simplicity sake, it will have to be a

well-lit area so that the classifier system is capable of taking pictures of objects through the

camera. In order to do this, the environment in which it is encased in needs to have a light

source in order for the environment to have enough light so that the object can be classified

properly.

22

Page 27: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

6 Implementation Schedule

Week 1: Implement SIFT and KNN algorithms

Week 2: Troubleshoot & test code

Week 3: Order parts for motors and other materials for segregation system

Week 4: Write code for motor rotations and system procedures

Week 5: Build and assemble the entire system

Week 6: Test the system: ensure that the system classifies the object correctly and

separates it correctly

Week 7: Demo the project

23

Page 28: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

References

[1] Astm f2926 - 18. http://www.astm.org/Standards/F2926.htm. ASTM International-

Standards Worldwide.

[2] Battery capacity. http://www.techlib.com/reference/batteries.html.

[3] Battery life calculator. https://www.digikey.com/en/resources/

conversion-calculators/conversion-calculator-battery-life.

[4] Introduction to sift (scale-invariant feature transform). https://docs.opencv.org/3.

4/da/df5/tutorial_py_sift_intro.html.

[5] Plastics pose biggest threat to oceans — africa renewal.

://www.un.org/africarenewal/magazine/may-july-2017/plastics-pose-biggest-threat-

oceans.

[6] Power consumption benchmarks. https://www.pidramble.com/wiki/benchmarks/

power-consumption. Accessed: 2019-11-19.

[7] Standard guide for recognition and derecognition of environmental liabilities. http:

//www.astm.org/cgi-bin/resolver.cgi?E3123-18. ASTM International - Standards

Worldwide.

[8] (2019). Recycling basics. https://www.epa.gov/recycle/recycling-basics. EPA.

[9] Aral, R. A., Keskin, S. R., Kaya, M., and Hacıomeroglu, M. (2018). Classification of

trashnet dataset based on deep learning models. In 2018 IEEE International Conference

on Big Data (Big Data), pages 2058–2062. IEEE.

24

Page 29: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

[10] Bogaerts, W. Stp1257. http://www.astm.org/DIGITAL_LIBRARY/STP/PAGES/

STP15415S.htm. ASTM International-Standards Worldwide.

[11] Chandramohan, A., Mendonca, J., Shankar, N. R., Baheti, N. U., Krishnan, N. K.,

and Suma, M. (2014). Automated waste segregator. In 2014 Texas Instruments India

Educators’ Conference (TIIEC), pages 1–6. IEEE.

[12] Choksuriwong, A., Emile, B., Laurent, H., and Rosenberger, C. (2008). Comparative

study of global invariant descriptors for object recognition. Journal of Electronic imaging,

17(2):023015.

[13] Chu, Y., Huang, C., Xie, X., Tan, B., Kamal, S., and Xiong, X. (2018). Multilayer hybrid

deep-learning method for waste classification and recycling. Computational Intelligence

and Neuroscience, 2018.

[14] Du, C.-J. and Sun, D.-W. (2008). Object Classification Methods, pages 81–107.

[15] Freedman, A. (2018). The great pacific garbage patch is up to 16 times more massive

than thought. Mashable.

[16] Garythung (2017). garythung/trashnet.

[17] Hernandez, F., Yumilka, B., Bello, R., Filiberto, Y., Frıas, M., Coello Blanco, L., and

Caballero, Y. (2015). An approach for prototype generation based on similarity relations

for problems of classification. Computacion y Sistemas, 19(1):109–118.

[18] Kilian, J. (2001). Simple image analysis by moments version 0.2.

[19] Kolodny, L. (2019). Tesla is buying computer vision start-up deepscale in

25

Page 30: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

a quest to create truly driverless cars. https://www.cnbc.com/2019/10/01/

tesla-acquiring-deepscale-computer-vision-start-up-for-self-driving.html.

[20] Krizhevsky, A., Sutskever, I., and Hinton, G. E. (2012). Imagenet classification with

deep convolutional neural networks. In Advances in neural information processing systems,

pages 1097–1105.

[21] Lowe, D. G. et al. (1999). Object recognition from local scale-invariant features. In

iccv, volume 99, pages 1150–1157.

[22] McQueen, A. M., Cherry, C. D., Rando, J. F., Schler, M. D., Latimer, D. L., McMahon,

S. A., Turkal, R. J., and Reddersen, B. R. (2000). Object recognition system and method.

US Patent 6,069,696.

[23] Mikolajczyk, K. and Schmid, C. (2005). A performance evaluation of local descriptors.

[24] Moses, A. (2008). All about laptop batteries: Updated. https://www.

cnet.com/how-to/all-about-laptop-batteries-updated/#:~:targetText=

Thetypicalnotebookbatteryhas,hours(mAh)ofcapacity.

[25] Nayar, S. K., Nene, S. A., and Murase, H. (1996). Real-time 100 object recognition

system. In Proceedings of IEEE international conference on robotics and automation,

volume 3, pages 2321–2325. IEEE.

[26] Nikishaev, A. (2019). Feature extraction and similar image search with opencv for

newbies.

[27] Popat, P., Sheth, P., and Jain, S. (2019). Animal/object identification using deep

learning on raspberry pi. In Information and Communication Technology for Intelligent

Systems, pages 319–327. Springer.

26

Page 31: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

[28] Prabhu (2019). Understanding of convolutional neural net-

work (cnn) - deep learning. https://medium.com/@RaghavPrabhu/

understanding-of-convolutional-neural-network-cnn-deep-learning-99760835f148.

[29] Rice, D. (2019). Sea sick: Plastic garbage in the north atlantic ocean skyrocketing. USA

Today.

[30] Salmador, A., Cid, J. P., and Novelle, I. R. (2008). Intelligent garbage classifier. IJIMAI,

1(1):31–36.

[31] Silva, A. and Soares, E. (2018). Artificial intelligence in automated sorting in trash

recycling.

[32] Smith, E. (2010). Re-engineering a trash/recycling collection vehicle based on challeng-

ing customer requirements.

[33] Suja, P., Tripathi, S., et al. (2016). Real-time emotion recognition from facial images

using raspberry pi ii. In 2016 3rd International Conference on Signal Processing and

Integrated Networks (SPIN), pages 666–670. IEEE.

[34] Team, D. (2019). Support vector machines tutorial - learn to implement svm in python.

[35] Torres-Garcıa, A., Rodea-Aragon, O., Longoria-Gandara, O., Sanchez-Garcıa, F., and

Gonzalez-Jimenez, L. E. (2015). Intelligent waste separator. Computacion y Sistemas,

19(3):487–500.

[36] Wahab, M. H. A., Kadir, A. A., Tomari, M. R., and Jabbar, M. H. (2014). Smart recycle

bin: a conceptual approach of smart waste management with integrated web based system.

In 2014 International Conference on IT Convergence and Security (ICITCS), pages 1–4.

IEEE.

27

Page 32: Automated Recycling System Using Computer Vision...Research was initially conducted in 1959 to measure plankton in the north Atlantic Ocean. Since then, devices and gear to measure

[37] Www.statsoft.com. http://www.statsoft.com/Textbook/k-Nearest-Neighbors.

[38] Yang, M. and Thung, G. (2016). Classification of trash for recyclability status. CS229

Project Report, 2016.

28