2017-11-20 2 views
-1

tf.image.sample_distorted_bounding_box関数を使用して、より多くのオブジェクト検出トレーニングデータを作成するために、既存のラベル付きバウンディングボックスイメージを拡張しようとしていますが、これらのエラーが発生し続けていますhere。境界ボックスを描画するときに境界ボックスが正しく設定されていることがわかります。tf.image.sample_distorted_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 = 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. 

ここで間違っていることについてのご意見はありますか?

答えて

0

私は、関数へのその引数を明示的に指定しないテストは表示されないので、これがsample_distorted_bounding_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) 

https://github.com/tensorflow/models/blob/master/research/inception/inception/image_processing.py#L235

+0

バックこれが働いた[3]の要素へ画像を変換した後。コードが更新されました(https://github.com/wagonhelm/image_augment/blob/master/DataAug.ipynb)。ありがとう! –

+0

[3]要素はどういう意味ですか?あなたのリンクは404を与えます:( – snazziii