Я пытаюсь запустить свою собственную модель для обнаружения объектов. Я создал свой набор данных из облака Google - Vision (https://console.cloud.google.com/vision/) (я поместил изображения в рамку и пометил их), и он выглядит так:
After training the model, I downloaded the TFLite files (labelmap.txt, model.tflite and a json file) from here:
Then, I added them to the Android Object Detection example ( https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android).
But when I run the project it crashes:
2020-07-12 18:03:05.160 14845-14883/? E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.lite.examples.detection, PID: 14845
java.lang.IllegalArgumentException: Cannot copy to a TensorFlowLite tensor (normalized_input_image_tensor) with 307200 bytes from a Java Buffer with 4320000 bytes.
at org.tensorflow.lite.Tensor.throwIfSrcShapeIsIncompatible(Tensor.java:423)
at org.tensorflow.lite.Tensor.setTo(Tensor.java:189)
at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:154)
at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:343)
at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.recognizeImage(TFLiteObjectDetectionAPIModel.java:197)
at org.tensorflow.lite.examples.detection.DetectorActivity$2.run(DetectorActivity.java:182)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
I tried changing the parameters TF_OD_API_IS_QUANTIZED to false and labelOffset to 0, and also I modified this line from the TFLiteObjectDetectionAPIModel.java to d.imgData = ByteBuffer.allocateDirect(_4_ * d.inputSize * d.inputSize * 3 * numBytesPerChannel);
(I replaced 1 for 4)
I am new to this, I would really appreciate if someone could help me understand and resolve the error. Thank you!
Update:
Here are the tflite files : https://drive.google.com/drive/folders/11QT8CgaYF2EseORgGCceh4DT80_pMiFM?usp=sharing (мне все равно, правильно ли модель распознает квадраты и круги, я просто хочу проверить, компилируется ли она на приложение android, а потом я его улучшу)