我正在尝试使用Android相机使用Firebase ML Kit将图像作为输入输入到卷积神经网络模型中。
我已经将模型上传到Firebase(作为tf lite模型)。
我的模型采用(56、75、3)像素图像作为输入,并尝试将图像分为4类。
我正在努力适当地调整位图的大小以适合{1,56,75,3}的字节数组
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); //getting bitmap from camera
//Boilerplate code to set up Firebase
FirebaseModelInputOutputOptions inputOutputOptions = new FirebaseModelInputOutputOptions.Builder().setInputFormat(0, FirebaseModelDataType.BYTE, new int[]{1, 56, 75, 3}).setOutputFormat(0, FirebaseModelDataType.BYTE, new int[]{1, 4}).build();
Bitmap scaled_bitmap Bitmap.createScaledBitmap(bitmap, 56, 75, true)
如何将位图转换为[1] [56] [75] [3]字节数组,以便可以将位图输入模型?
byte[][][][] input = new byte[1][56][75][3];
input = ?? need help here to convert bitmap to byte array