Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: NonMaxSuppressionV4
#include <image_ops.h>
Tham lam chọn một tập hợp con các hộp giới hạn theo thứ tự điểm giảm dần.
Bản tóm tắt
cắt bỏ các hộp có sự chồng chéo cao (IOU) với các hộp đã chọn trước đó. Các hộp giới hạn có số điểm nhỏ hơn score_threshold
sẽ bị xóa. Các hộp giới hạn được cung cấp dưới dạng [y1, x1, y2, x2], trong đó (y1, x1) và (y2, x2) là tọa độ của bất kỳ cặp góc chéo nào của hộp và tọa độ có thể được cung cấp dưới dạng chuẩn hóa (nghĩa là nằm trong khoảng [0, 1]) hoặc tuyệt đối. Lưu ý rằng thuật toán này không xác định được gốc tọa độ ở đâu và nói chung là bất biến đối với các phép biến đổi trực giao và tịnh tiến của hệ tọa độ; do đó việc dịch hoặc phản ánh của hệ tọa độ dẫn đến các hộp giống nhau được thuật toán chọn. Đầu ra của thao tác này là một tập hợp các số nguyên được lập chỉ mục vào tập hợp đầu vào của các hộp giới hạn đại diện cho các hộp đã chọn. Sau đó, tọa độ hộp giới hạn tương ứng với các chỉ số đã chọn có thể được lấy bằng cách sử dụng tf.gather operation
. Ví dụ: selected_indices = tf.image.non_max_suppression_v2( hộp, điểm, max_output_size, iou_threshold, Score_threshold) selected_boxes = tf.gather(boxes, selected_indices)
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- hộp: Một tensor nổi 2-D có hình dạng
[num_boxes, 4]
. - điểm số: Một tenxơ float 1-D có hình dạng
[num_boxes]
biểu thị một điểm duy nhất tương ứng với mỗi hộp (mỗi hàng hộp). - max_output_size: Một tenxơ số nguyên vô hướng biểu thị số lượng hộp tối đa được chọn bằng cách triệt tiêu không tối đa.
- iou_threshold: Một tenxơ float 0-D biểu thị ngưỡng để quyết định xem các hộp có chồng chéo quá nhiều so với IOU hay không.
- Score_threshold: Một tenxơ float 0-D biểu thị ngưỡng quyết định thời điểm loại bỏ các hộp dựa trên điểm số.
Thuộc tính tùy chọn (xem Attrs
):
- pad_to_max_output_size: Nếu đúng, đầu ra
selected_indices
sẽ được đệm để có độ dài max_output_size
. Mặc định là sai.
Trả về:
-
Output
selected_indices: Một tenxơ số nguyên 1-D có hình dạng [M]
biểu thị các chỉ số đã chọn từ tenxơ hộp, trong đó M <= max_output_size
. -
Output
valid_outputs: Một tenxơ số nguyên 0-D biểu thị số phần tử hợp lệ trong selected_indices
, với các phần tử hợp lệ xuất hiện đầu tiên.
Hàm tạo và hàm hủy |
---|
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) |
Thuộc tính công khai
Chức năng công cộng
Các hàm tĩnh công khai
PadToMaxKích thước đầu ra
Attrs PadToMaxOutputSize(
bool x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 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.3/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.3/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.3/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.3/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.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.3/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.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` boxes, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` scores, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` max_output_size, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` iou_threshold, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` score_threshold, const `[NonMaxSuppressionV4::Attrs](/versions/r2.3/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.3/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.3/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.3/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.3/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.3/api_docs/cc/struct/tensorflow/ops/non-max-suppression-v4/attrs) | Optional attribute setters for [NonMaxSuppressionV4](/versions/r2.3/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```"]]