如何在tensorboard中制作表格

问题描述 投票:0回答:2

我正在使用 Tensorboard 为我的实验绘制损失。

我也想将测试结果添加到Tensorboard中,以便于实验比较,但我找不到这样做的功能。

我只需要一个简单的表格,例如:

| Exp name | Metric 1 | Metric 2 |
|----------|----------|----------|
| Exp 1    | 12       | 123      |
| Exp 2    | 23       | 234      |

我怎样才能做到这一点?

我正在使用

SummaryWriter
的 PyTorch 版本。

tensorboard
2个回答
0
投票

您可以按照本文的思路进行尝试: https://androidkt.com/keras-confusion-matrix-in-tensorboard/

基本上显示表格的图像而不是文本。


0
投票

你可以使用 tensoboard 来记录降价,见https://www.tensorflow.org/api_docs/python/tf/summary/text

假设有人可能对带有 f-string 的 pytorch 解决方案感兴趣,一个人可能会这样做

from torch.utils import tensorboard

summary_writer = tensorboard.SummaryWriter(log_dir="/tmp")
val = 0.1234
table = f"""
    | Exp name | Metric 1  | Metric 2  |
    |----------|-----------|-----------|
    | Exp 1    | {val:.2f} | {val:.2f} |
    | Exp 2    | {val:.2f} | {val:.2f} |
"""
table = '\n'.join(l.strip() for l in table.splitlines())
summary_writer.add_text("table", table, 0)

这将创建以下tensorboard table

© www.soinside.com 2019 - 2024. All rights reserved.