Skip to main content

Use TensorBoard

For greater convenience TensorFlow Understanding of the program. Debugging and optimization. TensorFlow The team has released a set called TensorBoard The visualization tool. Can be used TensorBoard To showcase TensorFlow chart. Draw quantitative indicator maps generated from images and display additional data (As conveyed in the image).

at present HyperAI Container is being created Task or Jupyter It is already supported in the workspace TensorBoard.

The following code example demonstrates how to specify the use during training TensorBoard:

def create_model():
model = tf.keras.models. Sequential([
tf.keras.layers. Dense(512, activation=tf.nn.relu, input_shape=(img_rows * img_cols,)),
tf.keras.layers. Dropout(0.2),
tf.keras.layers. Dense(num_classes, activation=tf.nn.softmax)
])

model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])

return model

model = create_model()
model.summary()

log_path = './tf_dir'

# Set up TensorBoard Path to tf_dir
tb_callback = tf.keras.callbacks. TensorBoard(log_dir=log_path)

model.fit(x_train, y_train,
epochs=epochs,
verbose=1,
callbacks=[tb_callback])

The complete code can be found at MNist Example.

be careful

As shown in the following figure. We default to specifying TensorBoard The directory for data retrieval is /hyperai/home Below tf_dir folder. Therefore, if you need to demonstrate TensorBoard data. Please make sure to TensorBoard of log_dir Set as this directory.

For containers that run successfully. It will appear on its page "open TensorBoard" The button. Open it and you can see that it is running TensorBoard I got it.

Containers can only be viewed while running TensorBoard. If you want to continue viewing after the container has stopped TensorBoard. Please "working directory" Download to local. And by installing locally TensorBoard Come and view the contents of it:

tensorboard --logdir=<TensorBoard Data Catalog>

Then open it in the browser http://localhost:6006/ that will do.