UNPKG

2.03 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 Google LLC. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17/// <amd-module name="@tensorflow/tfjs-core/dist/ops/image/non_max_suppression" />
18import { Tensor1D, Tensor2D } from '../../tensor';
19import { TensorLike } from '../../types';
20/**
21 * Performs non maximum suppression of bounding boxes based on
22 * iou (intersection over union).
23 *
24 * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is
25 * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of
26 * the bounding box.
27 * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.
28 * @param maxOutputSize The maximum number of boxes to be selected.
29 * @param iouThreshold A float representing the threshold for deciding whether
30 * boxes overlap too much with respect to IOU. Must be between [0, 1].
31 * Defaults to 0.5 (50% box overlap).
32 * @param scoreThreshold A threshold for deciding when to remove boxes based
33 * on score. Defaults to -inf, which means any score is accepted.
34 * @return A 1D tensor with the selected box indices.
35 *
36 * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}
37 */
38declare function nonMaxSuppression_(boxes: Tensor2D | TensorLike, scores: Tensor1D | TensorLike, maxOutputSize: number, iouThreshold?: number, scoreThreshold?: number): Tensor1D;
39export declare const nonMaxSuppression: typeof nonMaxSuppression_;
40export {};