# 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 clinet 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 subprojects was created by Patryk Krawiec (the raport can be found [here](https://git.wmi.amu.edu.pl/s444517/AI2020_Project/src/master/Report_Patryk_Krawiec.md)). ### Second subproject The first subprojects was created by Kamila Bobkowska (the raport can be found [here](https://git.wmi.amu.edu.pl/s444517/AI2020_Project/src/master/Report_Kamila_Bobkowska.md)). 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. The implementation. Along with implementing CNNs the person created a function that assigns trash to dumspters (between 1 to 3 trash correctly sorted and 0 to 2 incorrectly sorted trash). The data set used was from [kaggle](https://www.kaggle.com/asdasdasasdas/garbage-classification) ### Thrid subproject The first subprojects was created by Klaudia Przybylska (the raport can be found [here](https://git.wmi.amu.edu.pl/s444517/AI2020_Project/src/master/Report_Klaudia_Przybylska.md)). ## Examples How the UI looks like: ![ ](https://i.imgur.com/Gjdn1ek.png) 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 correctlty 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: ![ ](https://i.imgur.com/cWmLka3.png) b) info about trash found in the garbage truck and sorting in the garbage dump: ![ ](https://i.imgur.com/rvleyCN.png) Example run(missing the first second or so where the truck goes to the first dumpster): [](https://i.imgur.com/bzKMYI8.mp4) ![ ](https://i.imgur.com/bzKMYI8.mp4)