Skip to content
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

[TensorFlow Lite label_image] Abort occurs with xnnpack_delegate option. #56367

Closed
NobuoTsukamoto opened this issue Jun 6, 2022 · 3 comments · Fixed by #56369
Closed

[TensorFlow Lite label_image] Abort occurs with xnnpack_delegate option. #56367

NobuoTsukamoto opened this issue Jun 6, 2022 · 3 comments · Fixed by #56369
Assignees
Labels
comp:lite-examples TensorFlow Lite Examples TF 2.9 Issues found in the TF 2.9 release (or RCs) type:bug Bug

Comments

@NobuoTsukamoto
Copy link
Contributor

NobuoTsukamoto commented Jun 6, 2022

Click to expand!

Issue Type

Bug

Source

source

Tensorflow Version

v2.9.1 (or master)

Custom Code

No

OS Platform and Distribution

Raspberry Pi OS (bullseye)

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/Compiler version

gcc version 10.2.1 20210110 (Debian 10.2.1-6)

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

Build tensorflow-lite and label_image from source (with CMake).
Execute with the `--xnnpack_delegate` option.

label_image \
  --tflite_model /tmp/mobilenet_v1_1.0_224.tflite \
  --labels /tmp/labels.txt \
  --image tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp \
  --xnnpack_delegate 1
Type mismatch while accessing parameter.
Abort


### Standalone code to reproduce the issue

```shell
Clone repository.

git clone -b v2.9.1 https://github.com/tensorflow/tensorflow.git

Build tensorflow-lite and label_image

mkdir build && cd build
cmake ../tensorflow/tensorflow/lite/
cmake --build . -j$(nproc)
cmake --build . -j$(nproc) -t label_image

Download tflite model

wget https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz
tar xf mobilenet_v1_1.0_224.tgz
wget  https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz
tar xf mobilenet_v1_1.0_224_frozen.tgz
cp mobilenet_v1_1.0_224/labels.txt ./

Exec label_image (with use_xnnpack option)

./examples/label_image/label_image \
  --tflite_model ./mobilenet_v1_1.0_224.tflite \
  --labels ./labels.txt \
  --image ../tensorflow/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp


### Relevant log output

_No response_</details>
@NobuoTsukamoto
Copy link
Contributor Author

NobuoTsukamoto commented Jun 6, 2022

Abort is caused by the following code in label_image.
https://github.com/tensorflow/tensorflow/blob/v2.9.1/tensorflow/lite/examples/label_image/label_image.cc#L129

The correct type of num_threads is int32_t, not bool.
https://github.com/tensorflow/tensorflow/blob/v2.9.1/tensorflow/lite/tools/delegates/default_execution_provider.cc#L30

This error occurs on Raspberry Pi OS 64bit (bullseye) and Fedora 36.
On Ubuntu 22.04, the process is completed without Abort. For unknown reasons, xnnpack delegate does not take effect. It may be one of the possibilities of #55476.

@mohantym mohantym added comp:lite TF Lite related issues comp:lite-examples TensorFlow Lite Examples TF 2.9 Issues found in the TF 2.9 release (or RCs) and removed comp:lite TF Lite related issues labels Jun 6, 2022
@mohantym
Copy link
Contributor

mohantym commented Jun 6, 2022

Hi @NobuoTsukamoto ! Thanks for reporting this bug. This issue will be closed once PR #56369 is merged.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite-examples TensorFlow Lite Examples TF 2.9 Issues found in the TF 2.9 release (or RCs) type:bug Bug
Projects
None yet
3 participants