1

The model I'm using is the EAST text detector. I tried to quantize the model so I can compile it for inference on Coral Edge TPU. I used the following command:

toco \
  --graph_def_file=frozen_east_text_detection.pb \
  --output_file=tflite_model.tflite \
  --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE \
  --inference_type=QUANTIZED_UINT8 \
  --input_shape="1,320, 320,3" \
  --input_array=input_images \
  --output_array='feature_fusion/concat_3','feature_fusion/Conv_7/Sigmoid' \
  --std_dev_values=1 --mean_values=0 \
  --default_ranges_min=0 \
  --default_ranges_max=255

The conversion and compilation for Edge TPU is successful. The problem is the output that the converted model yields. I don't understand how to transform it to 'normal' coordinates.

The model yields two variables; geo_map and score_map:

[{'name': 'feature_fusion/concat_3', 'index': 42, 'shape': array([ 1, 80, 80,  5], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (1.0, 0)}, 
{'name': 'feature_fusion/Conv_7/Sigmoid', 'index': 23, 'shape': array([ 1, 80, 80,  1], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.00390625, 0)}]

The boxes the model yields are like

array([[-77.0837, 256.9999],
       [176.9139, 256.9999],
       [176.9139, 254.9997],
       [-77.0837, 254.9997]], dtype=float32)

Since the std parameter in quantization for score_map is not equal to 1, I also tried multiplying the score map by that factor which yielded no result.

I tried many versions of post-training quantization, unsuccessfully. According the answer from here, I think there shouldn't be any more transformations, but the negative values are obviously not wanted. My question is: is the result from this quantized model meaningful? Am I missing something?

I also tried using representative dataset generator but then compilation for Edge TPU aborted.

Waddles
  • 226
  • 2
  • 9

0 Answers0