Tensorflow tf.image.sample\u扭曲\u边框值错误

Tensorflow tf.image.sample\u扭曲\u边框值错误,tensorflow,bounding-box,valueerror,Tensorflow,Bounding Box,Valueerror,我正在尝试使用该函数扩充现有的带标签的边界框图像,以便生成更多的对象检测训练数据,但我不断发现这些错误。我非常确定我的边界框设置正确,因为它在我绘制边界框时起作用 img = mpimg.imread('bPawn0.jpg') img = img.reshape(1,300,300,3) boxes = [100,88,253,209] box = np.ones([1,1,4]) for i in range(4): box[:,:,i] = boxes[i]/300 box = t

我正在尝试使用该函数扩充现有的带标签的边界框图像,以便生成更多的对象检测训练数据,但我不断发现这些错误。我非常确定我的边界框设置正确,因为它在我绘制边界框时起作用

img = mpimg.imread('bPawn0.jpg')
img = img.reshape(1,300,300,3)
boxes = [100,88,253,209]
box = np.ones([1,1,4])
for i in range(4):
    box[:,:,i] = boxes[i]/300
box = tf.convert_to_tensor(box, np.float32)

begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box(tf.shape(img),bounding_boxes=box)

ValueError: Tried to convert 'min_object_covered' to a tensor and failed. Error: None values not supported.

关于我在这里做错了什么,有什么建议吗?

我想知道这是否是示例\u扭曲的\u边界\u box()代码中的错误,因为我没有看到一个测试没有显式地将该参数指定给函数

你能不能试着明确地设置这个参数,像这样

sample_distorted_bounding_box = tf.image.sample_distorted_bounding_box(
    tf.shape(image),
    bounding_boxes=bbox,
    min_object_covered=0.1,
    aspect_ratio_range=[0.75, 1.33],
    area_range=[0.05, 1.0],
    max_attempts=100,
    use_image_if_no_bounding_boxes=True)

将图像转换回[3]个元素后,此操作有效。代码已更新。谢谢你所说的[3]元素是什么意思?您的链接提供404:(