Inference Engine Samples - Object Detection with SSD-VGG Sample
https://software.intel.com/en-us/articles/OpenVINO-IE-Samples
Intel® Distribution of OpenVINO™ Toolkit - Code Samples
https://software.intel.com/en-us/openvino-toolkit/documentation/code-samples
This toolkit features numerous code examples that help you develop and optimize computer vision and image processing pipelines for Intel® processors.
Intel® Distribution of OpenVINO™ Toolkit - Inference Engine Samples
https://software.intel.com/en-us/articles/OpenVINO-IE-Samples
Object Detection with SSD-VGG Sample
Description
This topic demonstrates how to run the Object Detection sample application, which does inference using object detection networks like SSD-VGG on Intel® Processors and Intel® HD Graphics.
How It Works
Upon the start-up, the sample application reads command line parameters and loads a network and an image to the Inference Engine plugin. When inference is done, the application creates an output image and outputs data to the standard output stream.
Running
Running the application with the -h
option yields the following usage message:
./object_detection_sample_ssd -h
InferenceEngine:
API version ............ <version>
Build .................. <number>
object_detection_sample_ssd [OPTION]
Options:
-h Print a usage message.
-i "<path>" Required. Path to an .bmp image.
-m "<path>" Required. Path to an .xml file with a trained model.
-l "<absolute_path>" Required for MKLDNN (CPU)-targeted custom layers. Absolute path to a shared library with the kernels impl.
Or
-c "<absolute_path>" Required for clDNN (GPU)-targeted custom kernels. Absolute path to the xml file with the kernels desc.
-pp "<path>" Path to a plugin folder.
-d "<device>" Specify the target device to infer on; CPU, GPU, FPGA or MYRIAD is acceptable. Sample will look for a suitable plugin for device specified
-pc Enables per-layer performance report
-ni "<integer>" Number of iterations (default 1)
-p_msg Enables messages from a plugin
Running the application with the empty list of options yields the usage message given above and an error message.
To run the sample, you can use a set of pre-trained and optimized models delivered with the package or a Caffe* public model.
NOTE: A public model should be converted to the Inference Engine format (.xml
+ .bin
) using the Model Optimizer tool. For Model Optimizer documentation, see https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer.
For example, to do inference on a CPU with the OpenVINO™ toolkit person detection SSD model (<INSTAL_DIR>/deployment_tools/intel_models/person-detection-retail-00013
), run the following command:
./object_detection_sample_ssd -i <path_to_image>/inputImage.bmp -m person-detection-retail-0013.xml -d CPU
/home/strong/inference_engine_samples/intel64/Release
/opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013
/opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml
/opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/ person-detection-retail-0013.bin
/home/strong/test_data/image/person/person.jpg
./object_detection_sample_ssd -i <path_to_image>/inputImage.bmp -m person-detection-retail-0013.xml -d CPU
./object_detection_sample_ssd -i /home/strong/test_data/image/person/person.jpg -m /opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d CPU
./object_detection_sample_ssd -i /home/strong/test_data/image/person/person.jpg -m /opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d MYRIAD
strong@foreverstrong:~/inference_engine_samples/intel64/Release$ ./object_detection_sample_ssd -i /home/strong/test_data/image/person/person.jpg -m /opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d CPU
[ INFO ] InferenceEngine:
API version ............ 1.4
Build .................. 17328
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /home/strong/test_data/image/person/person.jpg
[ INFO ] Loading plugin
[ ERROR ] Cannot find plugin to use :Tried load plugin : MKLDNNPlugin, error: Plugin MKLDNNPlugin cannot be loaded: cannot load plugin: MKLDNNPlugin from : Cannot load library 'libMKLDNNPlugin.so': libiomp5.so: cannot open shared object file: No such file or directory, skipping
cannot load plugin: MKLDNNPlugin from ../../../lib/intel64: Cannot load library '../../../lib/intel64/libMKLDNNPlugin.so': ../../../lib/intel64/libMKLDNNPlugin.so: cannot open shared object file: No such file or directory, skipping
cannot load plugin: MKLDNNPlugin from : Cannot load library 'libMKLDNNPlugin.so': libiomp5.so: cannot open shared object file: No such file or directory, skipping
strong@foreverstrong:~/inference_engine_samples/intel64/Release$ ./object_detection_sample_ssd -i /home/strong/test_data/image/person/person.jpg -m /opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d MYRIAD
[ INFO ] InferenceEngine:
API version ............ 1.4
Build .................. 17328
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /home/strong/test_data/image/person/person.jpg
[ INFO ] Loading plugin
API version ............ 1.4
Build .................. 17328
Description ....... myriadPlugin
[ INFO ] Loading network files:
/opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.xml
/opt/intel/computer_vision_sdk/deployment_tools/intel_models/person-detection-retail-0013/FP16/person-detection-retail-0013.bin
[ INFO ] Preparing input blobs
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ WARNING ] Image is resized from (640, 424) to (544, 320)
[ INFO ] Batch size is 1
[ INFO ] Start inference (1 iterations)
[ INFO ] Processing output blobs
[0,1] element, prob = 0.999023 (190.156,101.549)-(271.406,375.141) batch id : 0 WILL BE PRINTED!
[1,1] element, prob = 0.435791 (403.125,101.445)-(597.5,338.289) batch id : 0
[2,1] element, prob = 0.0440063 (135,278.457)-(190.312,350.918) batch id : 0
[3,1] element, prob = 0.0414734 (23.4375,256.305)-(215.312,448.844) batch id : 0
[4,1] element, prob = 0.0413513 (71.0156,278.043)-(133.984,344.293) batch id : 0
[5,1] element, prob = 0.0350342 (470.312,245.125)-(485.312,281.562) batch id : 0
[6,1] element, prob = 0.0337219 (426.25,175.977)-(491.25,320.07) batch id : 0
[7,1] element, prob = 0.0305634 (472.812,193.574)-(485.938,215.312) batch id : 0
[8,1] element, prob = 0.0299835 (454.062,230.633)-(466.562,253.406) batch id : 0
[9,1] element, prob = 0.0291138 (493.125,169.145)-(545.625,308.27) batch id : 0
[10,1] element, prob = 0.0279999 (112.734,275.559)-(173.594,372.449) batch id : 0
[11,1] element, prob = 0.0277252 (472.812,234.359)-(484.688,257.547) batch id : 0
[12,1] element, prob = 0.0269928 (492.188,231.668)-(504.688,256.512) batch id : 0
[13,1] element, prob = 0.0269165 (76.0938,262.516)-(169.219,419.445) batch id : 0
[14,1] element, prob = 0.0253906 (498.125,229.598)-(512.5,270.176) batch id : 0
[15,1] element, prob = 0.0250702 (420.938,211.379)-(463.438,324.832) batch id : 0
[16,1] element, prob = 0.0250092 (194.531,127.221)-(237.031,267.898) batch id : 0
[17,1] element, prob = 0.0247955 (149.844,264.379)-(205.469,338.91) batch id : 0
[18,1] element, prob = 0.0246124 (493.75,228.977)-(515.625,301.438) batch id : 0
[19,1] element, prob = 0.024292 (61.4062,286.531)-(114.531,390.461) batch id : 0
[20,1] element, prob = 0.0233459 (453.125,190.469)-(468.75,214.07) batch id : 0
[21,1] element, prob = 0.0232849 (495.312,248.645)-(511.562,285.91) batch id : 0
[22,1] element, prob = 0.0225983 (85.1562,264.586)-(158.594,332.492) batch id : 0
[23,1] element, prob = 0.0225372 (441.562,160.346)-(480.312,245.539) batch id : 0
[24,1] element, prob = 0.0221405 (412.5,134.156)-(516.25,358.164) batch id : 0
[25,1] element, prob = 0.0216064 (517.188,149.27)-(557.188,255.891) batch id : 0
[26,1] element, prob = 0.0208282 (501.25,136.33)-(537.5,226.285) batch id : 0
[27,1] element, prob = 0.0208282 (495.938,123.391)-(582.812,299.16) batch id : 0
[28,1] element, prob = 0.0205231 (472.188,214.691)-(485.312,238.293) batch id : 0
[29,1] element, prob = 0.0200195 (451.875,264.586)-(469.375,305.992) batch id : 0
[30,1] element, prob = 0.0196075 (232.969,144.301)-(276.406,311.582) batch id : 0
[31,1] element, prob = 0.019455 (429.375,185.5)-(458.75,265.828) batch id : 0
[32,1] element, prob = 0.0193481 (454.062,250.301)-(466.562,276.801) batch id : 0
[33,1] element, prob = 0.0192566 (469.688,228.977)-(486.562,269.969) batch id : 0
[34,1] element, prob = 0.0191956 (82.5,267.898)-(125.938,321.312) batch id : 0
[35,1] element, prob = 0.0191498 (509.062,229.391)-(522.188,260.031) batch id : 0
[36,1] element, prob = 0.0186462 (153.281,285.91)-(201.719,384.043) batch id : 0
[37,1] element, prob = 0.0186005 (471.25,164.693)-(488.75,202.373) batch id : 0
[38,1] element, prob = 0.0186005 (477.188,167.488)-(524.062,307.855) batch id : 0
[39,1] element, prob = 0.0183411 (551.562,160.242)-(597.812,285.703) batch id : 0
[40,1] element, prob = 0.0181427 (452.188,220.902)-(471.562,266.035) batch id : 0
[41,1] element, prob = 0.0180511 (252.031,-3.41602)-(480.625,326.281) batch id : 0
[42,1] element, prob = 0.0180511 (216.875,119.043)-(256.25,256.098) batch id : 0
[43,1] element, prob = 0.0178528 (461.562,140.574)-(498.438,222.766) batch id : 0
[44,1] element, prob = 0.0178528 (453.125,210.551)-(467.5,234.152) batch id : 0
[45,1] element, prob = 0.0175934 (508.75,211.793)-(521.875,237.465) batch id : 0
[46,1] element, prob = 0.0173492 (451.875,198.75)-(472.5,243.055) batch id : 0
[ INFO ] Image out_0.bmp created!
total inference time: 158.2
Average running time of one iteration: 158.2 ms
Throughput: 6.32111 FPS
[ INFO ] Execution successful
strong@foreverstrong:~/inference_engine_samples/intel64/Release$
Sample Output
The application outputs an image (out_0.bmp
) with detected objects enclosed in rectangles. It outputs the list of classes of the detected objects along with the respective confidence values and the coordinates of the rectangles to the standard output stream.
See Also
*[Using Inference Engine Samples (./docs/Inference_Engine_Developer_Guide/Samples_Overview.md)