-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashing #5
Comments
And i tried |
Sorry didn't noticed the issues of the repo are you still facing the issue? |
Can you share your code? |
Here is my codes class NSFWDetector { final String modelPath; bool isInitialized = false; Future detectInPhoto(String photoPath) async {
} class ImageSourceSheet extends StatelessWidget { // Constructor // Callback function to return image file bool _isNSFW = false; Future selectedImage(BuildContext context, File? image) async {
} @OverRide |
I getting this error on your example app, lastest android studio and lastest flutter sdk btw. I think my codes work right but idk your plugin or tensorflow not work on lastest flutter version :/ |
Example app might be having error because running it on simulator causes GPU constraints. Your problem might be that android is compressing the model in the release build when you are storing it locally if you move the model to firebase and use firebase_ml_model_downloader to download the model and give the path of the model to the plugin it might work. This will reduce the appsize as well as things might work for you. I am very busy currently so I can't look into the issues right now give me few days after that I can look into the issues. If you want something urgent and you can directly use tensorflow. |
I build the app on real android device but I was not able to encounter any error in debug build |
D/TAG (12566): onMethodCall: initNsfw
I/tflite (12566): Created TensorFlow Lite delegate for GPU.
D/io.github.devzwy.nsfw.NSFWHelper(12566): 尝试从传入的模型路径读取模型
I/tflite (12566): Initialized TensorFlow Lite runtime.
D/io.github.devzwy.nsfw.NSFWHelper(12566): 模型加载成功!
D/io.github.devzwy.nsfw.NSFWHelper(12566): NSFWHelper初始化成功!GPU加速已成功开启
D/TAG (12566): onMethodCall: getPhotoNSFWScore
E/AndroidRuntime(12566): FATAL EXCEPTION: DefaultDispatcher-worker-1
E/AndroidRuntime(12566): Process: com.strapps.closer, PID: 12566
E/AndroidRuntime(12566): java.lang.IllegalArgumentException: Cannot convert between a TensorFlowLite buffer with 150528 bytes and a Java Buffer with 602112 bytes.
E/AndroidRuntime(12566): at org.tensorflow.lite.Tensor.throwIfShapeIsIncompatible(Tensor.java:332)
E/AndroidRuntime(12566): at org.tensorflow.lite.Tensor.throwIfDataIsIncompatible(Tensor.java:305)
E/AndroidRuntime(12566): at org.tensorflow.lite.Tensor.setTo(Tensor.java:123)
E/AndroidRuntime(12566): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:150)
E/AndroidRuntime(12566): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:311)
E/AndroidRuntime(12566): at org.tensorflow.lite.Interpreter.run(Interpreter.java:272)
E/AndroidRuntime(12566): at io.github.devzwy.nsfw.NSFWHelper.getNSFWScore(NSFWHelper.kt:227)
E/AndroidRuntime(12566): at io.github.devzwy.nsfw.NSFWHelper$getNSFWScore$1.invokeSuspend(NSFWHelper.kt:173)
E/AndroidRuntime(12566): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime(12566): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/AndroidRuntime(12566): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
E/AndroidRuntime(12566): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
E/AndroidRuntime(12566): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
E/AndroidRuntime(12566): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/Process (12566): Sending signal. PID: 12566 SIG: 9
Lost connection to device.
The text was updated successfully, but these errors were encountered: