Hello NV12 Input Classification C Sample demonstrates how to use the NV12 automatic input pre-processing API of the Inference Engine in your applications:
|Blob Operations||ie_blob_make_memory_nv12||Create a NV12 blob|
|Input in N12 color format||ie_network_set_color_format||Change the color format of the input data|
Basic Inference Engine API is covered by Hello Classification C sample.
|Model Format||Inference Engine Intermediate Representation (*.xml + *.bin), ONNX (*.onnx)|
|Validated images||An uncompressed image in the NV12 color format - *.yuv|
|Other language realization||C++|
Upon the start-up, the sample application reads command-line parameters, loads specified network and an image in the NV12 color format to an Inference Engine plugin. Then, the sample creates an synchronous inference request object. When inference is done, the application outputs data to the standard output stream.
You can see the explicit description of each sample step at Integration Steps section of "Integrate the Inference Engine with Your Application" guide.
To build the sample, please use instructions available at Build the Sample Applications section in Inference Engine Samples guide.
To run the sample, you need specify a model and image:
The sample accepts an uncompressed image in the NV12 color format. To run the sample, you need to convert your BGR/RGB image to NV12. To do this, you can use one of the widely available tools such as FFmpeg* or GStreamer*. The following command shows how to convert an ordinary image into an uncompressed NV12 image using FFmpeg:
- Because the sample reads raw image files, you should provide a correct image size along with the image path. The sample expects the logical size of the image, not the buffer size. For example, for 640x480 BGR/RGB image the corresponding NV12 logical image size is also 640x480, whereas the buffer size is 640x720.
- By default, this sample expects that network input has BGR channels order. If you trained your model to work with RGB order, you need to reconvert your model using the Model Optimizer tool with
--reverse_input_channelsargument specified. For more information about the argument, refer to When to Reverse Input Channels section of Converting a Model Using General Conversion Parameters.
- Before running the sample with a trained model, make sure the model is converted to the Inference Engine format (*.xml + *.bin) using the Model Optimizer tool.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
alexnetmodel on a
CPU, for example:
The application outputs top-10 inference results.