Questions tagged [quantization]

Use this tag for questions related to quantization of any kind, such as vector quantization.

Quantization, in mathematics and digital signal processing, is the process of mapping a large set of input values to a (countable) smaller set.

For more, please read the Wikipedia article for more.

444 questions
4
votes
1 answer

Spatially invariant Vector Quantization

I am trying to implement the algorithm by Jason Hipp et al. There is also a presentation, which is shorter and more comprehensive. A brief description of their approach: They use Vector Quantization as a tool to distinguish between foreground and…
4
votes
2 answers

Applying a Median Cut color reduction algorithm's output palette to the source image

So I'm beginning to look into "simple" color reduction to apply to images. I've spent the last day researching how this works, and managed to find what seems to be a decent algorithm to experiment with here: Median cut algorithm The output here is a…
dajaffe
  • 855
  • 13
  • 34
3
votes
0 answers

How to verify if the tensorflow code trains completely in FP16?

I'm trying to train a TensorFlow (version 2.11.0) code in float16. I checked that FP16 is supported on the RTX 3090 GPU. So, I followed the below link to train the whole code in reduced…
3
votes
0 answers

How does int8 inference really works?

Not sure if this is the right place to ask this kind of question, but I can’t really find an example of how int8 inference works at runtime. What I know is that, given that we are performing uniform symmetric quantisation, we calibrate the model,…
3
votes
3 answers

Color Quantization Algorithm

I'm working on a color quantization algorithm. This is the basic process: Convert the image to a set of three dimensional vectors (RGB space for instance). Put that set in a list of sets. While the number of sets in the list is less than the number…
Nicolas Repiquet
  • 9,097
  • 2
  • 31
  • 53
3
votes
0 answers

Does anyone know how Adobe Color's 'Extract Theme' function works to produce a colour palette?

I am trying to implement a system for extracting colour palettes from an image in C++. I basically want something exactly like the way Adobe Color's 'Extract Theme' function works. I have tried implementing a version of median cut, but the averaging…
3
votes
0 answers

Full integer post training quantization in neural network regression model

I have trained a Resnet neural network having four fully connected layers and an output of 44 neurons. I want to run it on a Coral.ai TPU and I quantize using the post training quantization in 8bits. In this case, each joint has location composed by…
3
votes
1 answer

Is it possible to convert tflite to pb?

Is it possible to convert tflite model to pb model? I have seen many articles about converting "pb->tflite", but no chance to find "tflite->pb". If it is not possible, is there any way I can do the quantization with only tflite file? (so far, I…
Jyoona
  • 33
  • 4
3
votes
2 answers

How to feed multiple inputs TFlite model in Python interpreter

How can you feed 2 inputs within a tflite model. I built a tf model => convert into tflite text = tf.keras.Input((64), name="text") intent = tf.keras.Input(shape=(25,), name="intent") layer = tf.keras.layers.Embedding(dataset.vocab_size, 128,…
3
votes
1 answer

Is there a way to convert the quint8 pytorch format to np.uint8 format?

I'm using the code below to get the quantized unsiged int 8 format in pytorch. However, I'm not able to convert the quant variable to the to np.uint8. Is there possible to do that? import torch quant = torch.quantize_per_tensor(torch.tensor([-1.0,…
Flávio Mendes
  • 137
  • 1
  • 1
  • 10
3
votes
1 answer

How to convert a tflite model into a frozen graph (.pb) in Tensorflow?

I would like to convert an integer quantized tflite model into a frozen graph (.pb) in Tensorflow. I read through and tried many solutions on StackOverflow and none of them worked. Specifically, toco didn't work (output_format cannot be…
nikolai_ye
  • 51
  • 2
3
votes
3 answers

No performance improvement using quantization model in pytorch

I have trained a model in pytorch with float data type. I want to improve my inference time by converting this model to quantized model. I have used torch.quantization.convert api to convert my model's weight to uint8 data type. However, when I use…
3
votes
1 answer

How to backprop for custom quantization in tensorflow 2.0?

I would like to backprop with identity (straight through estimator) when I quantize a tensor in tf2.0 eager mode. I am able to perform the forward pass, but encounter ValueError: No gradients provided for any variable.. error when trying to apply…
3
votes
3 answers

Quantization of Onnx model

I am trying to quantize an ONNX model using the onnxruntime quantization tool. My code is below for quantization: import onnx from quantize import quantize, QuantizationMode # Load the onnx model model =…
Parag Jain
  • 612
  • 2
  • 14
  • 31
3
votes
1 answer

Tensorflow qunatization - what does zero point mean

I am trying to understand quantization in tensorflow and I am following this tutorial. https://heartbeat.fritz.ai/8-bit-quantization-and-tensorflow-lite-speeding-up-mobile-inference-with-low-precision-a882dfcafbbd In the tutorial it says that, the…
black sheep
  • 369
  • 4
  • 13