Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
198 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...