Class vart::InferResult#
-
class InferResult : public std::enable_shared_from_this<InferResult>
This module is used to represent inference results.
Presently, the default supported types include classification and detection. Users can integrate new types by overriding base class methods to incorporate custom inference results. For additional information please check API documentation.
Public Functions
-
InferResult() = delete#
-
InferResult(InferResultType infer_res_type)#
InferResult() - Constructor for using supported infer result type implementations.
- Parameters:
infer_res_type – Enum class to specify which implementation to instantiate
InferResult() - Constructor for using user defined implementation.
- Parameters:
ptr – Pointer to user’s implementation instance
-
const std::shared_ptr<InferResultImplBase> &get_pimpl_handle() const#
get_pimpl_handle() - Gives pointer to implementation class.
- Returns:
Returns a constant reference of pointer to implementation class.
-
void transform(InferResScaleInfo &info)#
transform() - Scales the infer results by a given scale factor
Typically, in video pipelines, the original input resolution differs from the resolution of the input to the machine learning model. If we have inference results, like detection from may be 200x200 resolution (input resolution to ML model) and if we want to transform the bounding box results to the original input resolution, which may be 1920x1080. In such cases, one can use this function to transform the bounding box dimensions in the infer results to the resolution of input image.
- Parameters:
info – Scale factor info with which infer results to be scaled.
-
InferResultData *get_infer_result()#
get_infer_result() - Get inference results for a frame.
- Returns:
Inference result object for the requested frame.
add_child() - Add a child to this infer result node.
User can use this method to build cascade infer result tree by adding child nodes to the previous inference level starting with a dummy root node.
- Parameters:
child – Child node to be added
add_children() - Add all children at once.
User can use this method to add all children at once.
- Parameters:
arg_children – Child nodes to be added
-
std::vector<std::shared_ptr<InferResult>> get_children()#
get_children() - Returns all children of the node.
- Returns:
vector of child nodes.
-
std::shared_ptr<InferResult> get_parent()#
get_parent() - Returns parent of the given inference result node.
- Returns:
Parent result node.
-
std::shared_ptr<InferResult> get_root()#
get_root() - Returns root of the given inference result node.
- Returns:
Root result node.
traverse() - Traverse through the tree nodes in a given order.
- Parameters:
callback – User callback function to be called for each node as per the order chosen.
order – Order in which the tree nodes to be traversed.
user_data – User data to be passed to the callback function.
-
size_t get_depth()#
get_depth() - Returns depth of the current node
- Returns:
Depth of the current node.
Private Members
-
std::shared_ptr<InferResultImplBase> pimpl#
-
std::weak_ptr<InferResult> parent#
-
std::vector<std::shared_ptr<InferResult>> children#
-
InferResult() = delete#