2

I'm trying to quantize the ssd_mobilenetv2_oidv4 model from Tensorflow object detection model zoo, but after quantization the model stops working entirely.

To get the tflite graph, I ran

export_tflite_ssd_graph.py \
--pipeline_config_path=$CONFIG_FILE \
--trained_checkpoint_prefix=$CHECKPOINT_PATH \
--output_directory=$OUTPUT_DIR \
--add_postprocessing_op=true

Then to generate the tflite file, I ran

tflite_convert \
--graph_def_file=$OUTPUT_DIR/tflite_graph.pb \
--output_file=$OUTPUT_DIR/detect.tflite \
--input_shapes=1,300,300,3 \
--input_arrays=normalized_input_image_tensor \
--output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' \
--inference_type=QUANTIZED_UINT8 \
--mean_values=128 \
--std_dev_values=128 \
--change_concat_input_ranges=false \
--allow_custom_ops \
--default_ranges_min=0 \
--default_ranges_max=6

Then I used this example android app to test it. When I try running it, it just shows 10 bounding that never move that are apparently detecting a tortoise with 50% accuracy. I'm not sure what all that means, but Tortoise is the first class in the label map if that's relevant.

Anyone know what's going on?

Here's a screenshot of the quantized model in action: Screenshot of bounding boxes

Sam Perlmutter
  • 1,198
  • 2
  • 8
  • 9

0 Answers0