Upon running the Android TF Detect Demo and using my retrained 3 class ssd_mobilenet_v1_coco model my TF detect Demo crashes giving an IndexOutOfBoundException which is
12-26 17:53:13.931 22429-25212/org.tensorflow.demo E/AndroidRuntime: FATAL EXCEPTION: inference Process: org.tensorflow.demo, PID: 22429 java.lang.ArrayIndexOutOfBoundsException: length=3; index=3 at java.util.Vector.arrayIndexOutOfBoundsException(Vector.java:907) at java.util.Vector.elementAt(Vector.java:328) at java.util.Vector.get(Vector.java:442) at org.tensorflow.demo.TensorFlowObjectDetectionAPIModel.recognizeImage(TensorFlowObjectDetectionAPIModel.java:194) at org.tensorflow.demo.DetectorActivity$3.run(DetectorActivity.java:289) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61)
which comes from
for (int i = 0; i <= outputScores.length; ++i) {
final RectF detection =
new RectF(
outputLocations[4 * i + 1] * inputSize,
outputLocations[4 * i] * inputSize,
outputLocations[4 * i + 3] * inputSize,
outputLocations[4 * i + 2] * inputSize);
pq.add(new Recognition("" + i, labels.get((int) outputClasses[i]), outputScores[i], detection));
}