You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code is not working with inceptionV3 model [cannot convert an tensorflowlite tensor with type float32 to a java object of type [[b (which is compatible with the tensorflowlite type uint8)]
#3
I have changed the required things for inceptionV3 as mentioned below but still its not working. its giving me an error :
cannot convert an tensorflowlite tensor with type float32 to a java object of type [[b (which is compatible with the tensorflowlite type uint8)
Changes that I did :
private static final int INPUT_SIZE = 299;
/**
* The inception net requires additional normalization of the used input.
*/
private static final int IMAGE_MEAN = 128;
private static final float IMAGE_STD = 128.0f;
private ByteBuffer convertBitmapToByteBufferForInceptionV3(Bitmap bitmap) {
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(BATCH_SIZE * inputSize * inputSize * PIXEL_SIZE * 4);
byteBuffer.order(ByteOrder.nativeOrder());
int[] intValues = new int[inputSize * inputSize];
bitmap.getPixels(intValues, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
int pixel = 0;
for (int i = 0; i < inputSize; ++i) {
for (int j = 0; j < inputSize; ++j) {
final int val = intValues[pixel++];
I have changed the required things for inceptionV3 as mentioned below but still its not working. its giving me an error :
cannot convert an tensorflowlite tensor with type float32 to a java object of type [[b (which is compatible with the tensorflowlite type uint8)
Changes that I did :
private static final int INPUT_SIZE = 299;
/**
* The inception net requires additional normalization of the used input.
*/
private static final int IMAGE_MEAN = 128;
private static final float IMAGE_STD = 128.0f;
private ByteBuffer convertBitmapToByteBufferForInceptionV3(Bitmap bitmap) {
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(BATCH_SIZE * inputSize * inputSize * PIXEL_SIZE * 4);
byteBuffer.order(ByteOrder.nativeOrder());
int[] intValues = new int[inputSize * inputSize];
bitmap.getPixels(intValues, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
int pixel = 0;
for (int i = 0; i < inputSize; ++i) {
for (int j = 0; j < inputSize; ++j) {
final int val = intValues[pixel++];
The text was updated successfully, but these errors were encountered: