提交 32f7033c 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

Fix tf.image.non_max_suppression docstrings.

PiperOrigin-RevId: 235541426
上级 e866995a
...@@ -2244,9 +2244,9 @@ def non_max_suppression(boxes, ...@@ -2244,9 +2244,9 @@ def non_max_suppression(boxes,
Prunes away boxes that have high intersection-over-union (IOU) overlap Prunes away boxes that have high intersection-over-union (IOU) overlap
with previously selected boxes. Bounding boxes are supplied as with previously selected boxes. Bounding boxes are supplied as
[y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the coordinates of any
diagonal pair of box corners and the coordinates can be provided as normalized diagonal pair of box corners and the coordinates can be provided as normalized
(i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm (i.e., lying in the interval `[0, 1]`) or absolute. Note that this algorithm
is agnostic to where the origin is in the coordinate system. Note that this is agnostic to where the origin is in the coordinate system. Note that this
algorithm is invariant to orthogonal transformations and translations algorithm is invariant to orthogonal transformations and translations
of the coordinate system; thus translating or reflections of the coordinate of the coordinate system; thus translating or reflections of the coordinate
...@@ -2254,10 +2254,12 @@ def non_max_suppression(boxes, ...@@ -2254,10 +2254,12 @@ def non_max_suppression(boxes,
The output of this operation is a set of integers indexing into the input The output of this operation is a set of integers indexing into the input
collection of bounding boxes representing the selected boxes. The bounding collection of bounding boxes representing the selected boxes. The bounding
box coordinates corresponding to the selected indices can then be obtained box coordinates corresponding to the selected indices can then be obtained
using the `tf.gather operation`. For example: using the `tf.gather` operation. For example:
```python
selected_indices = tf.image.non_max_suppression( selected_indices = tf.image.non_max_suppression(
boxes, scores, max_output_size, iou_threshold) boxes, scores, max_output_size, iou_threshold)
selected_boxes = tf.gather(boxes, selected_indices) selected_boxes = tf.gather(boxes, selected_indices)
```
Args: Args:
boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`. boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`.
...@@ -2301,12 +2303,14 @@ def non_max_suppression_padded(boxes, ...@@ -2301,12 +2303,14 @@ def non_max_suppression_padded(boxes,
boxes and the number of valid indices in the index set. The bounding box boxes and the number of valid indices in the index set. The bounding box
coordinates corresponding to the selected indices can then be obtained using coordinates corresponding to the selected indices can then be obtained using
the `tf.slice` and `tf.gather` operations. For example: the `tf.slice` and `tf.gather` operations. For example:
```python
selected_indices_padded, num_valid = tf.image.non_max_suppression_padded( selected_indices_padded, num_valid = tf.image.non_max_suppression_padded(
boxes, scores, max_output_size, iou_threshold, boxes, scores, max_output_size, iou_threshold,
score_threshold, pad_to_max_output_size=True) score_threshold, pad_to_max_output_size=True)
selected_indices = tf.slice( selected_indices = tf.slice(
selected_indices_padded, tf.constant([0]), num_valid) selected_indices_padded, tf.constant([0]), num_valid)
selected_boxes = tf.gather(boxes, selected_indices) selected_boxes = tf.gather(boxes, selected_indices)
```
Args: Args:
boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`. boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`.
...@@ -2355,10 +2359,12 @@ def non_max_suppression_with_overlaps(overlaps, ...@@ -2355,10 +2359,12 @@ def non_max_suppression_with_overlaps(overlaps,
The output of this operation is a set of integers indexing into the input The output of this operation is a set of integers indexing into the input
collection of bounding boxes representing the selected boxes. The bounding collection of bounding boxes representing the selected boxes. The bounding
box coordinates corresponding to the selected indices can then be obtained box coordinates corresponding to the selected indices can then be obtained
using the `tf.gather operation`. For example: using the `tf.gather` operation. For example:
```python
selected_indices = tf.image.non_max_suppression_overlaps( selected_indices = tf.image.non_max_suppression_overlaps(
overlaps, scores, max_output_size, iou_threshold) overlaps, scores, max_output_size, iou_threshold)
selected_boxes = tf.gather(boxes, selected_indices) selected_boxes = tf.gather(boxes, selected_indices)
```
Args: Args:
overlaps: A 2-D float `Tensor` of shape `[num_boxes, num_boxes]`. overlaps: A 2-D float `Tensor` of shape `[num_boxes, num_boxes]`.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册