ZoneMinder / mlapi

An easy to use/extend object recognition API you can locally install. Python+Flask. Also works with ZMES!
Other
58 stars 35 forks source link

RuntimeError: Internal: Unsupported data type in custom op handler #38

Closed jerryzz closed 3 years ago

jerryzz commented 3 years ago

Hello

I've installed the lasted version of mlapi, and the egretpu library.

When I call curl -H "Content-Type:application/json" -H "Authorization: Bearer ${ACCESS_TOKEN}" -XPOST -d "{\"url\":\"https://upload.wikimedia.org/wikipedia/commons/c/c4/Anna%27s_hummingbird.jpg\"}" http://192.168.31.11:5000/api/v1/detect/object

I've got this message:

Mar 06 2021 11:28:57.617030 [DBG 3] --------- Frame:0 Running variation: #1 -------------
Mar 06 2021 11:28:57.629720 [DBG 2] Waiting for pyzm_uid0_tpu_lock portalock...
Mar 06 2021 11:28:57.630728 [DBG 2] Got pyzm_uid0_tpu_lock portalock
Mar 06 2021 11:28:57.630857 [DBG 1] |--------- Loading TPU model from disk -------------|
Mar 06 2021 11:29:00.371399 [DBG 2] Released portalock pyzm_uid0_tpu_lock
Mar 06 2021 11:29:00.371586 [ERR] Error running model: Internal: Unsupported data type in custom op handler: 653409188Node number 2 (EdgeTpuDelegateForCustomOp) failed to prepare.

Mar 06 2021 11:29:00.374299 [DBG 2] Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ml/detect_sequence.py", line 458, in detect_stream
    _b,_l,_c = m.detect(image=frame)
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ml/object.py", line 54, in detect
    b,l,c = self.model.detect(image)
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ml/coral_edgetpu.py", line 157, in detect
    self.load_model()
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ml/coral_edgetpu.py", line 93, in load_model
    self.model.allocate_tensors()
  File "/usr/local/lib/python3.7/dist-packages/tflite_runtime/interpreter.py", line 242, in allocate_tensors
    return self._interpreter.AllocateTensors()
  File "/usr/local/lib/python3.7/dist-packages/tflite_runtime/interpreter_wrapper.py", line 115, in AllocateTensors
    return _interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: Unsupported data type in custom op handler: 653409188Node number 2 (EdgeTpuDelegateForCustomOp) failed to prepare.

Mar 06 2021 11:29:00.374897 [DBG 3] --------- Frame:0 Running variation: #2 -------------
Mar 06 2021 11:29:00.375074 [DBG 2] Waiting for pyzm_uid0_gpu_lock portalock...
Mar 06 2021 11:29:00.375630 [DBG 2] Got pyzm_uid0_gpu_lock portalock

pyzm is in the latest version root@eole:/home/jerry/mlapi# sudo -H pip3 install pyzm Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pyzm in /usr/local/lib/python3.7/dist-packages (0.3.36)

What do I wrong ?

thank by advance,

pliablepixels commented 3 years ago

This usually means your tflite runtime version is different from what the TPU expects. https://github.com/google-coral/edgetpu/issues/214

jerryzz commented 3 years ago

Ok, I found the problem. I've installed the tflite_runtime via pip package, and the edgetpu* package via apt... I've remove the pip package, and install it via apt. Works fine now !

Thanks for your answer