T 7

作者: sumpig | 来源:发表于2019-02-01 11:41 被阅读0次

tf.image.flip_up_down

  • 用法
flip_up_down(
    image
)
  • 示例
flipped = tf.image.flip_up_down(img_data)
  • tf.image.flip_left_right
  • tf.image.transpose_image
  • tf.image.random_flip_up_down
  • tf.image.random_flip_left_right

tf.image.adjust_brightness

  • 用法
adjust_brightness(
    image,
    delta
)

delta: 亮度增加的值;

  • 示例
adjusted = tf.image.adjust_brightness(img_data, -0.5)
  • tf.image.random_brightness
  • tf.image.adjust_contrast
  • tf.image.random_contrast
  • tf.image.adjust_hue
  • tf.image.random_hue
  • tf.image.adjust_saturation
  • tf.image.random_saturation
  • tf.image.per_image_standardization

tf.expend_dims

  • 用法
expend_dims(
    input,
    axis=None,
    name=None,
    dim=None
)
  • 示例
tf.shape(tf.expand_dims(t, 0))  # [1, 2]
tf.shape(tf.expand_dims(t, 1))  # [2, 1]
tf.shape(tf.expand_dims(t, -1))  # [2, 1]

# 't2' is a tensor of shape [2, 3, 5]
tf.shape(tf.expand_dims(t2, 0))  # [1, 2, 3, 5]
tf.shape(tf.expand_dims(t2, 2))  # [2, 3, 1, 5]
tf.shape(tf.expand_dims(t2, 3))  # [2, 3, 5, 1]

tf.image.draw_bounding_boxes

  • 用法
tf.image.draw_bounding_boxes
    images,
    boxes,
    name=None
)

images: 必须是实数类型,4-D [batch, height, width, depth];
boxes: 3-D[batch, num_bounding_boxes, 4];

  • 示例
boxes = tf.constant([[[0.05, 0.05, 0.9, 0.7], [0.35, 0.47, 0.5, 0.56]]])
batched = tf.expand_dims(
    tf.image.convert_image_dtype(img_data, tf.float32), 0)
result = tf.image.draw_bounding_boxes(batched, boxes)
  • tf.image.sample_distorted_bounding_box
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
)

image_size: 1-D,[height, width, channels];
bounding_boxes: 3-D,[batch, N, 4];
min_object_covered: 截取比例;

  • 示例
begin, size, bboxes = tf.image.sample_distorted_bounding_box(
    tf.shape(img_data), bounding_boxes=boxes,
    min_object_covered=0.4)

begin: 1-D,[offset_height, offset_width, 0];
size: 1-D,[target_height, target_width, -1];
bboxes: 3-D,[1, 1, 4]边界框;


tf.clip_by_value

  • 用法
clip_by_value(
    t,
    clip_value_min,
    clip_value_max,
    name=None
)
  • 示例
adjusted = tf.clip_by_value(image, 0.0, 1.0)

相关文章

网友评论

      本文标题:T 7

      本文链接:https://www.haomeiwen.com/subject/rrnrsqtx.html