Model Inference
This section describes how to input data to a model for inference. After the inference is complete, the inference result is returned.
API Calling
virtual HiLensEC hilens::Model::Infer(const InferDataVec & inputs, InferDataVec & outputs)
Parameter Description
Parameter |
Type |
Description |
---|---|---|
inputs |
InferDataVector. Refer to Parameter Type for details. |
Input inference data |
outputs |
InferDataVector. Refer to Parameter Type for details. |
Inference output |
Parameter Type
- InferDataVec
- InferData
struct InferData { unsigned int size; // Output size std::shared_ptr<unsigned char> data; // Data pointer /** * @brief: Construct an empty model for inference. */ InferData() : size(0), data(nullptr) {} /** * @brief: Construct the InferData from a cv::Mat. * @param img Input images. */ InferData(const cv::Mat &img); /** * @brief: Construct an InferData from a group of pointer data. * @param data: The data pointer. This constructor copies the data. * @param size: Data size (byte) */ InferData(const unsigned char *data, unsigned int size); };
Return Value
If the return value is 0, the operation is successful. Otherwise, the operation fails. Refer to Error Codes for details about the failure response parameters.
If the actual inference input is different from the model input, the inference will fail. In this case, the return value of inference will be an int error code, and error information will be recorded in logs. You can locate the error based on the error information.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot