include_object_detection_kernels.h#

namespace onnx_light

Alias that makes onnx-light headers compatible with code that references ONNX_LIGHT_NAMESPACE (the macro used in the standard onnx package).

Set to ONNX_LIGHT_NAMESPACE so both names resolve to the same namespace.

Symbol-visibility attribute for the public onnx-light C++ API.

Defined as empty because onnx-light does not require explicit __declspec(dllexport) or __attribute__((visibility("default"))) annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations with ONNX_API compile without modification.

Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal onnx namespace — rather than the ONNX_NAMESPACE macro — resolves to the onnx-light namespace. The standard onnx package lives in namespace onnx; onnx-light uses onnx_light (via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs from onnx.

namespace onnx_kernels
namespace kernel
class NonMaxSuppression : public onnx_light::onnx_kernels::kernel::KernelBase#
#include <include_object_detection_kernels.h>

Reference NonMaxSuppression kernel (since opset 10 in the ai.onnx domain).

Implements the upstream NMS reference: for each (batch, class) pair the kernel sorts boxes by descending score, optionally pre-filters by score_threshold, then greedily picks boxes whose IoU with all previously selected boxes is at most iou_threshold. The selection is capped at max_output_boxes_per_class per (batch, class) pair and the final output rows are emitted in the upstream order: outer loop over batches, then classes, then per-pair selection order (which itself is the descending-score insertion order).

Inputs are restricted to FLOAT for boxes/scores/iou_threshold/ score_threshold and INT64 for max_output_boxes_per_class; the optional scalar inputs (max_output_boxes_per_class, iou_threshold, score_threshold) may be omitted by passing a nullptr Tensor pointer to operator(). Defaults follow the ONNX schema: max_output_boxes_per_class = 0 (no output), iou_threshold = 0 and score_threshold = -inf (no score filtering).

Public Functions

Tensor operator()(const Tensor &boxes, const Tensor &scores, const Tensor *max_output_boxes_per_class, const Tensor *iou_threshold, const Tensor *score_threshold, const Attributes &attrs) const#

Computes selected indices and returns a freshly allocated INT64 tensor of shape (num_selected, 3). The optional scalar inputs may be nullptr to indicate “not provided” (in which case their schema defaults apply).

inline explicit KernelBase(const KernelContext &ctx)#

Public Static Functions

static inline constexpr bool CanRunInPlace() noexcept#

Output element layout differs fundamentally from any input (FLOAT/INT64 mix, distinct rank and shape), so storage cannot be shared.

struct Attributes#
#include <include_object_detection_kernels.h>

Attributes carried by the ONNX NonMaxSuppression operator. The default matches the schema (center_point_box = 0 — the [y1, x1, y2, x2] corner format).

Public Members

int64_t center_point_box = 0#
class RoiAlign : public onnx_light::onnx_kernels::kernel::KernelBase#
#include <include_object_detection_kernels.h>

Reference RoiAlign kernel restricted to FLOAT inputs/outputs.

Public Functions

Tensor operator()(const Tensor &x, const Tensor &rois, const Tensor &batch_indices, const Attributes &attrs) const#
void operator()(const Tensor &x, const Tensor &rois, const Tensor &batch_indices, const Attributes &attrs, Tensor &output) const#
inline explicit KernelBase(const KernelContext &ctx)#

Public Static Functions

static inline constexpr bool CanRunInPlace() noexcept#

Output element layout (num_rois, C, output_height, output_width) fundamentally differs from any input, so storage cannot be shared.

struct Attributes#
#include <include_object_detection_kernels.h>

Attributes carried by the ONNX RoiAlign operator. Defaults match the opset-16 schema; coordinate_transformation_mode should be set to "output_half_pixel" to reproduce the legacy opset-10 behaviour.

Public Members

std::string mode = "avg"#
int64_t output_height = 1#
int64_t output_width = 1#
int64_t sampling_ratio = 0#
float spatial_scale = 1.0f#
std::string coordinate_transformation_mode = "half_pixel"#