FaceRecognition_With_FaceNet_Android icon indicating copy to clipboard operation
FaceRecognition_With_FaceNet_Android copied to clipboard

Internal error: Failed to apply delegate with GpuDelegate

Open ruirui1128 opened this issue 2 years ago • 3 comments

at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8387) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) Caused by: java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: ModifyGraphWithDelegate is disallowed when graph is immutable. at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegate(Native Method) at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegates(NativeInterpreterWrapper.java:373) at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:85) at org.tensorflow.lite.NativeInterpreterWrapper.(NativeInterpreterWrapper.java:63) at org.tensorflow.lite.Interpreter.(Interpreter.java:277) at com.ml.quaterion.facenetdetection.model.FaceNetModel.(FaceNetModel.kt:73) at com.ml.quaterion.facenetdetection.MainActivity.onCreate(MainActivity.kt:122) at android.app.Activity.performCreate(Activity.java:8121) at android.app.Activity.performCreate(Activity.java:8109)


private val useGpu = true private val useXNNPack = true private val modelInfo = Models.FACENET_QUANTIZED

ruirui1128 avatar Sep 09 '22 09:09 ruirui1128

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
 Caused by: java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: Following operations are not supported by GPU delegate:
FULLY_CONNECTED: Max version supported: 4. Requested version 9.
180 operations will run on the GPU, and the remaining 1 operations will run on the CPU.
ModifyGraphWithDelegate is disallowed when graph is immutable.
    at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegate(Native Method)
    at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegates(NativeInterpreterWrapper.java:373)
    at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:85)
    at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:63)
    at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:277)
    at com.ml.quaterion.facenetdetection.model.FaceNetModel.<init>(FaceNetModel.kt:73)
    at com.ml.quaterion.facenetdetection.MainActivity.onCreate(MainActivity.kt:122)
    at android.app.Activity.performCreate(Activity.java:8121)
    at android.app.Activity.performCreate(Activity.java:8109)

private val useGpu = true private val useXNNPack = true private val modelInfo = Models.FACENET

ruirui1128 avatar Sep 09 '22 09:09 ruirui1128

I face this error too, but if i comment "setUseNNAPI(true)" in FaceNetModel class this error gone, I using android with API 31

denny-zefanya avatar Nov 10 '22 06:11 denny-zefanya

@denny-zefanya Let me look into the error closely. It seems to be an incompatibility of TF ops with the GpuDelegate.

shubham0204 avatar Nov 10 '22 12:11 shubham0204