텐서플로우:: ops:: SampleDistortedBoundingBox
#include <image_ops.h>이미지에 대해 무작위로 왜곡된 경계 상자를 하나 생성합니다.
요약
이미지 인식이나 객체 위치 파악 작업에서 정답 레이블 외에도 바운딩 박스 주석이 제공되는 경우가 많습니다. 이러한 시스템을 학습시키는 일반적인 기법은 이미지 내용을 유지하면서 무작위로 이미지를 왜곡하는 것, 즉 데이터 증강 입니다. 이 연산은 image_size , bounding_boxes 및 일련의 제약 조건이 주어지면 무작위로 왜곡된 객체 위치(바운딩 박스)를 출력합니다.
이 연산의 출력은 원본 이미지를 자르는 데 사용할 수 있는 단일 바운딩 박스입니다. 출력은 begin , size , bboxes 세 가지 텐서로 반환됩니다. 처음 두 텐서는 tf.slice 에 직접 입력하여 이미지를 자를 수 있습니다. bboxes는 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이고 경계 상자가 제공되지 않으면 오류가 발생합니다.
논거:
- 범위: Scope 객체
- 이미지 크기:
[height, width, channels]을 포함하는 1차원. - bounding_boxes: 이미지와 관련된 N개의 바운딩 박스를 설명하는
[batch, N, 4]형태의 3D 객체입니다.
선택적 속성( Attrs 참조):
- seed:
seed또는seed20이 아닌 값으로 설정되면, 지정된 시드seed사용하여 난수 생성기를 초기화합니다. 그렇지 않으면 임의의 시드를 사용합니다. - seed2: 시드 충돌을 방지하기 위한 두 번째 시드입니다.
- min_object_covered: 잘라낸 이미지 영역은 제공된 경계 상자의 최소 이 비율 이상을 포함해야 합니다. 이 매개변수 값은 음수가 아니어야 합니다. 값이 0인 경우, 잘라낸 영역은 제공된 경계 상자와 겹칠 필요가 없습니다.
- aspect_ratio_range: 잘라낸 이미지 영역의 가로세로 비율이 이 범위 내에 있어야 합니다.
- area_range: 잘라낼 이미지 영역은 제공된 이미지의 일부를 이 범위 내에 포함해야 합니다.
- max_attempts: 지정된 조건에 따라 이미지의 잘린 영역을 생성하기 위한 시도 횟수입니다.
max_attempts횟수 이상 실패하면 전체 이미지를 반환합니다. - use_image_if_no_bounding_boxes: 바운딩 박스가 제공되지 않은 경우의 동작을 제어합니다. true로 설정하면 입력 전체를 덮는 암묵적인 바운딩 박스가 있다고 가정합니다. false로 설정하면 오류를 발생시킵니다.
보고:
-
Output시작:[offset_height, offset_width, 0]포함하는 1차원.tf.slice의 입력으로 제공합니다. -
Output크기: 1차원,[target_height, target_width, -1]포함.tf.slice의 입력으로 사용하십시오. -
Outputbboxes: 왜곡된 경계 상자를 포함하는[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
공공 기능
샘플 왜곡된 경계 상자
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 )
공개 정적 함수
AreaRange
Attrs AreaRange( const gtl::ArraySlice< float > & x )
화면비 범위
Attrs AspectRatioRange( const gtl::ArraySlice< float > & x )
최대 시도 횟수
Attrs MaxAttempts( int64 x )
최소 객체 커버드
Attrs MinObjectCovered( float x )
씨앗
Attrs Seed( int64 x )
시드2
Attrs Seed2( int64 x )
경계 상자가 없으면 이미지를 사용하세요
Attrs UseImageIfNoBoundingBoxes( bool x )