neural_network #4

Merged
s452622 merged 34 commits from neural_network into master 2021-06-08 23:47:22 +02:00
2 changed files with 2 additions and 3 deletions
Showing only changes of commit 34bf6076f2 - Show all commits

View File

@ -18,9 +18,8 @@ def create_training_data():
category_index = CATEGORIES.index(category) category_index = CATEGORIES.index(category)
for img in os.listdir(path): for img in os.listdir(path):
try: try:
img = np.reshape(img,(-1,28))
img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE)
new_array = np.reshape(img_array, (-1, 28)) new_array = cv2.resize(img_array, (IMG_SIZE,IMG_SIZE))
training_data_label.append(category_index) training_data_label.append(category_index)
training_data_images.append(new_array) training_data_images.append(new_array)
except Exception as e: except Exception as e:

View File

@ -43,7 +43,7 @@ if __name__ == '__main__':
train(model, 100) train(model, 100)
# def accuracy(expected, predicted): # def accuracy(expected, predicted):
# return len([_ for e, p in zip(expected, predicted) if e == p]) / len(expected) # return len([1 for e, p in zip(expected, predicted) if e == p]) / len(expected)
# #
# #
# predicted = [model(image).argmax() for image in train_images] # predicted = [model(image).argmax() for image in train_images]