OpenCV dnn import quantized model

asked 2018-12-17 09:01:56 -0600

peter_cz gravatar image

updated 2018-12-18 01:34:58 -0600

Is it possible to load NN quantized model of tensorflow?

The nodes and weights of a neural network are originally stored as 32-bit floating point numbers. The simplest motivation for quantization is to compress each float value to an eight-bit integer.

If so how?

Thank you.

edit retag flag offensive close merge delete

Comments

1

If you mean https://github.com/tensorflow/tensorf... so answer is yes. It supports import of quantized models from TensorFlow. However all the computations are made in FP32.

dkurt gravatar imagedkurt ( 2018-12-18 01:15:09 -0600 )edit

So what's benifit of that though?

peter_cz gravatar imagepeter_cz ( 2018-12-18 01:37:29 -0600 )edit

I guess even TensorFlow will convert the weights in FP32 because it' s just a way to compress model size (read the docs: This is mostly useful for shrinking file sizes). You need to use quantize_nodes instead.

dkurt gravatar imagedkurt ( 2018-12-18 02:13:40 -0600 )edit

Can dnn module leverage on that (some speed-up) if used quantized model?

peter_cz gravatar imagepeter_cz ( 2018-12-18 07:04:28 -0600 )edit