Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
przepływ tensorowy:: ops:: NonMaxSuppressionV5
#include <image_ops.h>
Chciwie wybiera podzbiór obwiedni w malejącej kolejności punktów.
Streszczenie
przycinanie pudełek, które mają wysoki współczynnik przecięcia nad związkiem (IOU), nakładają się na wcześniej wybrane pola. Ramki ograniczające z wynikiem mniejszym niż score_threshold
są usuwane. Ramki ograniczające są dostarczane jako [y1, x1, y2, x2], gdzie (y1, x1) i (y2, x2) są współrzędnymi dowolnej pary przekątnych narożników prostokątów, a współrzędne mogą być podane jako znormalizowane (tzn. leżące w przedział [0, 1]) lub bezwzględny. Należy zauważyć, że ten algorytm jest niezależny od tego, gdzie początek znajduje się w układzie współrzędnych i, bardziej ogólnie, jest niezmienny w stosunku do transformacji ortogonalnych i translacji układu współrzędnych; w ten sposób tłumaczenie lub odbicia układu współrzędnych powodują, że algorytm wybiera te same pola. Wynikiem tej operacji jest zbiór liczb całkowitych indeksowanych w zbiorze wejściowym ramek ograniczających reprezentujących wybrane ramki. Współrzędne ramki ograniczającej odpowiadające wybranym indeksom można następnie uzyskać za pomocą tf.gather operation
. Na przykład: wybrane_indices = tf.image.non_max_suppression_v2(boxs, scores, max_output_size, iou_threshold, score_threshold) wybrane_boxes = tf.gather(boxes, wybrane_indices) Ta opcja obsługuje również tryb Soft-NMS (z ważeniem Gaussa) (por. Bodla i in. , https://arxiv.org/abs/1704.04503 ), gdzie pola zmniejszają wynik innych nakładających się pól, zamiast bezpośrednio powodować ich przycinanie. Aby włączyć ten tryb Soft-NMS, ustaw parametr soft_nms_sigma
na większy niż 0.
Argumenty:
- zakres: Obiekt Scope
- boxy: Dwuwymiarowy tensor zmiennoprzecinkowy kształtu
[num_boxes, 4]
. - wyniki: 1-D tensor zmiennoprzecinkowy o kształcie
[num_boxes]
reprezentujący pojedynczy wynik odpowiadający każdemu prostokątowi (każdemu rzędowi pól). - max_output_size: Skalarny tensor będący liczbą całkowitą reprezentujący maksymalną liczbę pól do wybrania w wyniku tłumienia innego niż maksymalne.
- iou_threshold: Tensor zmiennoprzecinkowy 0-D reprezentujący próg decydujący o tym, czy pola nakładają się zbytnio na IOU.
- score_threshold: Tensor zmiennoprzecinkowy 0-D reprezentujący próg decydujący o tym, kiedy usunąć pola na podstawie wyniku.
- soft_nms_sigma: Tensor zmiennoprzecinkowy 0-D reprezentujący parametr sigma dla Soft NMS; patrz Bodla i in. (por . https://arxiv.org/abs/1704.04503 ). Gdy
soft_nms_sigma=0.0
(co jest ustawieniem domyślnym), wracamy do standardowego (twardego) NMS.
Opcjonalne atrybuty (patrz Attrs
):
- pad_to_max_output_size: Jeśli ma wartość true, dane wyjściowe
selected_indices
są dopełniane do długości max_output_size
. Domyślnie jest to fałsz.
Zwroty:
-
Output
wybranych_indices: 1-D tensor całkowity o kształcie [M]
reprezentujący wybrane indeksy z tensora pudełek, gdzie M <= max_output_size
. -
Output
wybranych_wyników: 1-D tensor zmiennoprzecinkowy o kształcie [M]
reprezentujący odpowiednie wyniki dla każdego wybranego pola, gdzie M <= max_output_size
. Wyniki różnią się od odpowiadających im wyników wejściowych tylko w przypadku korzystania z Soft NMS (tzn. gdy soft_nms_sigma>0
) -
Output
valid_outputs: tensor liczby całkowitej 0-D reprezentujący liczbę prawidłowych elementów w selected_indices
, przy czym prawidłowe elementy pojawiają się jako pierwsze.
Konstruktory i destruktory |
---|
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) |
Atrybuty publiczne
Funkcje publiczne
Publiczne funkcje statyczne
PadToMaxOutputSize
Attrs PadToMaxOutputSize(
bool x
)
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-27 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.2/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.2/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.2/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.2/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.2/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.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, ::`[tensorflow::Input](/versions/r2.2/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.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` soft_nms_sigma, const `[NonMaxSuppressionV5::Attrs](/versions/r2.2/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.2/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.2/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.2/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.2/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.2/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.2/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v5/attrs) | Optional attribute setters for [NonMaxSuppressionV5](/versions/r2.2/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```"]]