Closed gitE0Z9 closed 3 years ago
Here is my workaround, it doesn't seem efficient though:
for(uint i=0; i< input->bytes;i++){
input->data.int8[i] = int(input->params.zero_point + (float(input->data.uint8[i]) / 255) / input->params.scale);
}
Rather than convert uint8->float->int8, you should be able to convert directly between quantized types. It's worth noting that conceptually we are doing the same thing, just skipping some intermediate steps. Since scale int uint8 is the same as scale for asymmetric quantized int8, we only need to convert zero point from 128 to the new int8 zero point. This means that this code should convert unit8->int8:
for(uint i=0; i< input->bytes;i++){
input->data.int8[i] = input->data.uint8[i] + input->params.zero_point - 128;
}
Hi, I got confused about how to do image preprocessing like below, I am using himax board.
But the image input on this board is uint8 and rescale to int8 by their sdk.
I am wondering how should I fix this problem in cpp to quantize and normalize input in float32 then convert back to int8 ?
Could someone share some thoughts?
The model is full integer quantized.