SOD C/C++ API - Convolutional/Recurrent Neural Networks (CNN/RNN)

Syntax

int sod_cnn_predict(sod_cnn *pNet, float *pInput, sod_box **paBox, int *pnBox);

Description

Perform network prediction on an arbitrary input data. The prediction task vary depending on the network architecture, for a standard CNN, this involve an object detection & classification task while text generation is performed for a RNN architecture. The network architecture and its corresponding SOD weight files is to be set from sod_cnn_create() and the network can be configured and its output extracted via sod_cnn_config() with the appropriate configuration verb.

Parameters

sod_cnn    *pNet

A pointer to a valid sod_cnn object obtained from a prior successful call to sod_cnn_create().

float    *pInput

Arbitrary input data to be analyzed by the network. In case of object detection, this pointer is usually obtained from a previous call to sod_cnn_prepare_image() which merely prepare (i.e. resize) the target image/video frame to the appropriate network dimension (refer to the code gist below for an usage example). For a RNN architecture (i.e. text generation), simply pass NULL.

sod_box    **paBox

OUT: A pointer to an array of bounding boxes holding the coordinates, the score & class (name) for each detected object. Each entry of this array is represented by an instance of the sod_box structure. For a RNN architecture (i.e. text generation), simply pass NULL.

int    *pnBox

OUT: Total number of extracted bounding boxes in case of object detection from a standard CNN architecture.

Return Value

SOD_OK is returned on success. Any other code indicates failure.

Example

Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.

See also

sod_cnn_createsod_cnn_configsod_cnn_prepare_imagesod_cnn_get_network_sizesod_img_load_from_filesod_cnn_destroy.


Back