ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
nms.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
5
#pragma once
6
#include <torch/torch.h>
7
8
namespace
reusex::vision
{
9
11
torch::Tensor
xyxy_to_xywh
(
const
torch::Tensor &x);
12
14
torch::Tensor
xywh_to_xyxy
(
const
torch::Tensor &x);
15
22
// TODO: Replace custom NMS with torchvision library implementation
23
// category=Vision estimate=4h
24
// Current implementation is custom-written. Consider using official torchvision
25
// NMS: Reference:
26
// https://github.com/pytorch/vision/blob/main/torchvision/csrc/ops/cpu/nms_kernel.cpp
27
// Benefits:
28
// 1. Optimized CPU/CUDA implementations available
29
// 2. Better maintained and tested by PyTorch team
30
// 3. Reduces custom code maintenance burden
31
// Trade-off: Adds torchvision as dependency (currently only use LibTorch)
32
torch::Tensor
nms
(
const
torch::Tensor &bboxes,
const
torch::Tensor &scores,
33
float
iou_threshold = 0.45);
34
42
torch::Tensor
non_max_suppression
(torch::Tensor predictions,
43
float
confThreshold = 0.25,
44
float
iouThreshold = 0.45,
45
int
maxDetections = 300);
46
47
}
// namespace reusex::vision
reusex::vision
Definition
annotate.hpp:8
reusex::vision::nms
torch::Tensor nms(const torch::Tensor &bboxes, const torch::Tensor &scores, float iou_threshold=0.45)
Non-maximum suppression on bounding boxes.
reusex::vision::non_max_suppression
torch::Tensor non_max_suppression(torch::Tensor predictions, float confThreshold=0.25, float iouThreshold=0.45, int maxDetections=300)
YOLO-style non-maximum suppression with class-aware filtering.
reusex::vision::xywh_to_xyxy
torch::Tensor xywh_to_xyxy(const torch::Tensor &x)
Convert bounding boxes from (cx,cy,w,h) to (x1,y1,x2,y2) format.
reusex::vision::xyxy_to_xywh
torch::Tensor xyxy_to_xywh(const torch::Tensor &x)
Convert bounding boxes from (x1,y1,x2,y2) to (cx,cy,w,h) format.
libs
reusex
include
vision
nms.hpp
Generated by
1.17.0