'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 two coordinates (x and y) which corresponds to the neuron i and i+1. There are 22 joints in this case. Using the TFLite model, the predicted coordinates (red) are very similar to ground truth ones (blue).

But when I quantize, these results are so bad
These are the output of each coordinate (predicted, ground truth)
X0 = (75.85,64.24) Diff = 11.61
X1 = (55.79,43.36) Diff = 12.43
X2 = (80.86,68.24) Diff = 12.62
X3 = (52.66,39.51) Diff = 13.15
X4 = (82.12,69.49) Diff = 12.63
X5 = (50.15,37.42) Diff = 12.72
X6 = (85.25,70.42) Diff = 14.84
X7 = (48.27,35.87) Diff = 12.40
X8 = (83.37,68.90) Diff = 14.47
X9 = (48.27,37.08) Diff = 11.18
X10 = (82.74,67.45) Diff = 15.30
X11 = (50.78,38.98) Diff = 11.79
X12 = (72.09,59.65) Diff = 12.44
X13 = (60.18,48.35) Diff = 11.83
X14 = (73.34,60.95) Diff = 12.40
X15 = (60.81,49.41) Diff = 11.40
X16 = (73.34,60.60) Diff = 12.74
X17 = (62.06,51.45) Diff = 10.61
X18 = (73.34,59.57) Diff = 13.78
X19 = (63.31,52.89) Diff = 10.42
X20 = (74.60,62.95) Diff = 11.65
X21 = (59.55,48.71) Diff = 10.84
Y0 = (47.01,53.75) Diff = -6.74
Y1 = (49.52,52.70) Diff = -3.18
Y2 = (59.55,67.89) Diff = -8.34
Y3 = (59.55,65.91) Diff = -6.36
Y4 = (76.48,81.06) Diff = -4.58
Y5 = (71.46,79.27) Diff = -7.81
Y6 = (80.86,85.55) Diff = -4.68
Y7 = (74.60,83.44) Diff = -8.84
Y8 = (80.86,85.61) Diff = -4.74
Y9 = (75.22,84.10) Diff = -8.88
Y10 = (78.98,83.94) Diff = -4.96
Y11 = (73.97,82.61) Diff = -8.64
Y12 = (73.97,81.12) Diff = -7.15
Y13 = (75.22,81.12) Diff = -5.90
Y14 = (93.40,100.35) Diff = -6.95
Y15 = (93.40,101.04) Diff = -7.64
Y16 = (110.33,117.44) Diff = -7.12
Y17 = (109.70,117.75) Diff = -8.05
Y18 = (112.21,119.59) Diff = -7.39
Y19 = (110.95,119.97) Diff = -9.02
Y20 = (117.85,126.34) Diff = -8.49
Y21 = (116.60,126.85) Diff = -10.26
Do you know what's happening? Width of image is 160 and height is 120.
Thank you!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

