implementation for 3rd individual project
This commit is contained in:
parent
0270ceb6e3
commit
98d3b3ff2f
29
Main.py
29
Main.py
@ -8,6 +8,9 @@ from models.dumpster import trash
|
|||||||
from models.Garbagetruck import GarbageTruck
|
from models.Garbagetruck import GarbageTruck
|
||||||
import numbering
|
import numbering
|
||||||
from sklearn.datasets import load_digits
|
from sklearn.datasets import load_digits
|
||||||
|
import garbageDumpSorting as gds
|
||||||
|
import time
|
||||||
|
from models.garbageDump import Dump
|
||||||
|
|
||||||
#heuristics for finding the closest dumpster
|
#heuristics for finding the closest dumpster
|
||||||
def closest(GT, D):
|
def closest(GT, D):
|
||||||
@ -70,7 +73,7 @@ def drawGrid(grid, size):
|
|||||||
elif grid[row][column] == 5:
|
elif grid[row][column] == 5:
|
||||||
#metal
|
#metal
|
||||||
img = garbageBLK
|
img = garbageBLK
|
||||||
elif row == TheDump[:,0] and column == TheDump[:,1]:
|
elif row == dump.coor[:,0] and column == dump.coor[:,1]:
|
||||||
grid[row][column] = 0
|
grid[row][column] = 0
|
||||||
img = recycImg
|
img = recycImg
|
||||||
screen.blit(img, ((WIDTH) * row, (HEIGHT) * column))
|
screen.blit(img, ((WIDTH) * row, (HEIGHT) * column))
|
||||||
@ -94,10 +97,20 @@ size=20
|
|||||||
|
|
||||||
#randomizing coordinates, initializing the Garbage Dump
|
#randomizing coordinates, initializing the Garbage Dump
|
||||||
a = createDumpstersAndDump(20,size+1)
|
a = createDumpstersAndDump(20,size+1)
|
||||||
TheDump = np.reshape(a[-1], (1, 2))
|
dump = Dump()
|
||||||
|
dump.coor = np.reshape(a[-1], (1, 2))
|
||||||
a = np.reshape(a[:-1], (size, 2))
|
a = np.reshape(a[:-1], (size, 2))
|
||||||
|
|
||||||
|
|
||||||
|
#Klaudia Przybylska subproject part
|
||||||
|
gds.createSets()
|
||||||
|
# gds.processTrainData()
|
||||||
|
# gds.processTestData()
|
||||||
|
clf = gds.trainAndTest()
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Patryk Krawiec subproject part
|
#Patryk Krawiec subproject part
|
||||||
digitsy=np.load("Ytest.npy")
|
digitsy=np.load("Ytest.npy")
|
||||||
digitsx=np.load("Xtest.npy")
|
digitsx=np.load("Xtest.npy")
|
||||||
@ -189,7 +202,17 @@ while not done:
|
|||||||
# visit Garbage Dump at the end
|
# visit Garbage Dump at the end
|
||||||
if len(a) == 0:
|
if len(a) == 0:
|
||||||
print("Going to the Garbage Dump")
|
print("Going to the Garbage Dump")
|
||||||
display(grid, GT, TheDump)
|
display(grid, GT, dump.coor)
|
||||||
done = True
|
done = True
|
||||||
|
print("Checking garbage inside the truck: ")
|
||||||
|
gds.sortDump(GT.plastic, GT.paper, GT.metal, GT.cardboard, GT.glass, clf, GT, dump)
|
||||||
|
print("Garbage sorted: ")
|
||||||
|
print("Paper: " + str(dump.paper))
|
||||||
|
print("Cardboard: " + str(dump.cardboard))
|
||||||
|
print("Metal: " + str(dump.metal))
|
||||||
|
print("Plastic: " + str(dump.plastic))
|
||||||
|
print("Glass: " + str(dump.glass))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user