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!