W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
tf.image.sample_distorted_bounding_box(
image_size,
bounding_boxes,
seed=None,
seed2=None,
min_object_covered=0.1,
aspect_ratio_range=None,
area_range=None,
max_attempts=None,
use_image_if_no_bounding_boxes=None,
name=None
)
定義在:tensorflow/python/ops/image_ops_impl.py.
請(qǐng)參閱指南:圖像操作>圖像使用邊框
為圖像生成一個(gè)隨機(jī)扭曲的邊界框.
在圖像識(shí)別或?qū)ο蠖ㄎ蝗蝿?wù)中,除了ground-truth標(biāo)簽外,通常還會(huì)提供邊界框注釋.訓(xùn)練這種系統(tǒng)的一種常用技術(shù)是隨機(jī)地扭曲圖像,同時(shí)保留其內(nèi)容,即數(shù)據(jù)增強(qiáng).這個(gè)運(yùn)算輸出中的對(duì)象的隨機(jī)扭曲的定位,即邊界框,給定一個(gè)image_size,bounding_boxes和一系列的限制.
該操作的輸出是一個(gè)可用于裁剪原始圖像的單個(gè)邊界框.輸出返回為3個(gè)張量:begin,size和bboxes.前兩個(gè)張可直接送入tf.slice以裁剪圖像.可以提供后者tf.image.draw_bounding_boxes以可視化邊界框的外觀.
邊界框被提供并作為[y_min, x_min, y_max, x_max]返回.邊界框坐標(biāo)在[0.0, 1.0]相對(duì)于底層圖像的寬度和高度的浮點(diǎn)數(shù).
例如:
# Generate a single distorted bounding box.
begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box(
tf.shape(image),
bounding_boxes=bounding_boxes,
min_object_covered=0.1)
# 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)
請(qǐng)注意,如果沒(méi)有邊界框信息可用,則設(shè)置use_image_if_no_bounding_boxes=true將假定存在覆蓋整個(gè)圖像的單個(gè)隱式邊界框.如果use_image_if_no_bounding_boxes為false并且沒(méi)有提供邊界框,則會(huì)引發(fā)錯(cuò)誤.
Tensor對(duì)象的元型態(tài)組(begin, size, bboxes).
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: