首页 > 解决方案 > 设置 TensorBoard 以在 Google Colab 中为 TensorFlow 对象检测模型运行 eval.py 作业

问题描述

我是深度学习领域的新手。我想在 Google Colab 中运行对象检测模型时使用 TensorBoard。

我已经提到了几个讨论线程(如何为 tensorflow 对象检测模型运行 eval.py 作业

但没有得到我的具体查询的答案。

我在下面给出了我遵循的步骤:

过程1:

1.下载ngrok并解压

!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip -o ngrok-stable-linux-amd64.zip

2.指定日志目录并在后台触发tensorboard:

LOG_DIR = '/content/models/research/training'
get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
    .format(LOG_DIR)
)

3.通过端口 6006 运行 ngrok 到隧道 TensorBoard:

get_ipython().system_raw('./ngrok http 6006 &')
  1. 生成的 TensorBoard 链接:

    !curl -s http://localhost:4040/api/tunnels | python3 -c \"导入系统,json;打印(json.load(sys.stdin)['tunnels'][0]['public_url'])"

问题:

一世。当我打开链接时,会打开一个带有通知的空白页面:

*No dashboards are active for the current data set.
Probable causes:
You haven’t written any data to your event files.
TensorBoard can’t find your event files.*

ii. 在训练进行时,我回去刷新了 tensorboard,它看起来是空白的

Process_1_Tensor_Board

此外,在任何给定的情况下,我的日志目录(即培训目录)都有以下文件:日志文件在哪里?

文件_生成

我的问题:

我将如何在 TensorBoard 中查看训练进度?我遵循的方法有什么问题吗?

过程2:

正如@cookiemonster 建议的那样:

我尝试了以下设置以从 Colab 单元本身打开 TensorBoard:

!pip install tb-nightly
%load_ext tensorboard

%tensorboard --logdir '/content/models/research/training'

输出:

只是一个橙色条来了

Process_2_Tensor_Board

如何在训练进行时查看此过程中的训练状态。

最后一个问题:

我的主要目标是通过更改配置文件中“matrics_set”的值来检查不同的评估矩阵,然后运行 ​​eval.py 我需要检查结果。

我在一个线程中读到“结果输出到以 events.out.tfevents 为前缀的事件摘要文件,您可以使用 TensorBoard 对其进行可视化”

(参考:运行对象检测评估协议(tensorflow)

我的问题:

如果我只是运行以下代码,日志文件会在我指定的日志目录中生成吗?

!python eval.py --logtostderr --pipeline_config_path=<path to training directory>/faster_rcnn_inception_v2_pets.config --checkpoint_dir=<path to training directory> --eval_dir=<path to log directory>

鉴于我在查看张量板时面临的当前基本问题,如何实现查看运行 eval.py 的结果的主要目标?

标签: pythontensorflowobject-detectiongoogle-colaboratorytensorboard

解决方案


仅供参考,新的张量板可以直接在笔记本中运行,因此您可以运行

!pip install tb-nightly
%load_ext tensorboard
%tensorboard --logdir "/content/runs"

或者您安装谷歌驱动器并可以在另一个 colab 笔记本中运行它(可能只使用 CPU)以避免弄乱已安装的库

%tensorboard --logdir "/content/drive/My Drive/Colab Runs"

推荐阅读