Google I/O에 참여해 주셔서 감사합니다. 주문형 모든 세션 보기 주문형 시청

tensorflow :: ops :: SampleDistortedBoundingBoxV2

#include <image_ops.h>

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

요약

경계 상자 주석은 종종 이미지 인식 또는 객체 위치 파악 작업에서 실측 레이블과 함께 제공됩니다. 이러한 시스템을 훈련하는 일반적인 기술은 이미지를 무작위로 왜곡하면서 콘텐츠를 보존하는 것, 즉 데이터 증가 입니다. 이 Op는 image_size , bounding_boxes 및 일련의 제약 조건이 주어지면 개체, 즉 경계 상자의 무작위로 왜곡 된 지역화를 출력합니다.

이 Op의 출력은 원본 이미지를 자르는 데 사용할 수있는 단일 경계 상자입니다. 출력은 begin , sizebboxes 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이고 경계 상자가 제공되지 않으면 오류가 발생합니다.

인수 :

  • 범위 : 범위 개체
  • image_size : 1-D, [height, width, channels] .
  • bounding_boxes : 이미지와 관련된 N 개의 경계 상자를 설명하는 [batch, N, 4] 모양의 3 차원.
  • min_object_covered : 이미지의 잘린 영역에는 제공된 경계 상자의이 비율 이상이 포함되어야합니다. 이 매개 변수의 값은 음수가 아니어야합니다. 0의 경우 잘린 영역이 제공된 경계 상자와 겹칠 필요가 없습니다.

선택적 속성 ( Attrs 참조) :

  • seed : seed 또는 seed2 가 0이 아닌 값으로 설정된 경우, 난수 생성기는 주어진 seed 의해 seed 됩니다. 그렇지 않으면 임의의 시드로 시드됩니다.
  • seed2 : 시드 충돌을 피하기위한 두 번째 시드.
  • aspect_ratio_range : 이미지의 잘린 영역은이 범위 내에서 가로 세로 비율 = 너비 / 높이를 가져야합니다.
  • area_range : 이미지의 잘린 영역은이 범위 내에서 제공된 이미지의 일부를 포함해야합니다.
  • max_attempts : 지정된 제약 조건의 이미지에서 잘린 영역을 생성하려는 시도 횟수입니다. max_attempts 실패 후 전체 이미지를 반환합니다.
  • use_image_if_no_bounding_boxes : 경계 상자가 제공되지 않은 경우 동작을 제어합니다. 참이면 전체 입력을 덮는 암시 적 경계 상자를 가정합니다. 거짓이면 오류를 발생시킵니다.

보고:

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

생성자와 소멸자

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

공용 속성

bboxes
begin
operation
size

공개 정적 함수

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

구조체

tensorflow :: ops :: SampleDistortedBoundingBoxV2 :: 속성

SampleDistortedBoundingBoxV2의 선택적 속성 setter입니다.

공용 속성

bbox

::tensorflow::Output bboxes

시작하다

::tensorflow::Output begin

조작

Operation operation

크기

::tensorflow::Output size

공공 기능

SampleDistortedBoundingBoxV2

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

SampleDistortedBoundingBoxV2

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

공개 정적 함수

AreaRange

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

AspectRatioRange

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

MaxAttempts

Attrs MaxAttempts(
  int64 x
)

Attrs Seed(
  int64 x
)

Seed2

Attrs Seed2(
  int64 x
)

UseImageIfNoBoundingBoxes

Attrs UseImageIfNoBoundingBoxes(
  bool x
)