title: Cannot copy between TFLite tensor - illegal shape
body: <p>Im currently making my own model and all works fine with the tensorflow-for-poets-2 demo. I trained multiple pictures in different folders, and the app recognized it.</p>
  
  <p>Now I want to display a bounding box around the object. I found an example <a href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/examples/android" rel="nofollow noreferrer">here</a></p>
  
  <p>My problem is that my app is returning following error when I am adding my own tflite model:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: inference
  Process: org.tensorflow.lite.demo, PID: 3495
  java.lang.IllegalArgumentException: Cannot copy between a TensorFlowLite tensor with shape [1, 6] and a Java object with shape [1, 10, 4].
      at org.tensorflow.lite.Tensor.throwExceptionIfTypeIsIncompatible(Tensor.java:240)
      at org.tensorflow.lite.Tensor.copyTo(Tensor.java:116)
      at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:157)
      at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:229)
      at org.tensorflow.demo.TFLiteObjectDetectionAPIModel.recognizeImage(TFLiteObjectDetectionAPIModel.java:194)
      at org.tensorflow.demo.DetectorActivity$3.run(DetectorActivity.java:247)
      at android.os.Handler.handleCallback(Handler.java:789)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:164)
      at android.os.HandlerThread.run(HandlerThread.java:65)
  </code></pre>
  
  <p>How I trained them:</p>
  
  <pre><code>python3 scripts/retrain.py \
    --bottleneck_dir=bottlenecks \
    --how_many_training_steps=500 \
    --model_dir=inception \
    --output_graph=tf_files/retrained_graph.pb \
    --output_labels=tf_files/retrained_labels.txt \
    --image_dir=tf_files/ \
    --architecture mobilenet_1.0_224
  </code></pre>
  
  <p>Generating:</p>
  
  <pre><code>toco \
    --input_format=TENSORFLOW_GRAPHDEF \
    --input_file=tf_files/retrained_graph.pb \
    --output_format=TFLITE \
    --output_file=tf_files/optimized_graph.lite \
    --inference_type=FLOAT \
    --inference_input_type=FLOAT \
    --input_arrays=input \
    --output_arrays=final_result \
    --input_shapes=1,224,224,3\
    --mean_values=128 \
    --std_values=128 \
    --default_ranges_min=0 \
    --default_ranges_max=6
  </code></pre>
  
  <p>DetectorActivity.java</p>
  
  <pre><code>// Configuration values for the prepackaged SSD model.
  private static final int TF_OD_API_INPUT_SIZE = 224; // 300
  private static final boolean TF_OD_API_IS_QUANTIZED = false; // true
  private static final String TF_OD_API_MODEL_FILE = "optimized_graph.lite"; //detect.tflite
  private static final String TF_OD_API_LABELS_FILE = "file:///android_asset/retrained_labels.txt";
  </code></pre>