openvino/inference-engine/samples/style_transfer_sample
Artemy Skrebkov aa23fbb9d3
Update benchmark_app to pass precision and layout via command line (#4167)
* Move processing ins and outs into samples/common

    - To re-use it in compile_tool and benchmark_app

* Extract common into samples_utils lib

    - To re-use it in samples and tools

* Move processLayout into samples_utils

* Clean up

* Enable warning as errors for samples_utils

* Cannot set precision or layout for compiled network

* Remove layout setting for benchmark_app

  - It requires further discussion

* Fix compilation of samples

* Fix one more sample

* Fix windows build

* Update README.md

* One more fix for windows

* Fix OpenVino ONNX CI build

* More build fixes

* Move os and vpu common into utils

* Fix build for myriad tools

* Fix windows build

* Export gflags
2021-02-11 15:53:19 +03:00
..
CMakeLists.txt Update benchmark_app to pass precision and layout via command line (#4167) 2021-02-11 15:53:19 +03:00
README.md Modified samples to support ONNX models (#1680) 2020-08-26 18:53:24 +03:00
main.cpp Fixed static analysis issues (#3254) 2020-11-22 20:42:53 +03:00
style_transfer_sample.h Publishing 2020.1 content 2020-02-11 22:48:49 +03:00

README.md

Neural Style Transfer C++ Sample

This topic demonstrates how to run the Neural Style Transfer sample application, which performs inference of style transfer models.

NOTE: The OpenVINO™ toolkit does not include a pre-trained model to run the Neural Style Transfer sample. A public model from the Zhaw's Neural Style Transfer repository can be used. Read the Converting a Style Transfer Model from MXNet* topic from the Model Optimizer Developer Guide to learn about how to get the trained model and how to convert it to the Inference Engine format (*.xml + *.bin).

The sample accepts models in ONNX format (.onnx) that do not require preprocessing.

NOTE: 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_channels argument specified. For more information about the argument, refer to When to Reverse Input Channels section of Converting a Model Using General Conversion Parameters.

Running

Running the application with the -h option yields the following usage message:

./style_transfer_sample --help
InferenceEngine:
    API version ............ <version>
    Build .................. <number>

style_transfer_sample [OPTION]
Options:

    -h                      Print a usage message
    -i "<path>"             Required. Path to a .bmp image file or a sequence of paths separated by spaces.
    -m "<path>"             Required. Path to an .xml file with a trained model.
    -d "<device>"           The target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The sample looks for a suitable plugin for the device specified.
    -mean_val_r,
    -mean_val_g,
    -mean_val_b             Mean values. Required if the model needs mean values for preprocessing and postprocessing

Running the application with the empty list of options yields the usage message given above and an error message.

To perform inference of an image using a trained model of NST network on Intel® CPUs, use the following command:

./style_transfer_sample -i <path_to_image>/cat.bmp -m <path_to_model>/1_decoder_FP32.xml

Sample Output

The application outputs an image (out1.bmp) or a sequence of images (out1.bmp, ..., out<N>.bmp) which are redrawn in style of the style transfer model used for sample.

See Also