简体   繁体   中英

Using Keras, when I add a Tensorboard callback to my neural network, the accuracy decreases. How do I fix this?

This is how I set up the callback

callback = TensorBoard(log_dir='/tmp/invasive/', histogram_freq=10,
                       write_graph=True,write_grads=False,
                       write_images=True, embeddings_layer_names=None,
                       embeddings_metadata=None)

Then how I apply it into the model

model.fit(x_train,y_train,epochs=10,batch_size=10,callbacks=[callback])

As far as my beginner knowledge of Keras goes, callbacks shouldn't affect the training of the neural network yet when I add this code in, the accuracy drops from roughly 60% to 40%

This is probably just the effect of random weight initialization. Each time you train the network, the initial weights are randomly chosen (in a range), so after training with gradient descent, you typically reach a different local minima.

Make sure that you make multiple runs before trying to infer a relationship with TensorBoard in this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM