TensorFlow 训练过程中的错误提示 maximum box coordinate value is larger than

TensorFlow 训练过程中的错误提示 maximum box coordinate value is larger than

flyfish

环境
TensorFlow 版本 1.14
错误提示如下

global step 3164090: loss = 0.01720 (0.0187 sec/step)
INFO:tensorflow:Error reported to Coordinator: , 2 root error(s) found.
  (0) Invalid argument: assertion failed: [maximum box coordinate value is larger than 1.100000: ] [1.16171622]
	 [[node Loss/ToAbsoluteCoordinates/Assert/AssertGuard/Assert (defined at /models/research/object_detection/core/box_list_ops.py:839) ]]

错误原因如下

产生断言的位置是
文件路径

models/research/object_detection/core/box_list_ops.py

代码行号 839

if check_range:
  box_maximum = tf.reduce_max(boxlist.get())
  max_assert = tf.Assert(
      tf.greater_equal(maximum_normalized_coordinate, box_maximum),
      ['maximum box coordinate value is larger '
       'than %f: ' % maximum_normalized_coordinate, box_maximum])
  with tf.control_dependencies([max_assert]):
    width = tf.identity(width)

return scale(boxlist, height, width)

注释上写的Ensure range of input boxes is correct
也就是我们输入边框的范围不正确导致了断言

在做我们的数据集的时候,我需要知道以下信息

数据集的图片文件是JPEG或者PNG格式的
边界框的坐标由4个浮点数定义[YMIN,XMIN,YMAX,XMAX],坐标开始于左上角.
制作TFRecord数据集的时候,会将坐标归一化,归一化坐标是(x /宽度,Y /高度)
这就是我们会在转换TF格式文件中看到这样的代码原因

xmin.append(float(obj['bndbox']['xmin']) / width)
ymin.append(float(obj['bndbox']['ymin']) / height)
xmax.append(float(obj['bndbox']['xmax']) / width)
ymax.append(float(obj['bndbox']['ymax']) / height)

假设 x,y是左上角的坐标
那原始数据是这样的

xmin = x
ymin = y
xmax = x + width
ymax = y + height

归一化的数据是这样的

xmin = x / image_width
ymin = y / image_height
xmax = (x + width) / image_width
ymax = (y + height) / image_height

原文是这样

An RGB image for the dataset encoded as jpeg or png. A list of
bounding boxes for the image. Each bounding box should contain:

A bounding box coordinates (with origin in top left corner) defined by
4 floating point numbers [ymin, xmin, ymax, xmax]. Note that we store
the normalized coordinates (x / width, y / height) in the TFRecord
dataset. The class of the object in the bounding box

该问题在以下issue 有讨论
issue5474

issue1754

你可能感兴趣的:(深度学习)