merge
This commit is contained in:
parent
0b0ee6612b
commit
2bae8269f2
@ -10,7 +10,7 @@ from sklearn.tree import export_graphviz
|
||||
def decision(plant,feed,growth,dryness):
|
||||
|
||||
# czytanie pliku csv
|
||||
df = pd.read_csv("C:\DATA\#Mike\#Studia\#Rok II- Semestr II\#Sztuczna_inteligencja\Projekt\AIProjekt\data.csv")
|
||||
df = pd.read_csv("data.csv")
|
||||
#print(df)
|
||||
|
||||
#zmiana słów na cyfry, ponieważ drzewo decyzyjne opiera się na cyfrach
|
||||
|
19
main.py
19
main.py
@ -1,7 +1,8 @@
|
||||
import pygame, sys
|
||||
from traktor import Traktor
|
||||
import dijkstra as di
|
||||
import decisiontree as dt
|
||||
import decisiontree as dt
|
||||
from ID3 import predict_data
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from tensorflow.keras.preprocessing import image
|
||||
@ -47,9 +48,11 @@ class Game(object):
|
||||
#ładowanie tablicy ze zdjeciami
|
||||
imgs = []
|
||||
data_plant = []
|
||||
data_soil = []
|
||||
img_dir = './imgs'
|
||||
for _ in lokalizacje:
|
||||
data_plant.append([random.randrange(5, 90),random.randrange(0, 120),random.randrange(5, 90)])
|
||||
data_soil.append([random.randrange(44, 75)/10, random.randrange(0, 100)/100])
|
||||
imgs.append(img_dir + '/' + random.choice(os.listdir(img_dir)))
|
||||
|
||||
#model do rozpoznawania
|
||||
@ -145,8 +148,18 @@ class Game(object):
|
||||
list_of_preds = preds.tolist()[0]
|
||||
index = list_of_preds.index(max(list_of_preds))
|
||||
#print(index)
|
||||
|
||||
|
||||
|
||||
names = ['cabbage', 'beetroot', 'carrot', 'pumpkin']
|
||||
|
||||
# decyzja o posadzeniu nowej rośliny następuje wtedy, gdy jest ona dojrzała przynajmniej w 90%
|
||||
if(data_plant[pt][1] > 90):
|
||||
predict_data([names[index], data_soil[pt][0], data_soil[pt][1]])
|
||||
index = names.index(names[index])
|
||||
#imgs[pt] = img_dir + '/' + names[index] + '.jpg'
|
||||
data_plant[pt] = [0, 0, 50]
|
||||
else:
|
||||
print("Planted: none")
|
||||
|
||||
if index == 0:
|
||||
dt.decision(4, data_plant[pt][0],data_plant[pt][1],data_plant[pt][2])
|
||||
if index == 1:
|
||||
|
Loading…
Reference in New Issue
Block a user