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

KeyError: 'output_0' Pycoral issue on Raspberry Pi 4 #142

Open
opc241 opened this issue Apr 4, 2024 · 0 comments
Open

KeyError: 'output_0' Pycoral issue on Raspberry Pi 4 #142

opc241 opened this issue Apr 4, 2024 · 0 comments
Labels
comp:model Model related isssues

Comments

@opc241
Copy link

opc241 commented Apr 4, 2024

Hi,

the minimal code example:

from pycoral.adapters import detect
from pycoral.adapters import common
from pycoral.utils.edgetpu import make_interpreter
from PIL import Image

interpreter = make_interpreter('/home/pi/homecontrol/software/yolo-Weights/yolov8n_saved_model/yolov8n_full_integer_quant.tflite')
interpreter.allocate_tensors()

image = Image.open('/home/pi/homecontrol/software/yolo-Weights/yolov8n_saved_model/capture.png')
_, scale = common.set_resized_input(interpreter, image.size, lambda size: image.resize(size, Image.LANCZOS))

# Run inference
interpreter.invoke()

# Process detection results
detections = detect.get_objects(interpreter, scale)
for detection in detections:
    print(detection)

leads to the following error:

Traceback (most recent call last):
  File "/home/pi/homecontrol/software/__test.py", line 16, in <module>
    detections = detect.get_objects(interpreter, scale)
  File "/usr/lib/python3/dist-packages/pycoral/adapters/detect.py", line 210, in get_objects
    count = int(interpreter.tensor(signature['outputs']['output_0'])()[0])
KeyError: 'output_0'

Name: pycoral
Version: 2.0.0

Name: tflite-runtime
Version: 2.5.0.post1

Running on bullseye linux for Raspberry Pi

@google-coral-bot google-coral-bot bot added the comp:model Model related isssues label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:model Model related isssues
Projects
None yet
Development

No branches or pull requests

1 participant