问题
I am trying to augment existing labeled bounding boxed image for making more object detection training data using the function tf.image.sample_distorted_bounding_box but I keep getting these errors found here. I'm pretty sure my bounding box is set correctly because it works when I draw the bounding box.
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.
Any suggestions as to what I am doing wrong here?
回答1:
I'm wondering if this is a bug in the sample_distorted_bounding_box() code, since I don't see a test that doesn't specify that argument to the function explicitly.
Can you try setting that argument explicitly, something like this?
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)
https://github.com/tensorflow/models/blob/master/research/inception/inception/image_processing.py#L235
来源:https://stackoverflow.com/questions/47402896/tf-image-sample-distorted-bounding-box-valueerror