在 Matterport 上设置张量板 - Mask RCNN
Set up tensorboard on Matterport - Mask RCNN
我正在关注这个 tutorial for image detection using Matterport 回购。
我尝试遵循此 guide 并将代码编辑为
如何编辑以下代码来可视化张量板?
import tensorflow as tf
import datetime
%load_ext tensorboard
sess = tf.Session()
file_writer = tf.summary.FileWriter('/path/to/logs', sess.graph)
然后在模型区
# prepare config
config = KangarooConfig()
config.display()
# define the model
model = MaskRCNN(mode='training', model_dir='./', config=config)
model.keras_model.metrics_tensors = []
# Tensorflow board
logdir = os.path.join(
"logs", datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
tensorboard_callback = tf.keras.callbacks.TensorBoard(logdir, histogram_freq=1)
# load weights (mscoco) and exclude the output layers
model.load_weights('mask_rcnn_coco.h5',
by_name=True,
exclude=[
"mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox",
"mrcnn_mask"
])
# train weights (output layers or 'heads')
model.train(train_set,
test_set,
learning_rate=config.LEARNING_RATE,
epochs=5,
layers='heads')
我不知道去哪里 callbacks=[tensorboard_callback]
?
在你的 model.train 中,如果你仔细查看源代码文档,有一个名为 custom_callbacks
的参数,默认为 None
。
这是您需要编写代码的地方,因此要使用自定义回调进行训练,您需要添加这行代码:
model.train(train_set,
test_set,
learning_rate=config.LEARNING_RATE,
custom_callbacks = [tensorboard_callback],
epochs=5,
layers='heads')
您只需打开 Anaconda Prompt 并输入 tensorboard --logdir= yourlogdirectory
,其中 yourlogdirectory
是包含模型检查点的目录。
它应该看起来像这样:logs\xxxxxx20200528T1755,其中 xxxx 代表您为配置指定的名称。
此命令将生成一个网址,将其复制到我们首选的浏览器中。
我正在关注这个 tutorial for image detection using Matterport 回购。 我尝试遵循此 guide 并将代码编辑为
如何编辑以下代码来可视化张量板?
import tensorflow as tf
import datetime
%load_ext tensorboard
sess = tf.Session()
file_writer = tf.summary.FileWriter('/path/to/logs', sess.graph)
然后在模型区
# prepare config
config = KangarooConfig()
config.display()
# define the model
model = MaskRCNN(mode='training', model_dir='./', config=config)
model.keras_model.metrics_tensors = []
# Tensorflow board
logdir = os.path.join(
"logs", datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
tensorboard_callback = tf.keras.callbacks.TensorBoard(logdir, histogram_freq=1)
# load weights (mscoco) and exclude the output layers
model.load_weights('mask_rcnn_coco.h5',
by_name=True,
exclude=[
"mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox",
"mrcnn_mask"
])
# train weights (output layers or 'heads')
model.train(train_set,
test_set,
learning_rate=config.LEARNING_RATE,
epochs=5,
layers='heads')
我不知道去哪里 callbacks=[tensorboard_callback]
?
在你的 model.train 中,如果你仔细查看源代码文档,有一个名为 custom_callbacks
的参数,默认为 None
。
这是您需要编写代码的地方,因此要使用自定义回调进行训练,您需要添加这行代码:
model.train(train_set,
test_set,
learning_rate=config.LEARNING_RATE,
custom_callbacks = [tensorboard_callback],
epochs=5,
layers='heads')
您只需打开 Anaconda Prompt 并输入 tensorboard --logdir= yourlogdirectory
,其中 yourlogdirectory
是包含模型检查点的目录。
它应该看起来像这样:logs\xxxxxx20200528T1755,其中 xxxx 代表您为配置指定的名称。
此命令将生成一个网址,将其复制到我们首选的浏览器中。