EyeAI
Loading...
Searching...
No Matches
DepthModel.hpp
Go to the documentation of this file.
1#pragma once
2
5
7class DepthModel {
8 public:
9 [[nodiscard]] static tl::
10 expected<std::unique_ptr<DepthModel>, TfLiteCreateRuntimeError>
11 create(
12 std::vector<int8_t>&& model_data,
13 std::string_view gpu_delegate_serialization_dir,
14 std::string_view model_token,
15 TfLiteLogWarningCallback log_warning_callback,
16 TfLiteLogErrorCallback log_error_callback,
17 bool enable_npu,
18 std::string npu_skel_directory
19 );
20
22 DepthModel(std::unique_ptr<TfLiteRuntime>&& runtime)
23 : runtime(std::move(runtime)) {}
24
25 DepthModel(DepthModel&&) = default;
27
28 DepthModel(const DepthModel&) = delete;
29 DepthModel& operator=(const DepthModel&) = delete;
30
31 ~DepthModel() = default;
32
33 using RunResult = tl::expected<
35 TfLiteRunInferenceError>;
36
38 [[nodiscard]] RunResult
40
41 using RunRawResult = tl::expected<
43 TfLiteRunInferenceError>;
44
46 [[nodiscard]] RunRawResult
48
49 [[nodiscard]] std::span<const int> get_input_shape() const;
50
51 [[nodiscard]] std::span<const int> get_output_shape() const;
52
53 private:
54 std::unique_ptr<TfLiteRuntime> runtime;
55};
TensorBuffer< float, FloatTensorFormat, FORMAT > FloatTensorBuffer
Definition TensorBuffer.hpp:106
void(*)(std::string) TfLiteLogWarningCallback
Definition TfLiteRuntime.hpp:17
void(*)(std::string) TfLiteLogErrorCallback
Definition TfLiteRuntime.hpp:18
tl::expected< FloatTensorBuffer< FloatTensorFormat::RelativeDepth >, TfLiteRunInferenceError > RunResult
Definition DepthModel.hpp:33
DepthModel & operator=(const DepthModel &)=delete
tl::expected< FloatTensorBuffer< FloatTensorFormat::RawRelativeDepth >, TfLiteRunInferenceError > RunRawResult
Definition DepthModel.hpp:41
RunResult run(FloatTensorBuffer< FloatTensorFormat::ImageRGB255 > &input)
Definition DepthModel.cpp:29
DepthModel & operator=(DepthModel &&)=default
std::span< const int > get_output_shape() const
Definition DepthModel.cpp:59
DepthModel(std::unique_ptr< TfLiteRuntime > &&runtime)
see DepthModel::create
Definition DepthModel.hpp:22
static tl::expected< std::unique_ptr< DepthModel >, TfLiteCreateRuntimeError > create(std::vector< int8_t > &&model_data, std::string_view gpu_delegate_serialization_dir, std::string_view model_token, TfLiteLogWarningCallback log_warning_callback, TfLiteLogErrorCallback log_error_callback, bool enable_npu, std::string npu_skel_directory)
Definition DepthModel.cpp:7
DepthModel(DepthModel &&)=default
RunRawResult run_raw(FloatTensorBuffer< FloatTensorFormat::ImageRGB255 > &input)
Definition DepthModel.cpp:45
DepthModel(const DepthModel &)=delete
~DepthModel()=default
std::span< const int > get_input_shape() const
Definition DepthModel.cpp:56