텐서플로우:: 작전:: 샘플왜곡된BoundingBox

#include <image_ops.h>

이미지에 대해 무작위로 왜곡된 단일 경계 상자를 생성합니다.

요약

경계 상자 주석은 이미지 인식이나 객체 위치 파악 작업에서 실측 라벨과 함께 제공되는 경우가 많습니다. 이러한 시스템을 훈련하는 일반적인 기술은 콘텐츠를 보존하면서 이미지를 무작위로 왜곡하는 것, 즉 데이터 증대 입니다. 이 작업은 image_size , bounding_boxes 및 일련의 제약 조건을 고려하여 객체(예: 경계 상자)의 무작위로 왜곡된 지역화를 출력합니다.

이 작업의 출력은 원본 이미지를 자르는 데 사용할 수 있는 단일 경계 상자입니다. 출력은 3개의 텐서( begin , sizebboxes 로 반환됩니다. 처음 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이고 경계 상자가 제공되지 않으면 오류가 발생합니다.

인수:

  • 범위: 범위 개체
  • image_size: 1-D, [height, width, channels] 포함.
  • bounding_boxes: 이미지와 연관된 N개의 경계 상자를 설명하는 [batch, N, 4] 모양의 3D입니다.

선택적 속성( Attrs 참조):

  • Seed: seed 또는 seed2 0이 아닌 값으로 설정된 경우 난수 생성기는 지정된 seed 에 의해 시드됩니다. 그렇지 않으면 무작위 시드에 의해 시드됩니다.
  • Seed2: 시드 충돌을 피하기 위한 두 번째 시드입니다.
  • min_object_covered: 이미지의 잘린 영역에는 제공된 경계 상자 중 최소한 이 부분이 포함되어야 합니다. 이 매개변수의 값은 음수가 아니어야 합니다. 0인 경우 잘린 영역은 제공된 경계 상자와 겹칠 필요가 없습니다.
  • 양상_비율_범위: 이미지의 잘린 영역은 이 범위 내에서 가로/세로 비율 = 너비/높이를 가져야 합니다.
  • Area_range: 이미지의 잘린 영역에는 이 범위 내에서 제공된 이미지의 일부가 포함되어야 합니다.
  • max_attempts: 지정된 제약 조건에 따라 이미지의 잘린 영역을 생성하려는 시도 횟수입니다. max_attempts 실패 후 전체 이미지를 반환합니다.
  • use_image_if_no_bounding_boxes: 경계 상자가 제공되지 않은 경우 동작을 제어합니다. true인 경우 전체 입력을 포함하는 암시적 경계 상자를 가정합니다. 거짓이면 오류를 발생시킵니다.

보고:

  • Output 시작: [offset_height, offset_width, 0] 포함하는 1-D. tf.slice 에 입력으로 제공합니다.
  • Output 크기: 1차원, [target_height, target_width, -1] 포함. tf.slice 에 입력으로 제공합니다.
  • Output bbox: 왜곡된 경계 상자를 포함하는 [1, 1, 4] 모양의 3D. tf.image.draw_bounding_boxes 에 입력으로 제공하세요.

생성자와 소멸자

SampleDistortedBoundingBox (const :: tensorflow::Scope & scope, :: tensorflow::Input image_size, :: tensorflow::Input bounding_boxes)
SampleDistortedBoundingBox (const :: tensorflow::Scope & scope, :: tensorflow::Input image_size, :: tensorflow::Input bounding_boxes, const SampleDistortedBoundingBox::Attrs & attrs)

공개 속성

bboxes
begin
operation
size

공개 정적 함수

AreaRange (const gtl::ArraySlice< float > & x)
AspectRatioRange (const gtl::ArraySlice< float > & x)
MaxAttempts (int64 x)
MinObjectCovered (float x)
Seed (int64 x)
Seed2 (int64 x)
UseImageIfNoBoundingBoxes (bool x)

구조체

텐서플로우:: ops:: SampleDistortedBoundingBox:: Attrs

SampleDistortedBoundingBox 에 대한 선택적 속성 설정자입니다.

공개 속성

비박스

::tensorflow::Output bboxes

시작하다

::tensorflow::Output begin

작업

Operation operation

크기

::tensorflow::Output size

공공 기능

샘플왜곡된BoundingBox

 SampleDistortedBoundingBox(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input image_size,
  ::tensorflow::Input bounding_boxes
)

샘플왜곡된BoundingBox

 SampleDistortedBoundingBox(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input image_size,
  ::tensorflow::Input bounding_boxes,
  const SampleDistortedBoundingBox::Attrs & attrs
)

공개 정적 함수

면적범위

Attrs AreaRange(
  const gtl::ArraySlice< float > & x
)

종횡비 범위

Attrs AspectRatioRange(
  const gtl::ArraySlice< float > & x
)

최대 시도 횟수

Attrs MaxAttempts(
  int64 x
)

MinObjectCovered

Attrs MinObjectCovered(
  float x
)

씨앗

Attrs Seed(
  int64 x
)

시드2

Attrs Seed2(
  int64 x
)

UseImageIfNoBoundingBoxes

Attrs UseImageIfNoBoundingBoxes(
  bool x
)