ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
Backend.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 "reusex/vision/IMLBackend.hpp"
7
#include "reusex/vision/tensor_rt/Dataset.hpp"
8
#include "reusex/vision/tensor_rt/Sam3.hpp"
9
#include "reusex/vision/tensor_rt/Sam3p1.hpp"
10
11
namespace
reusex::vision::tensor_rt
{
12
/* TensorRTBackend is a concrete implementation of the IMLBackend interface for
13
* TensorRT. It provides methods to create TensorRT-based models and datasets.
14
*/
15
class
TensorRTBackend
:
public
IMLBackend
{
16
public
:
17
/* Constructor for TensorRTBackend. Initializes any necessary resources for
18
* the backend. In this case, it is a default constructor.
19
*/
20
TensorRTBackend
() =
default
;
21
22
/* Destructor for TensorRTBackend. Cleans up any resources allocated by the
23
* backend. In this case, it is a default destructor.
24
* @param: type - The type of model to create (not used in this
25
* implementation).
26
* @param: modelPath - The file path to the model to be created (not used in
27
* this implementation).
28
* @param: use_cuda - Whether to use CUDA for inference (ignored for TensorRT,
29
* always uses GPU).
30
* @return: A unique pointer to an IModel instance representing the created
31
* model.
32
*/
33
std::unique_ptr<IModel>
create_model
(
const
Model
type,
34
const
std::filesystem::path &modelPath,
35
bool
use_cuda =
false
)
override
;
36
37
/* Creates a stateful video model (IVideoModel). Currently supports
38
* Model::sam3p1 (the SAM 3.1 video tracker). See
39
* IMLBackend::create_video_model.
40
* @param: type - The type of video model to create.
41
* @param: modelPath - The directory containing the model engines.
42
* @param: use_cuda - Ignored for TensorRT (always uses GPU).
43
* @return: A unique pointer to the created IVideoModel instance.
44
*/
45
std::unique_ptr<IVideoModel>
46
create_video_model
(
const
Model
type,
const
std::filesystem::path &modelPath,
47
bool
use_cuda =
false
)
override
;
48
49
/* Creates a dataset based on the provided dataset path. This method is
50
* responsible for initializing and returning a dataset that can be used for
51
* training or inference. The dataset is created based on the specified path,
52
* which may contain the necessary data and configuration for the dataset.
53
* @param: datasetPath - The file path to the dataset to be created.
54
* @return: A unique pointer to an IDataset instance representing the created
55
* dataset.
56
*/
57
std::unique_ptr<IDataset>
58
create_dataset
(
const
std::filesystem::path &datasetPath)
override
;
59
};
60
}
// namespace reusex::vision::tensor_rt
reusex::vision::IMLBackend
Definition
IMLBackend.hpp:17
reusex::vision::tensor_rt::TensorRTBackend::create_dataset
std::unique_ptr< IDataset > create_dataset(const std::filesystem::path &datasetPath) override
reusex::vision::tensor_rt::TensorRTBackend::create_video_model
std::unique_ptr< IVideoModel > create_video_model(const Model type, const std::filesystem::path &modelPath, bool use_cuda=false) override
reusex::vision::tensor_rt::TensorRTBackend::create_model
std::unique_ptr< IModel > create_model(const Model type, const std::filesystem::path &modelPath, bool use_cuda=false) override
reusex::vision::tensor_rt::TensorRTBackend::TensorRTBackend
TensorRTBackend()=default
reusex::vision::tensor_rt
Definition
Backend.hpp:11
reusex::vision::Model
Model
Definition
IMLBackend.hpp:15
libs
reusex
include
vision
tensor_rt
Backend.hpp
Generated by
1.17.0