0

I have followed the procedure given in the link "https://www.tensorflow.org/lite/guide/python" to install the tensorflow lite in my raspberry pi. But .interpreter and other classes are not present in the installed package.

I am using Raspberry-pi model B+ with raspberry pi OS(buster)

pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
deb https://packages.cloud.google.com/apt coral-edgetpu-stable main
pi@raspberrypi:~ $ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1974  100  1974    0     0   6902      0 --:--:-- --:--:-- --:--:--  6926
OK
pi@raspberrypi:~ $ sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease
Hit:3 http://raspbian.raspberrypi.org/raspbian buster InRelease  
Reading package lists... Done
pi@raspberrypi:~ $ sudo apt-get install python3-tflite-runtime
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python3-tflite-runtime
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,929 kB of archives.
After this operation, 9,951 kB of additional disk space will be used.
Selecting previously unselected package python3-tflite-runtime.
(Reading database ... 106370 files and directories currently installed.)
Preparing to unpack .../python3-tflite-runtime_2.5.0_armhf.deb ...
Unpacking python3-tflite-runtime (2.5.0) ...
Setting up python3-tflite-runtime (2.5.0) ...
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tflite_runtime
>>> dir(tflite_runtime)
['__builtins__', '__cached__', '__doc__', '__file__', '__git_version__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__']
>>> 
  1. Is there any thing else to be taken care in the installation?
  2. I already have .tflite model with me. Will this installation be enough for me to do facial recognition?

1 Answers1

0

It is working fine. Just because an export is not listed in the dir does not mean it is not callable. Many packages use __getattr__ to intercept calls, especially for packages that are wrapping C++ libraries. Did you not even try to run your code?

C:\tmp>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tflite_runtime
>>> dir(tflite_runtime)
['__builtins__', '__cached__', '__doc__', '__file__', '__git_version__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__']
>>> from tflite_runtime.interpreter import Interpreter
>>> dir(tflite_runtime)
['__builtins__', '__cached__', '__doc__', '__file__', '__git_version__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'interpreter', 'tensorflow_wrap_interpreter_wrapper']
>>> Interpreter
<class 'tflite_runtime.interpreter.Interpreter'>
>>>
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30