Article ID: 000089134 Content Type: Troubleshooting Last Reviewed: 05/20/2022

Wrong Prediction When Inferencing with Converted Keras* Model

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Methods to convert TensorFlow* models that are trained with images in RGB* order

Description
  • Correct result when inferencing with original Keras model.
  • Converted the Keras model into Intermediate Representation.
  • Wrong result when inferencing with the converted model.
Resolution

Most TensorFlow models are trained with images in RGB order.

By default, Inference Engine samples and demos expect input with BGR channels order.

Method 1:
Convert the model using the Model Optimizer tool with --reverse_input_channels argument. 

Method 2:
Change from RGB to BGR: 

im_cv = cv.imread('test2.jpg')
frame = cv.cvtColor(im_cv, cv.COLOR_RGB2BGR)

Additional information

Refer to When to Reverse Input Channels

Related Products

This article applies to 2 products