If the network assumes the RGB inputs, the Model Optimizer can swap the channels in the first convolution using the --reverse_input_channels command line option, so we do not need to convert the inputs to RGB every time we get the BGR image, for example, from OpenCV
Thanks, but this is not exactly what I'm looking for. The image comes interleaved (e.g. NHWC) from the decoder, but the network requires planar (e.g. NCHW). Does OpenVino have a conversion API (explicit or implicit), or does the conversion need to happen externally.
By default, Inference Engine accepts the planar and not interleaved inputs in NCHW, so the NHWC (which is exactly the interleaved layout) should be specified explicitly.
The InferenceEngine::NHWC layout is not supported natively by most InferenceEngine plugins, so internal conversion might happen.
Kindly refer to OpenCV* Interoperability Example
But that's just the point -- internal conversions do not seem to be happening.
Providing NHWC blob to a network expecting NCHW input results in
`[PARAMETER_MISMATCH] Failed to set input Blob. Dimensions mismatch.`
exception being thrown. OpenCV samples you refer to, seem to use both approaches (matU8ToBlob performs external NHWC->NCHW conversion; wrapMat2Blob wraps a NHWC blob and passes it to input). However, the latter never seems to work for me.
You may try doing the conversion within the decoder itself before feeding it into the inference engine.
You can also refer to the object_detection_demo_ssd_async.py to modify the layout.