【发布时间】:2020-03-10 09:28:18
【问题描述】:
我正在自定义数据集中训练 pytorch-yolov3。我准备了所有必需的 txt、数据和名称文件。
在运行以下命令时:
python3 train.py --model_def config/yolov3.cfg --data_config config/custom.data
我收到以下错误:
Warning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (expandTensors at /pytorch/aten/src/ATen/native/IndexingUtils.h:20)
Warning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (expandTensors at /pytorch/aten/src/ATen/native/IndexingUtils.h:20)
Traceback (most recent call last):
File "train.py", line 136, in <module>
logger.list_of_scalars_summary(tensorboard_log, batches_done)
File "/home/sudip/torch/PyTorch-YOLOv3/utils/logger.py", line 16, in list_of_scalars_summary
summary = tf.summary(value=[tf.summary.Value(tag=tag, simple_value=value) for tag, value in tag_value_pairs])
File "/home/sudip/torch/PyTorch-YOLOv3/utils/logger.py", line 16, in <listcomp>
summary = tf.summary(value=[tf.summary.Value(tag=tag, simple_value=value) for tag, value in tag_value_pairs])
AttributeError: module 'tensorboard.summary._tf.summary' has no attribute 'Value'
这是logger.py文件:
import tensorflow as tf
class Logger(object):
def __init__(self, log_dir):
self.writer = tf.summary.create_file_writer(log_dir)
def scalar_summary(self, tag, value, step):
"""Log a scalar variable."""
summary = tf.summary(value=[tf.summary.Value(tag=tag, simple_value=value)])
self.writer.add_summary(summary, step)
def list_of_scalars_summary(self, tag_value_pairs, step):
"""Log scalar variables."""
summary = tf.summary(value=[tf.summary.Value(tag=tag, simple_value=value) for tag, value in tag_value_pairs])
self.writer.add_summary(summary, step)
有解决这个问题的想法或建议吗?
任何帮助将不胜感激。
谢谢
【问题讨论】:
-
您确定您发布了正确的文件吗?错误是抱怨您在
list_of_scalars_summary中调用tf.value,但提供的代码正确调用tf.summary.Value -
对不起,现在我添加了从开源获得的正确文件。仍然显示相同的错误。
标签: python tensorflow deep-learning pytorch yolo