Final ver.0.1

This commit is contained in:
HelQ 2022-09-08 02:44:16 +02:00
parent 03d74b5aee
commit 3e69124248
4 changed files with 5 additions and 8 deletions

View File

@ -5,7 +5,7 @@ class genetic:
def __init__(self, chrome): def __init__(self, chrome):
self.chrome = chrome self.chrome = chrome
self.key = 10 self.key = 10
self.pop_size = 50 self.pop_size = 500
self.gen_max = 20 self.gen_max = 20
self.length = len(chrome) - 1 self.length = len(chrome) - 1
self.div = self.length // 2 self.div = self.length // 2

10
main.py
View File

@ -1,8 +1,6 @@
# from collections import deque # from collections import deque
from queue import PriorityQueue from queue import PriorityQueue
import matplotlib.pyplot as plt
from neural import * from neural import *
from path_algorithms.a_star import a_star from path_algorithms.a_star import a_star
# from path_algorithms.bfs import bfs # from path_algorithms.bfs import bfs
@ -57,8 +55,8 @@ for i in range(15):
rubbish_list.append(Rubbish(screen, j * 60, i * 60)) rubbish_list.append(Rubbish(screen, j * 60, i * 60))
path = [] path = []
X,y = create_training_data() x, y = create_training_data()
model = learn_neural_network(X,y) model = learn_neural_network(x, y)
gen = [(truck.y / 60, truck.x / 60)] gen = [(truck.y / 60, truck.x / 60)]
fl = 0 fl = 0
@ -128,9 +126,9 @@ while True:
number = np.random.randint(2077) number = np.random.randint(2077)
path_img = "images/bbb" path_img = "images/bbb"
img = Image.open(path_img+'/'+str(number)+'.jpg') img = Image.open(path_img + '/' + str(number) + '.jpg')
img.show() img.show()
prediction = predict(model,path_img+'/'+str(number)+'.jpg') prediction = predict(model, path_img + '/' + str(number) + '.jpg')
result(prediction) result(prediction)
data = rubbish_list[order[0]].data_for_decision_tree() data = rubbish_list[order[0]].data_for_decision_tree()
print(f'----------\n' print(f'----------\n'

View File

@ -1,7 +1,6 @@
import math import math
import os import os
import cv2 import cv2
import matplotlib.pyplot as plt
import numpy as np import numpy as np
from keras.layers import Conv2D, MaxPooling2D from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Dense, Activation, Flatten from keras.layers import Dense, Activation, Flatten

Binary file not shown.