AI2020_Project/final-evaluation.md

5.4 KiB

Final Report - Intelligent Garbage Truck

General information

This is the final report for our Intelligent Garbage Truck AI program. Our program works as following - a 20x20 grid is generated with 20 random dumpsters, the garbage dump and our garbage truck(the agent). All the time we make sure that while they randomly generate they do not overlap each other. After that our garbage truck chooses the closest dumpsters to him and collects trah whilst making sure the house is our client. After he collected all trask (aka visited all dumpsters) he immediately goes to the garabage dump and sorts the trash. The dumpsters have a predeterminded colour and type but still can contain incorrectly sorted trash. If a house is not our client it is visited but no trash is picked up.

How to run our program

In order to succesfully open our program one needs to make sure he has the following libraries installed:

import pygame
import random
import numpy as np
import time
import collections
from sklearn.datasets import load_digits
import sys
import os
import random
import shutil
from keras.models import Sequential
from keras.layers import Conv2D, Flatten, MaxPooling2D, Dense
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
#import matplotlib.pyplot as plt #optionla for seeing garbage
import cv2
import mahotas
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_digits
import pylab as pl
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import os.path
import csv

Also two files need to be unpacked before running: "Garbage classification.rar" and "ClassificationGarbage.rar". Both in the same place where they are.

After that to run our program the command is :

python Main.py

Implementation of subprojects

Since there are three people in our group we have created and combined three subprojects with our main program. Two use Neural Networks and one uses Random Forest Classifier.

First subproject

The first subproject was created by Patryk Krawiec (the report can be found here). This project used Deep Neural Network to recognize house numbers visited by the Garbage Truck agent. It is implemented from scratch, has 4 layers and achieved about 97% accuracy. Subproject is mostly located in numbering.py file and affects our main project in Main.py. To use it properly the concept of paying and not-paying customers was introduced. At the beginning dumpsters are divided between those 2 categories and trash is taken out only when the first one is visited. Dataset on which the network was taught is sklearn dataset of digits.

Second subproject

The second subproject was created by Kamila Bobkowska (the report can be found here). This project used Convolutional Neural Networks to detect what kind of trash is in the dumpster and sorts it accordingly. It was mainly implemented to to the class Garbagetruck.py and dumpster.py . It used photos of garbage to determine whether it was sorted correctly. It did so by using CNNs - extracting the most important features from the photos with convolution layers, then using pooling layers and flattening. Along with implementing CNNs the person created a function that assigns trash to dumpsters (between 1 to 3 trash correctly sorted and 0 to 2 incorrectly sorted trash). The data set used was from kaggle.

Thrid subproject

The third subproject was created by Klaudia Przybylska (the report can be found here). This subproject used Random Forest Classifier to make sure that when the garbage truck reaches the garbage dump, all the thrash inside is correctly classified before taking it out of the truck and sorting it accordingly. From the pictures of different kinds of waste, it extracts three features: Hu moments (shapes), Color Histogram (colors) and Haralick Texture (textures), that are given to the classifier. It is mainly implemented in garbageDumpSorting.py class. The data set is the same as in the second project - kaggle.

Examples

How the UI looks like:

As seen on the picture we have our main grid where everything takes place and a panel on the right telling the user how many dumpsters are left and how much trash is in the garbage truck. At the end it shows the information about how much trash is in the garbage dump (the garbage dump can have different number of trash to the garbage truck as it once again checks if it has been correctly sorted). Additional information (like whether a house is a client, if trash was correctly sorted in the truck and dump) is displayed on the console: a) info about house numbers and trash from individual dumspters:

b) info about trash found in the garbage truck and sorting in the garbage dump:

Example run(missing the first second or so where the truck goes to the first dumpster): video