Hi,
i am trying to develop an image recognition app and i already had greate results with a 2 category dataset but the moment i add a third category the accuracy wont increase. Can anybody help me with that?
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras.callbacks import TensorBoard
import pickle
import time
import numpy as np
pickle_in = open(“X.pickle”,”rb”)
X = pickle.load(pickle_in)
pickle_in = open(“Y.pickle”,”rb”)
Y = pickle.load(pickle_in)
X = X/255.0
Y = np.array(Y)
#parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters
dense_layers = [0, 1, 2, 3]
layer_sizes = [32, 64, 128]
conv_layers = [1, 2, 3]
epochs = 10
batch_size = 32
validation_split = 0.3
PROJEKT_NAME=”3″
#parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters-parameters
for dense_layer in dense_layers:
for layer_size in layer_sizes:
for conv_layer in conv_layers:
NAME = f”CONV{conv_layer}_size{layer_size}_dense{dense_layer}_{time.time()}”
print(NAME)
model = Sequential()
model.add(Conv2D(layer_size, (3, 3), input_shape=X.shape[1:]))
model.add(Activation(‘relu’))
model.add(MaxPooling2D(pool_size=(2, 2)))
for l in range(conv_layer-1):
model.add(Conv2D(layer_size, (3, 3)))
model.add(Activation(‘relu’))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
for _ in range(dense_layer):
model.add(Dense(layer_size))
model.add(Activation(‘relu’))
model.add(Dense(1))
model.add(Activation(‘sigmoid’))
tensorboard = TensorBoard(log_dir=f”logs/{PROJEKT_NAME}/{NAME}”)
model.compile(loss=’binary_crossentropy’,
optimizer=’adam’,
metrics=[‘accuracy’],
)
model.fit(X, Y,
batch_size=batch_size,
epochs=epochs,
validation_split=validation_split,
callbacks=[tensorboard])
epoch_loss
epoch_accuracy