* Solve some code style issues Change-Id: I06c31ad9513463c758db96dbe33031983a8fd7a5 * Refine ov_dimension with C style structure Use C style definition to replace opaque C++ handle: 1). Improve partial shape 2). Improve dimension/rank 3). Improve shape Change-Id: I680fd3e76c63d0c06d9d8b07c67af0440fb15bb7 * Some minor update Change-Id: I237490a765e6ecd6f3896b1bd75d5f962304f43b * add partial_shape_is_dynamic and update doc Change-Id: Ief358f27de8386e35485d08847c8243d1490157f * Rename property and add basic test cases Change-Id: Ifbed0bbf7a5e836d2cab186763d7e5f8f2cb7d44 * address reviewer's comments Change-Id: I9a5d1ede6d086906f3777c3d29237986a505db52 * Fix compile error Change-Id: I72267a8dda32dd8f43c1ea1522d07b392052358f * Use ov_any_t to replace ov_property_value_t Change-Id: Ia4062d0da0941c901990bf5f16497ae3c8f2eb0f * update doc for ov_model Change-Id: I80183394f16dd1e07ff998993e26f8b903f2402e * Property key apply string variables replace enum variable Change-Id: I0e1699862de3913ccdc06ded5b8f8ac5a2bf8773 * Fix compiling error in windows Change-Id: I4f9c7c746e218db94491c5f4bc5aeda1b3fde62b * Change init/deinit method to create/free, remove unnecessary methods Change-Id: Ibc5de039da94e92db494583ab1ff1a63e0586c73 * Pass by value for single C structure data Change-Id: I289eb56e2ba1ab90942c8c801c585ab0f792952f * fix dllexport issue in windows Change-Id: I1632375e5e651fdfa076cdab2d8d1c3e83986549 * Fix static build error Change-Id: I6633fe4887edad0b3a8b7e10730fb9d36a6ac0cd * Use pass by value for all transparent structure Change-Id: I652f6e70b420ef7c5af5cff3f5d482911cf0d75a * Unify parameter order in C APIs, input first and then output parameters Change-Id: Ib89c77d81c314e3a81bfcec9917630abbc896f5e * Rename preprocess api to be more readable Change-Id: I0a8ecd005e73e4ba8e90a8f25bedf0739fe31836 * Simplfy property implement for set and get property Change-Id: Icad41606368cef9520b1623f6207784c295f1b9f * check string type property issue Change-Id: Ie8ee6995dda401f1db0cc098e061ffcfd24de92a * Fix memory leak Change-Id: Ife8980736be320314eca6fb3f3605e019663e1da * Check string property data Change-Id: I542a136ff874cb345c67f7d3c1dbc74981a909df * Fix issues caused by rebase Change-Id: I3d675a16cf76980a6414e369a83464a46dec1e49 * Remove some redundant code Change-Id: Iab6bf7f355ec7a7424d884e620319ed9db80ecf5 * Remove property type from interface ov_core_set_property will have 2 cases: 1) enum type: <const char* property_key, ov_property_xxx_e property_value> 2) other: <const char* property_key, const char* property_value> Change-Id: Id7dec1ac40948d45c4f8baee687652aee92ea75d * Remove redundant code Change-Id: I66865d3313e305b0109cb63bd049772a01c0688f * Remove exception log and update propery size argument Change-Id: Ia1a60c07c9adf08d175d94a7d5e4298adb27bf80 * Apply string for enum property Change-Id: I591b1db453a52b5ea9000e0cc3e11edf0ef5f790 * Add test case for MULTI_DEVICE_PRIORITIES Change-Id: I59e4307564a2560724b4dacdb83c3ed45ea1ce8d * Fix test issues and add more negative test case Change-Id: Ib849fb8c098e487a537c1b1ab881f5e905871f73
Hello Classification C Sample
This sample demonstrates how to execute an inference of image classification networks like AlexNet and GoogLeNet using Synchronous Inference Request API and input auto-resize feature.
Hello Classification C sample application demonstrates how to use the following Inference Engine C API in applications:
| Feature | API | Description |
|---|---|---|
| Basic Infer Flow | ie_core_create, ie_core_read_network, ie_core_load_network, ie_exec_network_create_infer_request, ie_infer_request_set_blob, ie_infer_request_get_blob | Common API to do inference: configure input and output blobs, loading model, create infer request |
| Synchronous Infer | ie_infer_request_infer | Do synchronous inference |
| Network Operations | ie_network_get_input_name, ie_network_get_inputs_number, ie_network_get_outputs_number, ie_network_set_input_precision, ie_network_get_output_name, ie_network_get_output_precision | Managing of network |
| Blob Operations | ie_blob_make_memory_from_preallocated, ie_blob_get_dims, ie_blob_get_cbuffer | Work with memory container for storing inputs, outputs of the network, weights and biases of the layers |
| Input auto-resize | ie_network_set_input_resize_algorithm, ie_network_set_input_layout | Set image of the original size as input for a network with other input size. Resize and layout conversions will be performed automatically by the corresponding plugin just before inference |
| Options | Values |
|---|---|
| Validated Models | [alexnet](@ref omz_models_model_alexnet), [googlenet-v1](@ref omz_models_model_googlenet_v1) |
| Model Format | Inference Engine Intermediate Representation (*.xml + *.bin), ONNX (*.onnx) |
| Validated images | The sample uses OpenCV* to read input image (*.bmp, *.png) |
| Supported devices | All |
| Other language realization | C++, Python |
How It Works
Upon the start-up, the sample application reads command line parameters, loads specified network and an image to the 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 OpenVINO™ Runtime with Your Application" guide.
Building
To build the sample, please use instructions available at Build the Sample Applications section in Inference Engine Samples guide.
Running
To run the sample, you need specify a model and image:
- you can use [public](@ref omz_models_group_public) or [Intel's](@ref omz_models_group_intel) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader).
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
NOTES:
By default, OpenVINO™ Toolkit 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 Embedding Preprocessing Computation.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.
Example
- Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader):
python <path_to_omz_tools>/downloader.py --name alexnet
- If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script:
python <path_to_omz_tools>/converter.py --name alexnet
- Perform inference of
car.bmpusingalexnetmodel on aGPU, for example:
<path_to_sample>/hello_classification_c <path_to_model>/alexnet.xml <path_to_image>/car.bmp GPU
Sample Output
The application outputs top-10 inference results.
Top 10 results:
Image /opt/intel/openvino/samples/scripts/car.png
classid probability
------- -----------
656 0.666479
654 0.112940
581 0.068487
874 0.033385
436 0.026132
817 0.016731
675 0.010980
511 0.010592
569 0.008178
717 0.006336
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
- Integrate OpenVINO™ into Your Application
- Using OpenVINO™ Samples
- [Model Downloader](@ref omz_tools_downloader)
- Model Optimizer