diff --git a/.idea/ProjektAI.iml b/.idea/ProjektAI.iml
index d25211e..08884dd 100644
--- a/.idea/ProjektAI.iml
+++ b/.idea/ProjektAI.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 035315d..996c849 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/Raport - Podprojekt Adam Toppmayer.pdf b/Raport - Podprojekt Adam Toppmayer.pdf
new file mode 100644
index 0000000..89f7510
Binary files /dev/null and b/Raport - Podprojekt Adam Toppmayer.pdf differ
diff --git a/Raport - Podprojekt_Adam_Wojdyla.pdf b/Raport - Podprojekt_Adam_Wojdyla.pdf
new file mode 100644
index 0000000..c8792c9
Binary files /dev/null and b/Raport - Podprojekt_Adam_Wojdyla.pdf differ
diff --git a/Raport - Podprojekt_Mariia_Kuzmenko.pdf b/Raport - Podprojekt_Mariia_Kuzmenko.pdf
new file mode 100644
index 0000000..5b94d43
Binary files /dev/null and b/Raport - Podprojekt_Mariia_Kuzmenko.pdf differ
diff --git a/Raport - _Automatyczny kelner_.pdf b/Raport - _Automatyczny kelner_.pdf
new file mode 100644
index 0000000..4bd29e7
Binary files /dev/null and b/Raport - _Automatyczny kelner_.pdf differ
diff --git a/Raport 2 - _Automatyczny kelner_.pdf b/Raport 2 - _Automatyczny kelner_.pdf
new file mode 100644
index 0000000..50b1c79
Binary files /dev/null and b/Raport 2 - _Automatyczny kelner_.pdf differ
diff --git a/kelner/images/dataset/ffries/10500.jpg b/kelner/images/dataset/ffries/10500.jpg
new file mode 100644
index 0000000..9df0087
Binary files /dev/null and b/kelner/images/dataset/ffries/10500.jpg differ
diff --git a/kelner/images/dataset/ffries/17394.jpg b/kelner/images/dataset/ffries/17394.jpg
new file mode 100644
index 0000000..13834e8
Binary files /dev/null and b/kelner/images/dataset/ffries/17394.jpg differ
diff --git a/kelner/images/dataset/ffries/20215.jpg b/kelner/images/dataset/ffries/20215.jpg
new file mode 100644
index 0000000..68e0e85
Binary files /dev/null and b/kelner/images/dataset/ffries/20215.jpg differ
diff --git a/kelner/images/dataset/ffries/24479.jpg b/kelner/images/dataset/ffries/24479.jpg
new file mode 100644
index 0000000..a839ea7
Binary files /dev/null and b/kelner/images/dataset/ffries/24479.jpg differ
diff --git a/kelner/images/dataset/ffries/43636.jpg b/kelner/images/dataset/ffries/43636.jpg
new file mode 100644
index 0000000..bb8295a
Binary files /dev/null and b/kelner/images/dataset/ffries/43636.jpg differ
diff --git a/kelner/images/dataset/ffries/48052.jpg b/kelner/images/dataset/ffries/48052.jpg
new file mode 100644
index 0000000..2726010
Binary files /dev/null and b/kelner/images/dataset/ffries/48052.jpg differ
diff --git a/kelner/images/dataset/ffries/51368.jpg b/kelner/images/dataset/ffries/51368.jpg
new file mode 100644
index 0000000..4ccdbd9
Binary files /dev/null and b/kelner/images/dataset/ffries/51368.jpg differ
diff --git a/kelner/images/dataset/ffries/51678.jpg b/kelner/images/dataset/ffries/51678.jpg
new file mode 100644
index 0000000..96b0570
Binary files /dev/null and b/kelner/images/dataset/ffries/51678.jpg differ
diff --git a/kelner/images/dataset/ffries/52510.jpg b/kelner/images/dataset/ffries/52510.jpg
new file mode 100644
index 0000000..4b070a2
Binary files /dev/null and b/kelner/images/dataset/ffries/52510.jpg differ
diff --git a/kelner/images/dataset/ffries/57594.jpg b/kelner/images/dataset/ffries/57594.jpg
new file mode 100644
index 0000000..7ab899c
Binary files /dev/null and b/kelner/images/dataset/ffries/57594.jpg differ
diff --git a/kelner/images/dataset/macarons/1075.jpg b/kelner/images/dataset/macarons/1075.jpg
new file mode 100644
index 0000000..9654ec8
Binary files /dev/null and b/kelner/images/dataset/macarons/1075.jpg differ
diff --git a/kelner/images/dataset/macarons/15110.jpg b/kelner/images/dataset/macarons/15110.jpg
new file mode 100644
index 0000000..e2f6717
Binary files /dev/null and b/kelner/images/dataset/macarons/15110.jpg differ
diff --git a/kelner/images/dataset/macarons/15274.jpg b/kelner/images/dataset/macarons/15274.jpg
new file mode 100644
index 0000000..259750a
Binary files /dev/null and b/kelner/images/dataset/macarons/15274.jpg differ
diff --git a/kelner/images/dataset/macarons/17515.jpg b/kelner/images/dataset/macarons/17515.jpg
new file mode 100644
index 0000000..b061f4a
Binary files /dev/null and b/kelner/images/dataset/macarons/17515.jpg differ
diff --git a/kelner/images/dataset/macarons/28826.jpg b/kelner/images/dataset/macarons/28826.jpg
new file mode 100644
index 0000000..22a6896
Binary files /dev/null and b/kelner/images/dataset/macarons/28826.jpg differ
diff --git a/kelner/images/dataset/macarons/30074.jpg b/kelner/images/dataset/macarons/30074.jpg
new file mode 100644
index 0000000..3208fc9
Binary files /dev/null and b/kelner/images/dataset/macarons/30074.jpg differ
diff --git a/kelner/images/dataset/macarons/305.jpg b/kelner/images/dataset/macarons/305.jpg
new file mode 100644
index 0000000..c474565
Binary files /dev/null and b/kelner/images/dataset/macarons/305.jpg differ
diff --git a/kelner/images/dataset/macarons/50327.jpg b/kelner/images/dataset/macarons/50327.jpg
new file mode 100644
index 0000000..6727ca5
Binary files /dev/null and b/kelner/images/dataset/macarons/50327.jpg differ
diff --git a/kelner/images/dataset/macarons/67737.jpg b/kelner/images/dataset/macarons/67737.jpg
new file mode 100644
index 0000000..177acc6
Binary files /dev/null and b/kelner/images/dataset/macarons/67737.jpg differ
diff --git a/kelner/images/dataset/macarons/70102.jpg b/kelner/images/dataset/macarons/70102.jpg
new file mode 100644
index 0000000..f232d7a
Binary files /dev/null and b/kelner/images/dataset/macarons/70102.jpg differ
diff --git a/kelner/images/dataset/peas/11883.jpg b/kelner/images/dataset/peas/11883.jpg
new file mode 100644
index 0000000..817e247
Binary files /dev/null and b/kelner/images/dataset/peas/11883.jpg differ
diff --git a/kelner/images/dataset/peas/17431.jpg b/kelner/images/dataset/peas/17431.jpg
new file mode 100644
index 0000000..4e3303f
Binary files /dev/null and b/kelner/images/dataset/peas/17431.jpg differ
diff --git a/kelner/images/dataset/peas/17923.jpg b/kelner/images/dataset/peas/17923.jpg
new file mode 100644
index 0000000..279a15c
Binary files /dev/null and b/kelner/images/dataset/peas/17923.jpg differ
diff --git a/kelner/images/dataset/peas/17928.jpg b/kelner/images/dataset/peas/17928.jpg
new file mode 100644
index 0000000..c25f3cf
Binary files /dev/null and b/kelner/images/dataset/peas/17928.jpg differ
diff --git a/kelner/images/dataset/peas/19123.jpg b/kelner/images/dataset/peas/19123.jpg
new file mode 100644
index 0000000..1b5b27a
Binary files /dev/null and b/kelner/images/dataset/peas/19123.jpg differ
diff --git a/kelner/images/dataset/peas/20934.jpg b/kelner/images/dataset/peas/20934.jpg
new file mode 100644
index 0000000..7517f42
Binary files /dev/null and b/kelner/images/dataset/peas/20934.jpg differ
diff --git a/kelner/images/dataset/peas/42964.jpg b/kelner/images/dataset/peas/42964.jpg
new file mode 100644
index 0000000..886ae72
Binary files /dev/null and b/kelner/images/dataset/peas/42964.jpg differ
diff --git a/kelner/images/dataset/peas/4321.jpg b/kelner/images/dataset/peas/4321.jpg
new file mode 100644
index 0000000..64e97bd
Binary files /dev/null and b/kelner/images/dataset/peas/4321.jpg differ
diff --git a/kelner/images/dataset/peas/5531.jpg b/kelner/images/dataset/peas/5531.jpg
new file mode 100644
index 0000000..c2e8ff4
Binary files /dev/null and b/kelner/images/dataset/peas/5531.jpg differ
diff --git a/kelner/images/dataset/peas/5615.jpg b/kelner/images/dataset/peas/5615.jpg
new file mode 100644
index 0000000..e173525
Binary files /dev/null and b/kelner/images/dataset/peas/5615.jpg differ
diff --git a/kelner/images/dataset/pizza/11297.jpg b/kelner/images/dataset/pizza/11297.jpg
new file mode 100644
index 0000000..a7f4270
Binary files /dev/null and b/kelner/images/dataset/pizza/11297.jpg differ
diff --git a/kelner/images/dataset/pizza/2965.jpg b/kelner/images/dataset/pizza/2965.jpg
new file mode 100644
index 0000000..2945005
Binary files /dev/null and b/kelner/images/dataset/pizza/2965.jpg differ
diff --git a/kelner/images/dataset/pizza/34632.jpg b/kelner/images/dataset/pizza/34632.jpg
new file mode 100644
index 0000000..dd62b88
Binary files /dev/null and b/kelner/images/dataset/pizza/34632.jpg differ
diff --git a/kelner/images/dataset/pizza/40449.jpg b/kelner/images/dataset/pizza/40449.jpg
new file mode 100644
index 0000000..91ccbee
Binary files /dev/null and b/kelner/images/dataset/pizza/40449.jpg differ
diff --git a/kelner/images/dataset/pizza/53217.jpg b/kelner/images/dataset/pizza/53217.jpg
new file mode 100644
index 0000000..f4cd7c6
Binary files /dev/null and b/kelner/images/dataset/pizza/53217.jpg differ
diff --git a/kelner/images/dataset/pizza/54540.jpg b/kelner/images/dataset/pizza/54540.jpg
new file mode 100644
index 0000000..c6eba15
Binary files /dev/null and b/kelner/images/dataset/pizza/54540.jpg differ
diff --git a/kelner/images/dataset/pizza/56449.jpg b/kelner/images/dataset/pizza/56449.jpg
new file mode 100644
index 0000000..363a539
Binary files /dev/null and b/kelner/images/dataset/pizza/56449.jpg differ
diff --git a/kelner/images/dataset/pizza/5764.jpg b/kelner/images/dataset/pizza/5764.jpg
new file mode 100644
index 0000000..a478afc
Binary files /dev/null and b/kelner/images/dataset/pizza/5764.jpg differ
diff --git a/kelner/images/dataset/pizza/59445.jpg b/kelner/images/dataset/pizza/59445.jpg
new file mode 100644
index 0000000..3f64a1e
Binary files /dev/null and b/kelner/images/dataset/pizza/59445.jpg differ
diff --git a/kelner/images/dataset/pizza/8917.jpg b/kelner/images/dataset/pizza/8917.jpg
new file mode 100644
index 0000000..614cd85
Binary files /dev/null and b/kelner/images/dataset/pizza/8917.jpg differ
diff --git a/kelner/main.py b/kelner/main.py
index 8e5d241..dccd8ba 100644
--- a/kelner/main.py
+++ b/kelner/main.py
@@ -11,6 +11,7 @@ from kelner.src.managers.TableGenerator import TableGenerator
from kelner.src.algorithms.DecisionTree import Tree_Builder
from kelner.src.managers.KitchenManager import KitchenManager
from kelner.src.algorithms.CNN.PrepareData import LoadModelThread
+from kelner.src.algorithms.FoodNet import classify
import kelner.src.settings as settings
Scale = 1.5 # scale for all images used within project
@@ -25,6 +26,8 @@ running_tasks = {'table': [], 'waiter': []}
# initialize background
gridBoard = GridBoard(ScreenWidth, ScreenHeight)
+classify.join('/src/algorithms/FoodNet/classify.py')
+
# start loading prediction model
settings.init()
load_model_thread = LoadModelThread()
diff --git a/kelner/src/algorithms/FoodNet/classify.py b/kelner/src/algorithms/FoodNet/classify.py
new file mode 100644
index 0000000..adf88fc
--- /dev/null
+++ b/kelner/src/algorithms/FoodNet/classify.py
@@ -0,0 +1,99 @@
+import tensorflow as tf
+from PIL import Image
+import sys, numpy
+from os import listdir
+from os.path import isfile, join
+from tensorflow import keras
+import matplotlib.pyplot as plt
+
+MACARONS_DIR = './././images/dataset/macarons'
+PIZZA_DIR = './././images/dataset/pizza'
+FFRIES_DIR = './././images/dataset/ffries'
+PEAS_DIR = './././images/dataset/peas'
+COUNT = 10
+SIZE = 128, 128
+
+def getFileList(folder):
+ return [f for f in listdir(folder) if isfile(join(folder, f))]
+
+def conv(arr):
+ res = []
+ for i in arr:
+ res.append([j[0] for j in i])
+ return numpy.array(res)
+
+def getArray(filename):
+ pic = Image.open(filename).convert('LA').resize(SIZE, Image.ANTIALIAS)
+ return numpy.array([conv(numpy.array(pic)) / 255.0])
+
+
+macaronsImages = getFileList(MACARONS_DIR)
+pizzaImages = getFileList(PIZZA_DIR)
+ffriesImages = getFileList(FFRIES_DIR)
+peasImages = getFileList(PEAS_DIR)
+train_images = []
+train_labels = []
+test_images = []
+test_labels = []
+
+for i in range(COUNT):
+ pic = Image.open(MACARONS_DIR + '/' + macaronsImages[i]).convert('LA').resize(SIZE, Image.ANTIALIAS)
+ train_images.append(conv(numpy.array(pic)) / 255.0)
+ train_labels.append(0)
+ if i < COUNT / 10:
+ test_images.append(conv(numpy.array(pic)) / 255.0)
+ test_labels.append(0)
+ pic = Image.open(PIZZA_DIR + '/' + pizzaImages[i]).convert('LA').resize(SIZE, Image.ANTIALIAS)
+ train_images.append(conv(numpy.array(pic)) / 255.0)
+ train_labels.append(1)
+ if i < COUNT / 10:
+ test_images.append(conv(numpy.array(pic)) / 255.0)
+ test_labels.append(1)
+ pic = Image.open(FFRIES_DIR + '/' + ffriesImages[i]).convert('LA').resize(SIZE, Image.ANTIALIAS)
+ train_images.append(conv(numpy.array(pic)) / 255.0)
+ train_labels.append(2)
+ if i < COUNT / 10:
+ test_images.append(conv(numpy.array(pic)) / 255.0)
+ test_labels.append(2)
+ pic = Image.open(PEAS_DIR + '/' + peasImages[i]).convert('LA').resize(SIZE, Image.ANTIALIAS)
+ train_images.append(conv(numpy.array(pic)) / 255.0)
+ train_labels.append(3)
+ if i < COUNT / 10:
+ test_images.append(conv(numpy.array(pic)) / 255.0)
+ test_labels.append(3)
+
+train_i = numpy.array(train_images)
+train_l = numpy.array(train_labels)
+test_i = numpy.array(test_images)
+test_l = numpy.array(test_labels)
+
+
+class_names = ['macarons', 'pizza', 'ffries', 'peas']
+
+model = keras.Sequential([
+ keras.layers.Flatten(input_shape=SIZE),
+ keras.layers.Dense(128, activation=tf.nn.relu),
+ keras.layers.Dense(4, activation=tf.nn.softmax)
+])
+
+
+model.compile(optimizer=tf.compat.v1.train.AdamOptimizer(),
+ loss='sparse_categorical_crossentropy',
+ metrics=['accuracy'])
+
+
+
+model.fit(train_i, train_l, epochs=15)
+
+test_loss, test_acc = model.evaluate(test_i, test_l)
+print('Test accuracy:', test_acc)
+
+predictions = model.predict(test_i)
+
+if len(sys.argv) > 1:
+ predictions = model.predict([getArray(sys.argv[1])])
+ if numpy.max(predictions) > 0.5:
+ print(class_names[numpy.argmax(predictions)])
+ else:
+ print('mix')
+print(numpy.max(predictions))
\ No newline at end of file