0

I am new to neural networks and am trying to get my model to predict the Gaussian noise applied to images from the MNIST dataset. I do this by adding noise with random standard deviation to each image. The x values are the images with noise applied, the y values are the standard deviation of the noise.

So far I am getting a 10% accuracy rating, and I have no ideas what to adjust.

Here is my code for the model itself:

noisey_x_train = tf.keras.utils.normalize(noisey_x_train, axis=1)
noisey_x_test = tf.keras.utils.normalize(noisey_x_test, axis=1)

model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(15, activation=tf.nn.relu))
model.add(tf.keras.layers.Dense(1, kernel_initializer='normal'))

model.compile(optimizer='adam',
              loss=tf.keras.losses.MeanSquaredError(),
              metrics=['accuracy'])

model.fit(noisey_x_train, noisey_y_train, epochs=10)

val_loss, val_acc = model.evaluate(noisey_x_test, noisey_y_test)
print("Loss: {}  \nAccuracy:  {}".format(val_loss, val_acc))

I would appreciate any help.

  • Think about your problem and selected metric. How does accuracy is defined? Can you use this with continuous values? https://stackoverflow.com/questions/48775305/what-function-defines-accuracy-in-keras-when-the-loss-is-mean-squared-error-mse – Frightera Dec 02 '21 at 17:18

0 Answers0