0

I successfully retrained mobilenet quantized model (architecture="mobilenet_1.0_128_quantized") with my own image dataset:

python3 -m scripts.retrain \
  --bottleneck_dir=tf_files/bottlenecks_quant \
  --how_many_training_steps=50000 \
  --model_dir=tf_files/models/ \
  --summaries_dir=tf_files/training_summaries/"mobilenet_1.0_128_quant" \
  --output_graph=tf_files/retrained_graph_50000_1.0_128.pb \
  --output_labels=tf_files/retrained_labels.txt \
  --architecture="mobilenet_1.0_128_quantized" \
  --image_dir=images

When I try to convert .pb file to .tflite using

toco \
  --graph_def_file=tf_files/retrained_graph_50000_1.0_128.pb \
  --output_file=tf_files/retrained_graph_50000_1.0_128.tflite \
  --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE \
  --inference_type=QUANTIZED_UINT8 \
  --input_shape="1,128,128,3" \
  --input_array=input \
  --output_array=outputs \
  --std_dev_values=127.5 --mean_value=127.5

It fails with the next error:

ValueError: Invalid tensors 'outputs' were found.

user155
  • 775
  • 1
  • 7
  • 25
  • you need to provide output tensor names in `--output_array = ...` – Krunal V May 15 '19 at 10:04
  • @kruxx well as you can see I provided it `--output_array=outputs`. I used commands from https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/quantize – user155 May 15 '19 at 10:55
  • Yes! I know the command. But according to your error there is no `ouputs` named tensor in your .pb graph. Check [this](https://stackoverflow.com/questions/43517959/given-a-tensor-flow-model-graph-how-to-find-the-input-node-and-output-node-name) and try to verify your output node name. – Krunal V May 15 '19 at 14:15

0 Answers0