podprojekt kacper update
This commit is contained in:
parent
b9fda1e459
commit
b12fa77b91
@ -4,6 +4,7 @@ from keras.models import Sequential
|
||||
from keras.layers import Conv2D, MaxPooling2D
|
||||
from keras.layers import Activation, Dropout, Flatten, Dense, BatchNormalization
|
||||
from keras import backend as K
|
||||
|
||||
img_width, img_height = 299, 299
|
||||
|
||||
train_data_dir = 'resources/zbior_uczacy'
|
||||
@ -13,9 +14,8 @@ nb_validation_samples = 1574
|
||||
epochs = 1
|
||||
batch_size = 16
|
||||
|
||||
|
||||
def stworzModel():
|
||||
|
||||
|
||||
if K.image_data_format() == 'channels_first':
|
||||
input_shape = (3, img_width, img_height)
|
||||
else:
|
||||
@ -42,6 +42,7 @@ def stworzModel():
|
||||
model.add(Activation('softmax'))
|
||||
return model
|
||||
|
||||
|
||||
def trainModel():
|
||||
model = stworzModel()
|
||||
model.compile(loss='categorical_crossentropy',
|
||||
@ -80,6 +81,7 @@ def trainModel():
|
||||
|
||||
model.save_weights('nowy_wytrenowany.h5')
|
||||
|
||||
|
||||
def przewidz(path):
|
||||
model = stworzModel()
|
||||
model.load_weights('wytrenowany.h5')
|
||||
@ -97,4 +99,3 @@ def przewidz(path):
|
||||
return "paper"
|
||||
elif kategoria == 3:
|
||||
return "plastic"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user