VART-X  0.3.0
vart_postprocess.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024-2026 Advanced Micro Devices Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
24 #include <string>
25 #include "vart_device.hpp"
26 #include "vart_inferresult.hpp"
27 #include "vart_memory.hpp"
28 #include "vart_memory_types.hpp"
30 
33 namespace vart {
34 
38 class PostProcessFunctionBase;
39 
43 class PostProcessImplBase;
44 
67 class PostProcess {
68  public:
69  PostProcess() = delete;
70 
83  PostProcess(PostProcessType postprocess_type, std::string& json_data, std::shared_ptr<Device> device);
84 
91  PostProcess(std::shared_ptr<PostProcessImplBase> ptr);
92 
97 
106  const std::shared_ptr<PostProcessImplBase>& get_pimpl_handle() const;
107 
121  void set_config(std::vector<TensorInfo>& info, uint32_t batch_size);
122 
144  std::vector<std::vector<std::shared_ptr<InferResult>>> process(std::vector<int8_t*> data,
145  uint32_t current_batch_size);
146 
169  std::vector<std::vector<std::shared_ptr<InferResult>>> process(
170  std::vector<std::vector<std::shared_ptr<vart::Memory>>> tensor_memory,
171  uint32_t current_batch_size);
172 
173  private:
174  void populateReturnResult(std::vector<std::vector<std::shared_ptr<InferResult>>>& result);
175 
176  std::shared_ptr<PostProcessImplBase> pimpl;
177  std::unique_ptr<PostProcessFunctionBase> postProcessBase;
178  std::string jsonData;
179 };
180 
181 } // namespace vart
Interface class for post-processing inference results.
Definition: vart_postprocess.hpp:67
PostProcess(PostProcessType postprocess_type, std::string &json_data, std::shared_ptr< Device > device)
PostProcess() - Constructor for using existing post-process implementations.
PostProcess(std::shared_ptr< PostProcessImplBase > ptr)
PostProcess() - Constructor for using user defined implementation (Legacy)
PostProcess()=delete
void set_config(std::vector< TensorInfo > &info, uint32_t batch_size)
set_config() - Set PostProcessInfo config data before start doing the post-process.
std::vector< std::vector< std::shared_ptr< InferResult > > > process(std::vector< std::vector< std::shared_ptr< vart::Memory >>> tensor_memory, uint32_t current_batch_size)
process() - Process/parse tensors data from ML network output to create infer results.
const std::shared_ptr< PostProcessImplBase > & get_pimpl_handle() const
get_pimpl_handle() - Gives pointer to implementation class.
std::vector< std::vector< std::shared_ptr< InferResult > > > process(std::vector< int8_t * > data, uint32_t current_batch_size)
process() - Process/parse tensors data from ML network output to create infer results.
VART (Vitis AI Runtime) public API namespace.
PostProcessType
Definition: vart_postprocess_types.hpp:84
Device module managing hardware context and xclbin loading.
InferResult module for representing inference results.
Memory module for device memory allocation and management.