Skip to content

Commit

Permalink
Update tf-metadata.json
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Aug 12, 2020
1 parent 6770556 commit fe52e74
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions src/tf-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -52431,6 +52431,94 @@
"summary": "Outputs deterministic pseudorandom random integers from a uniform distribution."
}
},
{
"name": "StatelessSampleDistortedBoundingBox",
"schema": {
"attributes": [
{
"description": "Must be one of the following: `uint8`, `int8`, `int16`, `int32`, `int64`.",
"name": "T",
"type": "type"
},
{
"description": "Must be one of the following: `int32`, `int64`.",
"name": "Tseed",
"type": "type"
},
{
"default": [
0.75,
1.3300000429153442
],
"description": "The cropped area of the image must have an aspect ratio =\nwidth / height within this range.",
"name": "aspect_ratio_range",
"type": "float32[]"
},
{
"default": [
0.05000000074505806,
1.0
],
"description": "The cropped area of the image must contain a fraction of the\nsupplied image within this range.",
"name": "area_range",
"type": "float32[]"
},
{
"default": 100,
"description": "Number of attempts at generating a cropped region of the image\nof the specified constraints. After `max_attempts` failures, return the entire\nimage.",
"name": "max_attempts",
"type": "int64"
},
{
"default": false,
"description": "Controls behavior if no bounding boxes supplied.\nIf true, assume an implicit bounding box covering the whole input. If false,\nraise an error.",
"name": "use_image_if_no_bounding_boxes",
"type": "boolean"
}
],
"description": "Bounding box annotations are often supplied in addition to ground-truth labels\nin image recognition or object localization tasks. A common technique for\ntraining such a system is to randomly distort an image while preserving its\ncontent, i.e. *data augmentation*. This Op, given the same `seed`,\ndeterministically outputs a randomly distorted localization of an object, i.e.\nbounding box, given an `image_size`, `bounding_boxes` and a series of\nconstraints.\n\nThe output of this Op is a single bounding box that may be used to crop the\noriginal image. The output is returned as 3 tensors: `begin`, `size` and\n`bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the\nimage. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize\nwhat the bounding box looks like.\n\nBounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The\nbounding box coordinates are floats in `[0.0, 1.0]` relative to the width and\nthe height of the underlying image.\n\nThe output of this Op is guaranteed to be the same given the same `seed` and is\nindependent of how many times the function is called, and independent of global\nseed settings (e.g. `tf.random.set_seed`).\n\nExample usage:\n\n>>> image = np.array([[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]])\n>>> bbox = tf.constant(\n... [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4])\n>>> seed = (1, 2)\n>>> # Generate a single distorted bounding box.\n>>> bbox_begin, bbox_size, bbox_draw = (\n... tf.image.stateless_sample_distorted_bounding_box(\n... tf.shape(image), bounding_boxes=bbox, seed=seed))\n>>> # Employ the bounding box to distort the image.\n>>> tf.slice(image, bbox_begin, bbox_size)\n<tf.Tensor: shape=(2, 2, 1), dtype=int64, numpy=\narray([[[1],\n [2]],\n [[4],\n [5]]])>\n>>> # Draw the bounding box in an image summary.\n>>> colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]])\n>>> tf.image.draw_bounding_boxes(\n... tf.expand_dims(tf.cast(image, tf.float32),0), bbox_draw, colors)\n<tf.Tensor: shape=(1, 3, 3, 1), dtype=float32, numpy=\narray([[[[1.],\n [1.],\n [3.]],\n [[1.],\n [1.],\n [6.]],\n [[7.],\n [8.],\n [9.]]]], dtype=float32)>\n\nNote that if no bounding box information is available, setting\n`use_image_if_no_bounding_boxes = true` will assume there is a single implicit\nbounding box covering the whole image. If `use_image_if_no_bounding_boxes` is\nfalse and no bounding boxes are supplied, an error is raised.",
"inputs": [
{
"description": "1-D, containing `[height, width, channels]`.",
"name": "image_size",
"typeAttr": "T"
},
{
"description": "3-D with shape `[batch, N, 4]` describing the N bounding boxes\nassociated with the image.",
"name": "bounding_boxes",
"type": 1
},
{
"description": "The cropped area of the image must contain at least this\nfraction of any bounding box supplied. The value of this parameter should be\nnon-negative. In the case of 0, the cropped area does not need to overlap\nany of the bounding boxes supplied.",
"name": "min_object_covered",
"type": 1
},
{
"description": "1-D with shape `[2]`. The seed to the random number generator. Must have dtype\n`int32` or `int64`. (When using XLA, only `int32` is allowed.)",
"name": "seed",
"typeAttr": "Tseed"
}
],
"outputs": [
{
"description": "1-D, containing `[offset_height, offset_width, 0]`. Provide as input to\n`tf.slice`.",
"name": "begin",
"typeAttr": "T"
},
{
"description": "1-D, containing `[target_height, target_width, -1]`. Provide as input to\n`tf.slice`.",
"name": "size",
"typeAttr": "T"
},
{
"description": "3-D with shape `[1, 1, 4]` containing the distorted bounding box.\nProvide as input to `tf.image.draw_bounding_boxes`.",
"name": "bboxes",
"type": 1
}
],
"summary": "Generate a randomly distorted bounding box for an image deterministically."
}
},
{
"name": "StatelessTruncatedNormal",
"schema": {
Expand Down

0 comments on commit fe52e74

Please sign in to comment.