Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
aliran tensor:: operasi:: NonMaxSuppressionV4
#include <image_ops.h>
Dengan rakus memilih subset kotak pembatas dalam urutan skor yang menurun.
Ringkasan
memangkas kotak-kotak yang memiliki interseksi-over-union (IOU) tinggi yang tumpang tindih dengan kotak-kotak yang dipilih sebelumnya. Kotak pembatas dengan skor kurang dari score_threshold
akan dihapus. Kotak pembatas diberikan sebagai [y1, x1, y2, x2], di mana (y1, x1) dan (y2, x2) adalah koordinat dari setiap pasangan sudut kotak diagonal dan koordinat dapat diberikan sebagai dinormalisasi (yaitu, terletak di interval [0, 1]) atau absolut. Perhatikan bahwa algoritme ini agnostik terhadap titik asal dalam sistem koordinat dan lebih umum lagi invarian terhadap transformasi ortogonal dan terjemahan sistem koordinat; sehingga penerjemahan atau refleksi dari sistem koordinat menghasilkan kotak yang sama yang dipilih oleh algoritma. Output dari operasi ini adalah sekumpulan bilangan bulat yang diindeks ke dalam kumpulan input kotak pembatas yang mewakili kotak yang dipilih. Koordinat kotak pembatas yang sesuai dengan indeks yang dipilih kemudian dapat diperoleh dengan menggunakan tf.gather operation
. Misalnya: indeks_yang dipilih = tf.image.non_max_suppression_v2( kotak, skor, max_output_size, iou_threshold, skor_threshold) kotak_pilihan = tf.gather(kotak, indeks_yang dipilih)
Argumen:
- ruang lingkup: Objek Lingkup
- kotak: Tensor float 2-D dengan bentuk
[num_boxes, 4]
. - skor: Tensor float 1-D berbentuk
[num_boxes]
yang mewakili satu skor yang sesuai dengan setiap kotak (setiap baris kotak). - max_output_size: Tensor bilangan bulat skalar yang mewakili jumlah maksimum kotak yang akan dipilih dengan penekanan non-maks.
- iou_threshold: Tensor float 0-D yang mewakili ambang batas untuk memutuskan apakah kotak terlalu banyak tumpang tindih sehubungan dengan IOU.
- score_threshold: Tensor float 0-D yang mewakili ambang batas untuk memutuskan kapan harus menghapus kotak berdasarkan skor.
Atribut opsional (lihat Attrs
):
- pad_to_max_output_size: Jika benar, output
selected_indices
diisi dengan panjang max_output_size
. Defaultnya salah.
Pengembalian:
-
Output
indeks_yang dipilih: Tensor bilangan bulat 1-D berbentuk [M]
yang mewakili indeks yang dipilih dari tensor kotak, dengan M <= max_output_size
. -
Output
valid_outputs: Tensor bilangan bulat 0-D yang mewakili jumlah elemen valid selected_indices
, dengan elemen valid muncul terlebih dahulu.
Konstruktor dan Destruktor |
---|
NonMaxSuppressionV4 (const :: tensorflow::Scope & scope, :: tensorflow::Input boxes, :: tensorflow::Input scores, :: tensorflow::Input max_output_size, :: tensorflow::Input iou_threshold, :: tensorflow::Input score_threshold)
|
NonMaxSuppressionV4 (const :: tensorflow::Scope & scope, :: tensorflow::Input boxes, :: tensorflow::Input scores, :: tensorflow::Input max_output_size, :: tensorflow::Input iou_threshold, :: tensorflow::Input score_threshold, const NonMaxSuppressionV4::Attrs & attrs) |
Atribut publik
Fungsi publik
Fungsi statis publik
Ukuran Output PadToMax
Attrs PadToMaxOutputSize(
bool x
)
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::NonMaxSuppressionV4 Class Reference\n\ntensorflow::ops::NonMaxSuppressionV4\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)\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/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\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v4/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v4_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.1/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.1/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| [NonMaxSuppressionV4](#classtensorflow_1_1ops_1_1_non_max_suppression_v4_1ac241f89469a7188f8d9b5c0daa2441f4)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold)` ||\n| [NonMaxSuppressionV4](#classtensorflow_1_1ops_1_1_non_max_suppression_v4_1afc8c9e7cedb3678900fa3bcf995aee11)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, const `[NonMaxSuppressionV4::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v4/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v4_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_non_max_suppression_v4_1a68c64a50fa3dd5b983f6e09e61b92eab) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [selected_indices](#classtensorflow_1_1ops_1_1_non_max_suppression_v4_1a3f301cbbf0cd3b82a64c243b1e357fa6) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [valid_outputs](#classtensorflow_1_1ops_1_1_non_max_suppression_v4_1a47653a5cde7a40dd1801dfc699e2f429) | `::`[tensorflow::Output](/versions/r2.1/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_v4_1a67d61f68bcfca71cdf3f27c979f2ecd2)`(bool x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v4/attrs#structtensorflow_1_1ops_1_1_non_max_suppression_v4_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::NonMaxSuppressionV4::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v4/attrs) | Optional attribute setters for [NonMaxSuppressionV4](/versions/r2.1/api_docs/cc/class/tensorflow/ops/non-max-suppression-v4#classtensorflow_1_1ops_1_1_non_max_suppression_v4). |\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### valid_outputs\n\n```scdoc\n::tensorflow::Output valid_outputs\n``` \n\nPublic functions\n----------------\n\n### NonMaxSuppressionV4\n\n```gdscript\n NonMaxSuppressionV4(\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)\n``` \n\n### NonMaxSuppressionV4\n\n```gdscript\n NonMaxSuppressionV4(\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 const NonMaxSuppressionV4::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### PadToMaxOutputSize\n\n```text\nAttrs PadToMaxOutputSize(\n bool x\n)\n```"]]