简体   繁体   English

在 Matterport 上设置张量板 - Mask RCNN

[英]Set up tensorboard on Matterport - Mask RCNN

I am following this tutorial for image detection using Matterport repo.我正在按照本教程使用Matterport 存储库进行图像检测。 I tried following this guide and edited the code to我尝试遵循本指南并将代码编辑为

How can I edit the following code to visualize the tensorboard ?如何编辑以下代码以可视化张量板?

import tensorflow as tf
import datetime
%load_ext tensorboard

sess = tf.Session()

file_writer = tf.summary.FileWriter('/path/to/logs', sess.graph)

And then in the model area然后在模型区

# 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')

I am not sure where to callbacks=[tensorboard_callback] ?我不确定在哪里callbacks=[tensorboard_callback]

In your model.train, if you look closely in the source code documentation, there is parameter called custom_callbacks , which defaults to None .在您的 model.train 中,如果您仔细查看源代码文档,会发现一个名为custom_callbacks参数,该参数默认为None

It is there where you need to write your code, so to train with a custom callback, you will need to add this line of code:您需要在此处编写代码,因此要使用自定义回调进行训练,您需要添加以下代码行:

model.train(train_set,
            test_set,
            learning_rate=config.LEARNING_RATE,
            custom_callbacks = [tensorboard_callback],
            epochs=5,
            layers='heads')

You only have to open Anaconda Prompt and write tensorboard --logdir= yourlogdirectory , where yourlogdirectory is the directory containing the model checkpoint.您只需打开 Anaconda Prompt 并写入tensorboard --logdir= yourlogdirectory ,其中yourlogdirectory是包含模型检查点的目录。

It should look something like this: logs\\xxxxxx20200528T1755, where xxxx stands for the name you give to your configuration.它应该看起来像这样:logs\\xxxxxx20200528T1755,其中 xxxx 代表您为配置提供的名称。

This command will generate a web address, copy it in our browser of preference.此命令将生成一个网址,将其复制到我们首选的浏览器中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 设置参数后,Matterport 的 mask rcnn 不训练 - Matterport's mask rcnn doesn't train after setting up parameters Matterport-Mask RCNN 中每个时期的步骤/验证步骤 - Steps per Epoch/Validation steps in Matterport-Mask RCNN 如何在matterport/Mask_RCNN 示例中减少batch_size 和image_shape? - How can I reduce the batch_size and the image_shape in the matterport/Mask_RCNN example? 如何使用 coremltools 将 matterport mask_rcnn keras(.h5) model 转换为 coreml 模型(.mlmodel) - How to convert matterport mask_rcnn keras(.h5) model to coreml model(.mlmodel) using coremltools 如何将torchvision mask rcnn中的日志文件保存到张量板中的plot - how to save logfile in torchvision mask rcnn to plot in tensorboard 掩码 rcnn 的数据注释 - Data annotation for mask rcnn 在自己的数据集上训练。 Mask_RCNN 资源耗尽:分配时OOM - Train on own data set. Mask_RCNN Resource exhausted: OOM when allocating 如何设置具有任意运行次数的 Tensorboard? - How can I set up Tensorboard with an arbitrary number of runs? 在Mask-RCNN中在哪里创建会话? - where is the session created in Mask-RCNN? 从Mask_RCNN张量检索信息 - Retrieving information from a Mask_RCNN Tensor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM