question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting an IndexError from the tflite backend on Raspberry Pi

See original GitHub issue
Traceback (most recent call last):
  File "/home/pi/Desktop/tester.py", line 6, in <module>
    result = model.predict_from_file('/home/pi/Desktop/image.png')
  File "/home/pi/.local/lib/python3.7/site-packages/lobe/ImageModel.py", line 43, in predict_from_file
    return self.predict(image_utils.get_image_from_file(path))
  File "/home/pi/.local/lib/python3.7/site-packages/lobe/ImageModel.py", line 47, in predict
    return self.__backend.predict(image_processed)
  File "/home/pi/.local/lib/python3.7/site-packages/lobe/backends/_backend_tflite.py", line 57, in predict
    output_details[1]["index"]
IndexError: list index out of range

Here is my code:

from lobe import ImageModel

model = ImageModel.load('/home/pi/Lobe/model')

result = model.predict_from_file('/home/pi/Desktop/image.png')
print(result.prediction)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mbeissingercommented, Dec 22, 2020

Sorry for the delay, turned into a larger refactor than anticipated! Here is the PR, would love to get some help testing in your cases: https://github.com/lobe/lobe-python/pull/15

2reactions
mbeissingercommented, Dec 18, 2020

I’m taking a look at this now and refactoring a bit how models are loaded and run. Should have a branch up later this evening that would be great to get some testing help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: list index out of range on Python code
But I am getting an error saying IndexError: list index out of range and I don't know where to go from here. Code:...
Read more >
Model Maker TF Lite Slow Inference - TensorFlow Forum
My end goal will be to run on a device like an raspberry pi 4, jetson nano or something similar (min 4 CPUs,...
Read more >
How to Perform Object Detection with TensorFlow Lite on ...
In this tutorial, I'll walk you through the process of installing TensorFlow Lite on a Raspberry Pi and using it to perform object...
Read more >
How to install Tensorflow in Raspberry pi 4b 8gb , i am aslo try ...
TensorFlow Lite with Python is great for embedded devices based on Linux, such as Raspberry Pi. python3 -m pip install tflite-runtime.
Read more >
How to Run TensorFlow Lite Models on Raspberry Pi
Accessing Raspberry Pi from PC; Preparing TFLite in RPi; Downloading MobileNet; Classifying a Single Image. Let's get started. Bring this project to life....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found