A Python package to simplify the deployment process of exported Teachable Machine models into different embedded systems environments like Raspberry Pi and other SBCs using TensorFlowLite.
Project description
Teachable Machine Lite
A Python package to simplify the deployment process of exported Teachable Machine models into different embedded environments like Raspberry Pi and other SBCs using TensorFlowLite.
Links:
Requirements
Python >= 3.8
How to install package
pip install teachable-machine-lite
Dependencies
numpy, tflite-runtime
How to use teachable machine lite package
from teachable_machine_lite import TeachableMachineLite
import cv2
from tflite_runtime.interpreter import Interpreter
model_path = 'models/model.tflite'
interpreter = Interpreter(model_path)
my_model = TeachableMachineLite(model_type='tflite', model_path=model_path)
img_path = 'images/my_image.jpg'
dim = my_model.get_image_dimensions(interpreter)
height, width = dim['height'], dim['width']
interpreter.allocate_tensors()
img = cv2.imread(img_path)
img = cv2.resize(img, (width, height))
my_model.transform_image(interpreter, img)
interpreter.invoke()
results = my_model.classify_image(interpreter)
print('highest_class_id', results['highest_class_id'])
print('highest_class_prob', results['highest_class_prob'])
highest_class_id is selected based on labels.txt file.
More features are coming soon...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for teachable-machine-lite-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eb2f67d666bb130b7b3a50613c43496705b8319c54914bd9b8d59319c55ec41 |
|
MD5 | abc266695a502242c6d9d2d8bfa60c93 |
|
BLAKE2b-256 | 326e0e3ecebff40623ea5e8e95fe34b40f512ddd66675e19fe3ba14202a44e2a |
Close
Hashes for teachable_machine_lite-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2440b46238210e9ad70b0e6f2f4e1c0b786f75cff83f980804f24a31af015f3e |
|
MD5 | 1c3b726739f7e0bfda44d597dc00912b |
|
BLAKE2b-256 | 2312425e056760cd1d43acbcf41ee2e42a1c3223602233e335b557e29ca12d59 |