diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index 44bd92f422ab7051cbf0baa0393ea7d552d7cce9..d99e10b7ac281fd43ea7e454511cd166c6e5744f 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -2244,9 +2244,9 @@ def non_max_suppression(boxes, Prunes away boxes that have high intersection-over-union (IOU) overlap 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 - (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 algorithm is invariant to orthogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate @@ -2254,10 +2254,12 @@ def non_max_suppression(boxes, The output of this operation is a set of integers indexing into the input collection of bounding boxes representing the selected boxes. The bounding 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( boxes, scores, max_output_size, iou_threshold) selected_boxes = tf.gather(boxes, selected_indices) + ``` Args: boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`. @@ -2301,12 +2303,14 @@ def non_max_suppression_padded(boxes, 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 the `tf.slice` and `tf.gather` operations. For example: + ```python selected_indices_padded, num_valid = tf.image.non_max_suppression_padded( boxes, scores, max_output_size, iou_threshold, score_threshold, pad_to_max_output_size=True) selected_indices = tf.slice( selected_indices_padded, tf.constant([0]), num_valid) selected_boxes = tf.gather(boxes, selected_indices) + ``` Args: boxes: A 2-D float `Tensor` of shape `[num_boxes, 4]`. @@ -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 collection of bounding boxes representing the selected boxes. The bounding 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( overlaps, scores, max_output_size, iou_threshold) selected_boxes = tf.gather(boxes, selected_indices) + ``` Args: overlaps: A 2-D float `Tensor` of shape `[num_boxes, num_boxes]`.