asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity
834 stars 249 forks source link

Custom model failed to run #253

Closed ShigemoriHakura closed 1 year ago

ShigemoriHakura commented 1 year ago

When init the model using BaseImagePredictor It returns:

Version: 2.11.0 Input [0]: name: serving_default_input:0, type: Float32, dimensions: [1,256,256,3], quantizationParams: {scale: 0 zeroPoint: 0} Output [0]: name: StatefulPartitionedCall:0, type: Float32, dimensions: [1,42], quantizationParams: {scale: 0 zeroPoint: 0} Output [1]: name: StatefulPartitionedCall:2, type: Float32, dimensions: [1,20], quantizationParams: {scale: 0 zeroPoint: 0} Output [2]: name: StatefulPartitionedCall:1, type: Float32, dimensions: [1,1], quantizationParams: {scale: 0 zeroPoint: 0}

TFLite Warning: Encountered unresolved custom op: %s.

TFLite Warning: Node number %d (%s) %s.

Exception: Ops not found.

I'm not sure which ops is needed as the debug info don't give me much information.

model_ten.zip

asus4 commented 1 year ago

@ShigemoriHakura Your model contains custom ops not supported in the default TFLite binary. Or using extended libraries such as select-ops.

(We should parse %s in the log message, sorry for the inconvenience)

ShigemoriHakura commented 1 year ago

hmmm ok, so do you know which custom ops is needed? (or how can I know the %s is what)

asus4 commented 1 year ago

The code is here. The parsing va_list is disabled as it causes a crash randomly.

https://github.com/asus4/tf-lite-unity-sample/blob/66985ac9836565b23e61c104f2fd589b748fab6a/Packages/com.github.asus4.tflite/Runtime/ErrorReporter.cs#L35-L50

Here are the list built-in ops in TensorFlow Lite ↓ https://github.com/asus4/tf-lite-unity-sample/blob/master/Packages/com.github.asus4.tflite/Runtime/BuiltinOps.cs

ShigemoriHakura commented 1 year ago

The code is here. The parsing va_list is disabled as it causes a crash randomly.

https://github.com/asus4/tf-lite-unity-sample/blob/66985ac9836565b23e61c104f2fd589b748fab6a/Packages/com.github.asus4.tflite/Runtime/ErrorReporter.cs#L35-L50

Here are the list built-in ops in TensorFlow Lite ↓ https://github.com/asus4/tf-lite-unity-sample/blob/master/Packages/com.github.asus4.tflite/Runtime/BuiltinOps.cs

Thx, I founded the missing op is Landmarks2TransformMatrix, which is included in MediaPipe https://github.com/google/mediapipe/blob/master/mediapipe/util/tflite/operations/landmarks_to_transform_matrix.cc So I have to compile the tensorflow binary myself?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.