I trained model using Google AutoMl then produce tensorflow lite model to detect plastic bottle etc. I would like to use in the tensorflowlite object detection android example but failed
this the github that i refer : https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android
i replaced the tflite file and the txt file with my own project, the installation on android studio its work well but the apps its crashed and didnt work
public class DetectorActivity extends CameraActivity implements OnImageAvailableListener {
private static final Logger LOGGER = new Logger();
// Configuration values for the prepackaged SSD model.
private static final int TF_OD_API_INPUT_SIZE = 300;
private static final boolean TF_OD_API_IS_QUANTIZED = true;
private static final String TF_OD_API_MODEL_FILE = "swai.tflite";
private static final String TF_OD_API_LABELS_FILE = "file:///android_asset/swai.txt";
private static final DetectorMode MODE = DetectorMode.TF_OD_API;
// Minimum detection confidence to track a detection.
private static final float MINIMUM_CONFIDENCE_TF_OD_API = 0.5f;
private static final boolean MAINTAIN_ASPECT = false;
private static final Size DESIRED_PREVIEW_SIZE = new Size(640, 480);
private static final boolean SAVE_PREVIEW_BITMAP = false;
private static final float TEXT_SIZE_DIP = 10;
OverlayView trackingOverlay;
this the eror that i found when deploying in the virtual devices
09-17 13:32:09.283 1599-1856/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 462848
09-17 13:32:09.325 9980-10000/org.tensorflow.lite.examples.detection E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.lite.examples.detection, PID: 9980
java.lang.IllegalArgumentException: Cannot convert between a TensorFlowLite buffer with 786432 bytes and a ByteBuffer with 270000 bytes.
at org.tensorflow.lite.Tensor.throwIfShapeIsIncompatible(Tensor.java:272)
at org.tensorflow.lite.Tensor.throwIfDataIsIncompatible(Tensor.java:249)
at org.tensorflow.lite.Tensor.setTo(Tensor.java:110)
at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:151)
at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:275)
at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.recognizeImage(TFLiteObjectDetectionAPIModel.java:193)
at org.tensorflow.lite.examples.detection.DetectorActivity$2.run(DetectorActivity.java:181)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
I think there is no settings to implement this model work, Any Sugesstion please? Thanks!