コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テンソルフロー::作戦:: NonMaxSuppressionV5
#include <image_ops.h>
スコアの降順で境界ボックスのサブセットを貪欲に選択します。
まとめ
以前に選択したボックスと重複する交差オーバーユニオン (IOU) が高いボックスを削除します。スコアがscore_threshold
未満の境界ボックスは削除されます。境界ボックスは [y1, x1, y2, x2] として指定されます。ここで (y1, x1) と (y2, x2) はボックスの角の対角ペアの座標であり、座標は正規化されたものとして提供できます (つまり、間隔 [0, 1]) または絶対値。このアルゴリズムは、座標系の原点がどこにあるかに依存せず、より一般的には、座標系の直交変換および平行移動に対して不変であることに注意してください。したがって、座標系の変換または反映により、同じボックスがアルゴリズムによって選択されます。この操作の出力は、選択されたボックスを表す境界ボックスの入力コレクションにインデックスを付ける整数のセットです。選択したインデックスに対応する境界ボックスの座標は、 tf.gather operation
を使用して取得できます。例: selected_indices = tf.image.non_max_suppression_v2(boxes,scores,max_output_size,iou_threshold,score_threshold) selected_boxes = tf.gather(boxes, selected_indices) この演算は、Soft-NMS (ガウス重み付け付き) モードもサポートしています (Bodla et al を参照) 、 https://arxiv.org/abs/1704.04503 ) ここで、ボックスは、他の重なり合うボックスを直接枝刈りさせるのではなく、そのスコアを減らします。この Soft-NMS モードを有効にするには、 soft_nms_sigma
パラメータを 0 より大きく設定します。
引数:
- スコープ:スコープオブジェクト
- box:
[num_boxes, 4]
の形状の 2 次元浮動小数点テンソル。 - スコア: 各ボックス (ボックスの各行) に対応する単一のスコアを表す、形状
[num_boxes]
の 1 次元浮動小数点テンソル。 - max_output_size: 非最大抑制によって選択されるボックスの最大数を表すスカラー整数テンソル。
- iou_threshold: IOU に関してボックスが重なりすぎるかどうかを決定するためのしきい値を表す 0 次元浮動小数点テンソル。
- core_threshold: スコアに基づいてボックスをいつ削除するかを決定するためのしきい値を表す 0 次元の浮動小数点テンソル。
- Soft_nms_sigma: ソフト NMS のシグマ パラメーターを表す 0 次元浮動小数点テンソル。 Bodla et al ( https://arxiv.org/abs/1704.04503を参照) を参照してください。
soft_nms_sigma=0.0
(デフォルト) の場合、標準 (ハード) NMS に戻ります。
オプションの属性 ( Attrs
を参照):
- Pad_to_max_output_size: true の場合、出力
selected_indices
はmax_output_size
の長さになるようにパディングされます。デフォルトは false です。
戻り値:
-
Output
selected_indices: ボックス テンソルから選択されたインデックスを表す形状[M]
の 1 次元整数テンソル ( M <= max_output_size
。 -
Output
selected_scores: 選択された各ボックスの対応するスコアを表す形状[M]
1 次元浮動小数点数テンソル ( M <= max_output_size
。 Soft NMS を使用する場合 (つまり、 soft_nms_sigma>0
の場合)、スコアは対応する入力スコアとのみ異なります。 -
Output
valid_outputs: selected_indices
内の有効な要素の数を表す 0 次元の整数テンソル。有効な要素が最初に表示されます。
コンストラクターとデストラクター |
---|
NonMaxSuppressionV5 (const :: tensorflow::Scope & scope, :: tensorflow::Input boxes, :: tensorflow::Input scores, :: tensorflow::Input max_output_size, :: tensorflow::Input iou_threshold, :: tensorflow::Input score_threshold, :: tensorflow::Input soft_nms_sigma)
|
NonMaxSuppressionV5 (const :: tensorflow::Scope & scope, :: tensorflow::Input boxes, :: tensorflow::Input scores, :: tensorflow::Input max_output_size, :: tensorflow::Input iou_threshold, :: tensorflow::Input score_threshold, :: tensorflow::Input soft_nms_sigma, const NonMaxSuppressionV5::Attrs & attrs) |
パブリック属性
公共機能
パブリック静的関数
PadToMaxOutputSize
Attrs PadToMaxOutputSize(
bool x
)
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[],[],null,["# tensorflow::ops::NonMaxSuppressionV5 Class Reference\n\ntensorflow::ops::NonMaxSuppressionV5\n====================================\n\n`#include \u003cimage_ops.h\u003e`\n\nGreedily selects a subset of bounding boxes in descending order of score,.\n\nSummary\n-------\n\npruning away boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes with score less than `score_threshold` are removed. Bounding boxes are supplied as \\[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 is agnostic to where the origin is in the coordinate system and more generally is invariant to orthogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system result in the same boxes being selected by the algorithm. 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: selected_indices = tf.image.non_max_suppression_v2( boxes, scores, max_output_size, iou_threshold, score_threshold) selected_boxes = tf.gather(boxes, selected_indices) This op also supports a Soft-NMS (with Gaussian weighting) mode (c.f. Bodla et al, \u003chttps://arxiv.org/abs/1704.04503\u003e) where boxes reduce the score of other overlapping boxes instead of directly causing them to be pruned. To enable this Soft-NMS mode, set the `soft_nms_sigma` parameter to be larger than 0.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- boxes: A 2-D float tensor of shape `[num_boxes, 4]`.\n- scores: A 1-D float tensor of shape `[num_boxes]` representing a single score corresponding to each box (each row of boxes).\n- max_output_size: A scalar integer tensor representing the maximum number of boxes to be selected by non max suppression.\n- iou_threshold: A 0-D float tensor representing the threshold for deciding whether boxes overlap too much with respect to IOU.\n- score_threshold: A 0-D float tensor representing the threshold for deciding when to remove boxes based on score.\n- soft_nms_sigma: A 0-D float tensor representing the sigma parameter for Soft NMS; see Bodla et al (c.f. \u003chttps://arxiv.org/abs/1704.04503\u003e). When `soft_nms_sigma=0.0` (which is default), we fall back to standard (hard) NMS.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v5/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v5_1_1_attrs)):\n\n- pad_to_max_output_size: If true, the output `selected_indices` is padded to be of length `max_output_size`. Defaults to false.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) selected_indices: A 1-D integer tensor of shape `[M]` representing the selected indices from the boxes tensor, where `M \u003c= max_output_size`.\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) selected_scores: A 1-D float tensor of shape `[M]` representing the corresponding scores for each selected box, where `M \u003c= max_output_size`. Scores only differ from corresponding input scores when using Soft NMS (i.e. when `soft_nms_sigma\u003e0`)\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) valid_outputs: A 0-D integer tensor representing the number of valid elements in `selected_indices`, with the valid elements appearing first.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [NonMaxSuppressionV5](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1a58f80a7976cd835a7edb22cdfbe9d52e)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` soft_nms_sigma)` ||\n| [NonMaxSuppressionV5](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1a01252b578e820021a7bd241b40164251)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` soft_nms_sigma, const `[NonMaxSuppressionV5::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v5/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v5_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1aa96dc249a5c111b383bada5507ebf994) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [selected_indices](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1a7c287739ff4978fb784b56224b054b21) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [selected_scores](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1ab66338bc87549958c2b63ba5fd795530) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [valid_outputs](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1a4099ccdeda03b3fc9290a7391e811ace) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [PadToMaxOutputSize](#classtensorflow_1_1ops_1_1_non_max_suppression_v5_1a6f6209fd08cfd3bd97ba74954009db05)`(bool x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v5/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v5_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::NonMaxSuppressionV5::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v5/attrs) | Optional attribute setters for [NonMaxSuppressionV5](/versions/r2.0/api_docs/cc/class/tensorflow/ops/non-max-suppression-v5#classtensorflow_1_1ops_1_1_non_max_suppression_v5). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### selected_indices\n\n```scdoc\n::tensorflow::Output selected_indices\n``` \n\n### selected_scores\n\n```scdoc\n::tensorflow::Output selected_scores\n``` \n\n### valid_outputs\n\n```scdoc\n::tensorflow::Output valid_outputs\n``` \n\nPublic functions\n----------------\n\n### NonMaxSuppressionV5\n\n```gdscript\n NonMaxSuppressionV5(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input boxes,\n ::tensorflow::Input scores,\n ::tensorflow::Input max_output_size,\n ::tensorflow::Input iou_threshold,\n ::tensorflow::Input score_threshold,\n ::tensorflow::Input soft_nms_sigma\n)\n``` \n\n### NonMaxSuppressionV5\n\n```gdscript\n NonMaxSuppressionV5(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input boxes,\n ::tensorflow::Input scores,\n ::tensorflow::Input max_output_size,\n ::tensorflow::Input iou_threshold,\n ::tensorflow::Input score_threshold,\n ::tensorflow::Input soft_nms_sigma,\n const NonMaxSuppressionV5::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### PadToMaxOutputSize\n\n```text\nAttrs PadToMaxOutputSize(\n bool x\n)\n```"]]