In addition to regular images, the sample also supports single-channel
ubyte images as an input for LeNet model.
Image Classification Async C++ sample application demonstrates how to use the following Inference Engine C++ API in applications:
|Inference Engine Version||Get Inference Engine API version|
|Available Devices||Get version information of the devices for inference|
|Asynchronous Infer||Do asynchronous inference with callback|
|Custom Extension Kernels||Load extension library and config to the device|
|Network Operations||Managing of network, operate with its batch size. Setting batch size using input image count.|
Basic Inference Engine API is covered by Hello Classification C++ sample.
|Validated Models||alexnet, googlenet-v1|
|Model Format||Inference Engine Intermediate Representation (*.xml + *.bin), ONNX (*.onnx)|
|Validated images||The sample uses OpenCV* to read input image (*.bmp, *.png), single-channel |
|Other language realization||Python|
Upon the start-up, the sample application reads command line parameters and loads specified network and input images (or a folder with images) to the Inference Engine plugin. The batch size of the network is set according to the number of read images. The batch mode is an independent attribute on the asynchronous mode. Asynchronous mode works efficiently with any batch size.
Then, the sample creates an inference request object and assigns completion callback for it. In scope of the completion callback handling the inference request is executed again.
After that, the application starts inference for the first infer request and waits of 10th inference request execution being completed. The asynchronous mode might increase the throughput of the pictures.
When inference is done, the application outputs data to the standard output stream. You can place labels in .labels file near the model to get pretty output.
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:
- By default, Inference Engine samples and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or 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.
Running the application with the
-h option yields the following usage message:
Running the application with the empty list of options yields the usage message given above and an error message.
alexnetmodel on a
GPU, for example:
By default the application outputs top-10 inference results for each infer request.