PINTO_model_zoo: SCRFD tflite infer error: INT64 != INT32

Tanks for your great work!!! when I test SCRFD tflite model which get from https://hub.fastgit.org/PINTO0309/PINTO_model_zoo/blob/main/129_SCRFD/download.sh , it occurs error, the details is as follows:

1. OS using Ubuntu 18.04

2. OS Architecture x86_64

3. Version of TensorFlow 2.6.0

4. URL of the repository from which the transformed model was taken, https://hub.fastgit.org/PINTO0309/PINTO_model_zoo/tree/main/129_SCRFD, and the model download from https://drive.google.com/uc?export=download&id=1QRmCB2d_5MUcxRD3Zs0iigUuJGybGiKZ。

5 source code for simple inference testing code

import numpy as np
from tensorflow.lite.python.interpreter import Interpreter
from pprint import pprint

MODEL='scrfd_500m'
H=240
W=320
input_data = np.ones((1,H,W,3), dtype=np.float32)

# tflite ==========================================================
interpreter = Interpreter(model_path='./model_float32.tflite', num_threads=4)
interpreter.allocate_tensors()
input_blob = interpreter.get_input_details()
output_blob = interpreter.get_output_details()
interpreter.set_tensor(input_blob[0]['index'], input_data)
interpreter.invoke()
output_float32 = interpreter.get_tensor(output_blob[0]['index'])
print(f'tflite sum output(float32): {np.sum(output_float32)}')

When I run this code, it occurs: Traceback (most recent call last): File “infer_tflite.py”, line 15, in <module> interpreter.allocate_tensors() File “/usr/local/lib/python3.6/dist-packages/tensorflow/lite/python/interpreter.py”, line 423, in allocate_tensors return self._interpreter.AllocateTensors() RuntimeError: tensorflow/lite/kernels/reduce.cc:223 op_context.axis->type != kTfLiteInt32 (INT64 != INT32)Node number 57 (MEAN) failed to prepare.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Yes. I am aware that error occurs. As per the comment you posted yesterday, you need to do the conversion again using the latest tools. SCRFD has too many different models, so the priority for reconversion is low for now.

$ docker pull pinto0309/openvino2tensorflow:latest
$ docker run -it --rm \
  -v `pwd`:/home/user/workdir \
  pinto0309/openvino2tensorflow:latest

or

$ pip3 install openvino2tensorflow --upgrade

The tool has been fixed in v1.19.3. The current latest version is v1.20.5. https://github.com/PINTO0309/openvino2tensorflow/releases/tag/v1.19.3 Screenshot 2021-09-14 15:05:48 https://github.com/PINTO0309/openvino2tensorflow/commit/b2c8f6d0c59d9d54e0bc735f79aebc2e41b091cd