SampleDistortedBoundingBox

パブリック最終クラスSampleDistortedBoundingBox

画像に対してランダムに歪んだ単一の境界ボックスを生成します。

多くの場合、境界ボックスの注釈は、画像認識タスクやオブジェクト位置特定タスクでグラウンドトゥルース ラベルに加えて提供されます。このようなシステムをトレーニングするための一般的な手法は、コンテンツを維持しながら画像をランダムに歪ませる、つまりデータ拡張です。この Op は、「image_size」、「bounding_boxes」、および一連の制約を指定して、ランダムに歪んだオブジェクトの位置、つまりバウンディング ボックスを出力します。

この Op の出力は、元の画像をトリミングするために使用できる単一の境界ボックスです。出力は、`begin`、`size`、および `bboxes` の 3 つのテンソルとして返されます。最初の 2 つのテンソルをtf.sliceに直接入力して画像をトリミングできます。後者は、境界ボックスがどのように見えるかを視覚化するためにtf.image.draw_bounding_boxesに指定できます。

境界ボックスは `[y_min, x_min, y_max, x_max]` として指定され、返されます。境界ボックスの座標は、下にある画像の幅と高さを基準とした `[0.0, 1.0]` の浮動小数点数です。

例:

# Generate a single distorted bounding box.
     begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box(
         tf.shape(image),
         bounding_boxes=bounding_boxes)
 
     # Draw the bounding box in an image summary.
     image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0),
                                                   bbox_for_draw)
     tf.summary.image('images_with_box', image_with_box)
 
     # Employ the bounding box to distort the image.
     distorted_image = tf.slice(image, begin, size)
 
境界ボックス情報が利用できない場合、「use_image_if_no_bounding_boxes = true」を設定すると、画像全体をカバーする単一の暗黙的な境界ボックスがあると想定されることに注意してください。 `use_image_if_no_bounding_boxes` が false で、境界ボックスが指定されていない場合、エラーが発生します。

ネストされたクラス

クラスSampleDistortedBoundingBox.Options SampleDistortedBoundingBoxのオプションの属性

定数

OP_NAME TensorFlow コア エンジンによって認識される、この演算の名前

パブリックメソッド

静的SampleDistortedBoundingBox.Options
areaRange (List<Float> areaRange)
静的SampleDistortedBoundingBox.Options
アスペクト比範囲(List<Float> アスペクト比範囲)
出力< TFloat32 >
bbox ()
歪んだ境界ボックスを含む形状 `[1, 1, 4]` の 3-D。
出力<T>
始める()
1-D、`[offset_height, offset_width, 0]` を含みます。
static <T extends TNumber > SampleDistortedBoundingBox <T>
create (スコープscope、オペランド<T>imageSize、オペランド<TFloat32> boundingBoxes、オペランド<TFloat32> minObjectCovered、オプション...オプション)
新しい SampleDistortedBoundingBox オペレーションをラップするクラスを作成するファクトリ メソッド。
静的SampleDistortedBoundingBox.Options
maxAttempts (長い maxAttempts)
静的SampleDistortedBoundingBox.Options
種子(長い種子)
静的SampleDistortedBoundingBox.Options
シード2 (ロングシード2)
出力<T>
サイズ()
1-D、`[target_height, target_width, -1]` を含みます。
静的SampleDistortedBoundingBox.Options
useImageIfNoBoundingBoxes (ブール型 useImageIfNoBoundingBoxes)

継承されたメソッド

定数

パブリック静的最終文字列OP_NAME

TensorFlow コア エンジンによって認識される、この演算の名前

定数値: "SampleDistortedBoundingBoxV2"

パブリックメソッド

public static SampleDistortedBoundingBox.Options areaRange (List<Float> areaRange)

パラメーター
エリア範囲画像のトリミングされた領域には、この範囲内の指定された画像の一部が含まれている必要があります。

public static SampleDistortedBoundingBox.Optionsアスペクト比範囲(List<Float> アスペクト比範囲)

パラメーター
アスペクト比範囲画像のトリミングされた領域のアスペクト比 = 幅 / 高さがこの範囲内である必要があります。

public Output < TFloat32 > bboxes ()

歪んだ境界ボックスを含む形状 `[1, 1, 4]` の 3-D。 tf.image.draw_bounding_boxesへの入力として提供します。

public出力<T> begin ()

1-D、`[offset_height, offset_width, 0]` を含みます。 tf.sliceへの入力として提供します。

public static SampleDistortedBoundingBox <T> create (スコープscope、オペランド<T>imageSize、オペランド<TFloat32> boundingBoxes、オペランド<TFloat32> minObjectCovered、オプション...オプション)

新しい SampleDistortedBoundingBox オペレーションをラップするクラスを作成するファクトリ メソッド。

パラメーター
範囲現在のスコープ
画像サイズ1-D、`[高さ、幅、チャネル]` を含みます。
境界ボックス画像に関連付けられた N 個の境界ボックスを表す形状 `[batch, N, 4]` を持つ 3-D。
minObjectCovered画像のトリミングされた領域には、指定された境界ボックスの少なくともこの部分が含まれている必要があります。このパラメータの値は負ではない必要があります。 0 の場合、トリミングされた領域は、指定された境界ボックスのいずれとも重なる必要はありません。
オプションオプションの属性値を持ちます
戻り値
  • SampleDistortedBoundingBox の新しいインスタンス

public static SampleDistortedBoundingBox.Options maxAttempts (Long maxAttempts)

パラメーター
最大試行数指定された制約のイメージのトリミングされた領域の生成を試行する回数。 `max_attempts` が失敗した後、画像全体を返します。

public static SampleDistortedBoundingBox.Optionsシード(長いシード)

パラメーター
シード`seed` または `seed2` のいずれかが 0 以外に設定されている場合、乱数発生器には指定された `seed` がシードされます。それ以外の場合は、ランダム シードによってシードされます。

public static SampleDistortedBoundingBox.Optionsシード 2 (ロング シード 2)

パラメーター
シード2シードの衝突を避けるための 2 番目のシード。

public出力<T>サイズ()

1-D、`[target_height, target_width, -1]` を含みます。 tf.sliceへの入力として提供します。

public static SampleDistortedBoundingBox.Options useImageIfNoBoundingBoxes (Boolean useImageIfNoBoundingBoxes)

パラメーター
useImageIfNoBoundingBoxes境界ボックスが指定されていない場合の動作を制御します。 true の場合、入力全体をカバーする暗黙的な境界ボックスがあると見なされます。 false の場合、エラーが発生します。