I am testing Google Cloud AutoML vision, I have completed the training process, have an exported edge device tflite model, over 100k images, 25 labels.
Following the instructions in these two tutorials and code from the below repo: https://cloud.google.com/vision/automl/docs/edge-quickstart https://cloud.google.com/vision/automl/docs/tflite-android-tutorial https://github.com/googlecodelabs/tensorflow-for-poets-2/tree/master/android/tflite
I am assuming the problem is not with the custom tflite problem, but some sort of compatibility issue that the tutorial does not account for (either in error or because it is outdated?)
The sample app with pretrained model included in the github repo above works without any changes. When I swap out the tflite packages and make the code changes requested by the tutorial, I encounter a BufferOverflowException
I am assuming the problem is not with the custom tflite problem, but some sort of compatibility issue that the tutorial does not account for (either in error or because it is outdated?)
The sample app with pretrained model included in the github repo above works without any changes. When I swap out the tflite packages and make the code changes requested by the tutorial, I encounter a BufferOverflowException
Code crashes at the try/catch block (added by me to see more of what was going on)
'''
private void convertBitmapToByteBuffer(Bitmap bitmap) {
if (imgData == null) {
return;
}
imgData.rewind();
bitmap.getPixels(intValues, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
// Convert the image to floating point.
int pixel = 0;
long startTime = SystemClock.uptimeMillis();
for (int i = 0; i < DIM_IMG_SIZE_X; ++i) {
for (int j = 0; j < DIM_IMG_SIZE_Y; ++j) {
final int val = intValues[pixel++];
try
{
imgData.putFloat((((val >> 16) & 0xFF))/IMAGE_STD);
imgData.putFloat((((val >> 8) & 0xFF))/IMAGE_STD);
imgData.putFloat((((val) & 0xFF))/IMAGE_STD);
}
catch (BufferOverflowException e)
{
Log.e("TfLiteCameraDemo", "Exception caught: ", e);
}
}
}
long endTime = SystemClock.uptimeMillis();
Log.d(TAG, "Timecost to put values into ByteBuffer: " + Long.toString(endTime - startTime));
}
'''
Imported tflite model, following instruction by tutorials in link above, crashes.
*Beta* This product or feature is in a pre-release state and might change or have limited support. For more information, see Product launch stages.I would send feedback on the page and/or create an issue ticket. - Morrison Chang