Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Yang__Kenny
Beginner
128 Views

model Optimizer mean and scale value problem

Hi, 

I have a tensorflow classify slim model with 2 different ways of preprocessing.

According to openvino document, i have to assign --mean_value and --scale to add pre-processing into converted IR. 

in 1st preprocessing, i use below tensorflow code to cope with pre-processing and convert with --mean_value [127.5,127.5, 127.5] --scale [127.5]

image = tf.image.convert_image_dtype(image, dtype=tf.float32)

image = tf.subtract(image, 0.5)

image = tf.multiply(image, 2.0)

the IR precision in softmax output is very similar to tensorflow softmax output when run inference. 

In 2nd preprocssing, i use below and use same mean/scale --mean_value [127.5, 127.5,127.5] --scale [127.5] in convert IR.

image = tf.image.convert_image_dtype(image, dtype=tf.float32)

image = tf.image.per_image_standardization(image)

the IR precision in softmax output has significant different and prediction is wrong compared to tensorflow inference.

My question is how can i give correct mean/scale value with my 2nd pre-processing code for MO conversion ?

Best,
Kenny

0 Kudos
1 Reply
Yang__Kenny
Beginner
128 Views

Hi,

I use below code for preprocessing image when train model and convert  tf model with --mean_value[127.5,127,127.5] and --scale 127.5 to IR.

image = tf.image.decode_jpeg(image_buffer, channels=3) 

image = tf.image.convert_image_dtype(image, dtype=tf.float32)

Image = tf.image.per_image_standardization(image)

Image = tf.clip_by_vale(image, -1, 1) 

Inference OpenVino Softmax precision can be close to 5 places  after decimal point compared to inference tensorflow model which only train 300 epochs.

But, Inference OpenVino Softmax precision is quite different   compared to inference tensorflow model which  train 20000 epochs. 

Why different epochs model will have quite different precision in their corresponding openvino IR with same convert parameters?

 

 

 

 

Reply