My work focuses on the building a garbage collector powered by AI model and that focuses on automating waste sorting and collecting. The images from the Trash Net are trained in Convolution neural network which is used to detect different types to trash. I have a also built a garbage picker that picks items from the ground.
The solution can be used to clean the public roads and help in recycling the plastic. The garbage picker can not only help in segregation of different waste materials such as metal, Plastic, Glass, Paper and cardboard. But also in collecting them from ground.
With the boom in population worldwide there is a tremendous increase in solid waste over the last few years. Improper waste management and in developing countries is a pressing issue. Effectively recycling waste is both economic and environment friendly.
several methods of sorting are available in both developed and developing countries, But that later needs to implement more methods to sort the garbage type manually or mechanically. While develop countries have more systematic methods of recycling and waste sorting. Developing countries either burn solid waste or dump them into huge pile stocks.
what motivated me to build this project.I mean literally If you have ever visited Delhi( National Capital) India You must have come across these multiple huge Garbage Dump in middle of City. If you like to read more Click here. Most of the heavily populated cities are filled with Dump sites like this and it not only a sore to human eye but also it is a health hazard to people living near by
I walk to to my work place daily and See the streets filled with this. I wanted to start small from cleaning the streets and them move my way to bigger problems. As I commute Daily I started collecting more of these images in hopes to build high accurate model using them you can see them Here, How ever I found a much better dataset called as Trashnet to Pursue my Goal.
Training a model
I use the trashnet net dataset to build a model here are the details
on trash net dataset consist of 2527 images:
- 501 glass
- 594 paper
- 403 cardboard
- 482 plastic
- 410 metal
- 137 trash
img_loc= 'plasctics_example.jpg'
img = image.load_img(img_loc, target_size=(300, 300))
img = image.img_to_array(img, dtype=np.uint8)
img=np.array(img)/255.0
p=model.predict(img[np.newaxis, ...])
print("output: ",np.max(p[0], axis=-1))
predcited= labels[np.argmax(p[0], axis=-1)]
print("result:",predcited)
Output:-
output: 0.9989919
result: plastic
Optimizing a model using open vino toolkit
The task of a intel Vino model optimizer is to take a already trained Deep learning model and adjust it to point for better execution on a Intel Based Hardware.
the Intel optimizer from intel open vino toolkit support most of popular DL frameworks (Tensorflow, Caffe, MXNet, ONNX, Kaldi), you can read more about it here. model optimizer will produce two files namely
- .xml -> Contains the Model Architecture.
- .bin -> Contains the weights and biases of the model in a binary format.
You need both the files to build a inference engine.
Read the documentation to know mode about the "model_optimizer/mo.py" file
It helps in following areas:- Quantization,Freezing,Fusion etc.
How Intel Vino toolkit helps me
I don't have any Intel edge device (yet), but that is the beauty of Open vino toolkit you can run it on any Intel based platform make sure you check the compatibility of your Hardware and operating system here https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/hardware.html
The Intel demo benchmark is located in
(openvinoenv) C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\demo>demo_benchmark_app.bat
That will run performance counts models and give you score to understand the power of your intel platform, The demo benchmark will run 4 inference asyncronously (4 inference requests using 4 streams for CPU, limits: 1000 iterations) the output will look something like this.
Full device name: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Count: 1000 iterations
Duration: 4820.79 ms
Latency: 18.87 ms
Throughput: 207.43 FPS
Building the Hardware and robot Garbage picker
I have used a wooden Board of ( 100 cm 100 cm) to place all the electronics and components on top and wheel on the base to make the base portable.
The wider base will allow me to place a laptop on top of wooden frame which will detect the garbage right in front of of the bot.
The Tyre are 3d printed since the motors I have used have different 8mm dia, so I have to custom build a wheel rim.
The main purpose of geared motor is to push the roller back and forth in order to pull things in the garbage bin and clean things out.
3. Battery backupI have used 24 volt batter to power the entire platform.
4. Garbage picker(roller and two dc motors)5. L298n v3 four dc motor driver.I have used a l298n 4dc motor driver that used to power the motors underneath and the roller motors.
6. Arduino and A4988The A40988n is used to power the two stepper motor and Arduino is used to control the stepper driver as well as l298n dc driver.
Below is the Arduino sketch to move the motors and stepper motors.
char receivedChar;
boolean newData = false;
// stepper pins
#define dirPin 11
#define stepPin 12
#define stepsPerRevolution 800
// motor pins
// Wheels
int in1 = 2; // Right side
int in2 = 3; //
int in3 = 4; // Left side
int in4 = 5; //
int in5 = 6; // roller pins
int in6 = 7;
void forward_R_side(){
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
void back_R_side(){
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
}
void Stop_R_side(){
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
void forward_L_side(){
digitalWrite(in4, LOW);
digitalWrite(in3, HIGH);
}
void back_L_side(){
digitalWrite(in4, HIGH);
digitalWrite(in3, LOW);
}
void Stop_L_side(){
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
void forward_brush(){
digitalWrite(in5, LOW);
digitalWrite(in6, HIGH);
}
void back_brush(){
digitalWrite(in5, HIGH);
digitalWrite(in6, LOW);
}
void stop_brush(){
digitalWrite(in5, LOW);
digitalWrite(in6, LOW);
}
/////end of function declaration
void setup() {
Serial.begin(9600);
Serial.println("<Arduino is ready to recieve commands>");
//Setting all motor pins to high
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(in5, OUTPUT);
pinMode(in6, OUTPUT);
// stepper pins
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {
recvOneChar();
showNewData();
}
void recvOneChar() {
if (Serial.available() > 0) {
receivedChar = Serial.read();
newData = true;
}
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChar);
//code for direction
if(receivedChar=='w')
{Serial.println("moving forward");
forward_R_side();
forward_L_side();
delay(3000);
Stop_R_side();
Stop_L_side();
}
if(receivedChar=='s')
{Serial.println("move back");
back_R_side();
back_L_side();
delay(3000);
Stop_R_side();
Stop_L_side();
}
if(receivedChar=='a')
{Serial.println("move left");
}
if(receivedChar=='d')
{Serial.println("move right");
}
//////////////Moving the brush rollers
if(receivedChar=='k')
{Serial.println("moving brush");
back_brush();
delay(3000);
stop_brush();
}
if(receivedChar=='j')
{Serial.println("moving brush");
forward_brush();
delay(1000);
stop_brush();
}
//////////////moving the stepper motors
if(receivedChar=='u')
{Serial.println("moving stepper");
// Set the spinning direction counterclockwise:
digitalWrite(dirPin, LOW);
// Spin the stepper motor 1 revolution quickly:
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(8000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
}
//////////////opposite side
if(receivedChar=='i')
{Serial.println("moving -opp side stepper");
// Set the spinning direction counterclockwise:
digitalWrite(dirPin, HIGH);
// Spin the stepper motor 1 revolution quickly:
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(8000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
}
newData = false;
}
}
Running the Intel Smart Garbage PickerOutro:-Although the motive of my project is to identify and pick garbage from ground, I was partially able to suceeded in that front I might need a few iteration to get it straight, But choosing Intel open vino toolkit helped me to quickly build a working prototype for my Garbage picker.
Comments