tensorflow: Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors

Description

We converted the Matterpot Mask RCNN object detection model (using hdf5 weight file) into tflite format using tensorflow (version 2.3.0). We are able to get the prediction in android using the version ‘org.tensorflow:tensorflow-lite:2.4.0’. Inference time in android devices takes around 40 seconds using CPU (kirin 655 ). So we aiming to use the GPU support to improve inference time for our model in Android devices but the following error is raised Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors. We tried using batch size as 1 but the same error is raised.

We have included below link where we have shared H5 format model, converted tflite model and text file containing keras model summary LINK : https://drive.google.com/drive/folders/1nTzifGDX7wXxYNXnHFw4a3Sz0p0_GdBe?usp=sharing

Is there tflite GPU support for graph with dynamic sized tensors or how can we mitigate this issue?

We have included two images of graph visualized using graphviz

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@dagongji10 Not sure if your graph has dynamic tensors. If not, then the TFLite GPU delegate should support it. Do you see any error?

@srjoglekar246 Thanks! I have sloved the problem. In fact, I got the same error : Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors. And the reason is I forgot to set batch_size for input image tensor. Now although the output of DB is segmentation mask, the .tflite can run normally with GPU delegate!