Installation of tflite_runtime on BeagleBone AI-64 getting failed

Hi,
I am trying to install tflite_runtime on BeagleBone AI-64 using pip but getting failed with following error message.

(base) root@yantrr:~# pip install --index-url https://google-coral.github.io/py-repo/ tflite_runtime
Looking in indexes: https://google-coral.github.io/py-repo/, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement tflite_runtime (from versions: none)
ERROR: No matching distribution found for tflite_runtime
(base) root@yantrr:~# 
(base) root@yantrr:~# pip install tflite-runtime
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement tflite-runtime (from versions: none)
ERROR: No matching distribution found for tflite-runtime
(base) root@yantrr:~# 

Any idea to resolve this issue?

Hello,

Did you try python3 -m pip instead or just plain, ole pip3?

Seth

P.S. I think w/ pip3, the -U option allows for installing the lib. to the current user.

Hello,

I can confirm on the BBAI-64 that the pip3 install works w/:

python3 -m pip install -U tensorflow
nano .bashrc

At the end of the file, add this line:

export PATH=$PATH:/home/debian/.local/bin

Seth

P.S. Oh…you want tflite_runtime and not the tensorflow models. Ut oh. I will test it real quickly.

Epoch 1/5
1875/1875 [==============================] - 18s 7ms/step - loss: 0.3018 - accuracy: 0.9115
Epoch 2/5
1875/1875 [==============================] - 13s 7ms/step - loss: 0.1474 - accuracy: 0.9569
Epoch 3/5
1875/1875 [==============================] - 13s 7ms/step - loss: 0.1089 - accuracy: 0.9664
Epoch 4/5
1875/1875 [==============================] - 13s 7ms/step - loss: 0.0896 - accuracy: 0.9723
Epoch 5/5
1875/1875 [==============================] - 13s 7ms/step - loss: 0.0750 - accuracy: 0.9768
2022-08-29 08:02:21.316268: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 31360000 exceeds 10% of free system memory.
313/313 - 2s - loss: 0.0802 - accuracy: 0.9761 - 2s/epoch - 6ms/step

That excerpt is from this source:


#!/usr/bin/python3

import tensorflow as tf
print("TensorFlow version:", tf.__version__)

mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10)
])

predictions = model(x_train[:1]).numpy()
predictions

tf.nn.softmax(predictions).numpy()

loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)

loss_fn(y_train[:1], predictions).numpy()

model.compile(optimizer='adam',
    loss=loss_fn,
    metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)

model.evaluate(x_test, y_test, verbose=2)

probability_model = tf.keras.Sequential([
    model,
    tf.keras.layers.Softmax()
])

probability_model(x_test[:5])

Enjoy!

I found this online at the tutorials section of tensorflow.org. You know something, it would be neat to use the hardware on the BBAI-64 to allocate some space for LEDs and run an inference and model based around what the LEDs do in time!

1 Like

ti has a forked version of tflite_runtime…

sudo apt update
sudo apt install ti-tensorflow-8.2

This is pre-installed in the edge_ai images…

Regards,

2 Likes

Thanks @RobertCNelson
I am trying to get familiar with Edge AI application development using BeagleBone AI-64 and referring TI’s training video (link: https://training.ti.com/process-program-edge-ai-hello-world-application-using-free-online-tools).
Is tidl-tools pre-installed in the edge_ai images of AI-64? If yes, what is its installed directory path?