Create more models and picked the best

This commit is contained in:
s450026 2020-05-26 15:45:51 +02:00
parent 2e114bc0ee
commit eb23dda5b7
53 changed files with 21 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -24,17 +24,20 @@ relative_path = os.path.join(current_path, 'Data/')
DATADIR = relative_path + 'LearningData'
CATEGORIES = ['Full', 'Empty'] # labels
IMG_SIZE = 150 # specify on which size we want to transform the photos for example 50x50px
NAME = 'plate-cnn-64x2-{}'.format(int(time.time()))
NAME = 'plate-cnn-64x3x1-{}'.format(int(time.time()))
training_data = []
X = [] # feature set
y = [] # label set
'''
layer size | conv leyer |
64 | 1 | loss: 0.0443 - accuracy: 0.9942 - val_loss: 0.3614 - val_accuracy: 0.7692
64 | 2 | loss: 0.0931 - accuracy: 0.9625 - val_loss: 0.4772 - val_accuracy: 0.8462
64 | 3 |
layer size | conv layer | Dense layer |
64 | 1 | 0 | loss: 0.0443 - accuracy: 0.9942 - val_loss: 0.3614 - val_accuracy: 0.7692
64 | 2 | 0 | loss: 0.0931 - accuracy: 0.9625 - val_loss: 0.4772 - val_accuracy: 0.8462
64 | 3 | 0 | loss: 0.2491 - accuracy: 0.9020 - val_loss: 0.3762 - val_accuracy: 0.7949
64 | 1 | 1 | loss: 0.0531 - accuracy: 0.9971 - val_loss: 0.4176 - val_accuracy: 0.8205 ->
64 | 2 | 1 | loss: 0.0644 - accuracy: 0.9798 - val_loss: 0.5606 - val_accuracy: 0.8462
64 | 3 | 1 | loss: 0.1126 - accuracy: 0.9625 - val_loss: 0.5916 - val_accuracy: 0.8205
'''
@ -110,6 +113,10 @@ def creat_model():
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
# model.add(Conv2D(64, (3, 3)))
# model.add(Activation('relu'))
# model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten()) # converts our 3D feature maps to 1D feature vectors
model.add(Dense(1)) # output layer 1 output
@ -135,11 +142,12 @@ def use_model_to_predict(name):
plt.show()
return new_array.reshape(-1, IMG_SIZE, IMG_SIZE, 1)
model = tf.keras.models.load_model(relative_path + 'SavedModels/plate-cnn-64x1-1590497461.model')
model = tf.keras.models.load_model(relative_path + 'SavedModels/plate-64x2-cnn.model')
#model = tf.keras.models.load_model(relative_path + 'SavedModels/plate-cnn-64x1-1590497461.model')
prediction = model.predict([prepare(relative_path + 'TestData/' + name + '.jpg')])
print(prediction)
print(CATEGORIES[int(prediction[0][0])])
#print(prediction)
#print(CATEGORIES[int(prediction[0][0])])
return int(prediction[0][0])
@ -164,5 +172,8 @@ def text_speech(font: str, size: int, text: str, color, background, x, y, bold:
# save_dataset()
#use_model_to_predict('test-0')
creat_model()
# for x in range(10):
# print(CATEGORIES[use_model_to_predict('test-{}'.format(x))])
#creat_model()
#python -m tensorboard.main --logdir=Data/logs