0

This is an update from my previous question.

I'll put my Model Development code here for your reference:

# Splitting the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

Create a neural network model

model = Sequential()

Convolutional layers

model.add(Conv2D(32, kernel_size=(3, 3), activation='relu', input_shape=(img_width, img_height, 3))) model.add(MaxPool2D(pool_size=(2, 2))) model.add(Conv2D(64, kernel_size=(3, 3), activation='relu')) model.add(MaxPool2D(pool_size=(2, 2))) model.add(Conv2D(128, kernel_size=(3, 3), activation='relu')) model.add(MaxPool2D(pool_size=(2, 2)))

Flatten layer

model.add(Flatten())

Fully connected layers

model.add(Dense(128, activation='relu')) model.add(Dropout(0.5)) model.add(BatchNormalization()) model.add(Dense(37, activation='sigmoid')) # 37 output nodes for 37 labels

Compile the model

model.compile(optimizer=Adam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])

Print model summary

model.summary()

Train the model

history = model.fit(X_train, y_train, epochs=10, batch_size=32, validation_split=0.2, verbose=1)

Evaluate the model on the test set

test_loss, test_accuracy = model.evaluate(X_test, y_test, verbose=0) print(f'Test Accuracy: {test_accuracy * 100:.2f}%')

Save the trained model

model.save('my_model.keras')

My test accuracy is currently low, and I'm seeking guidance to improve my model's performance. Any code examples or detailed explanations would be appreciated.

0 Answers0