Skip to main content

Teachable Machine Lite

By: Meqdad Darwish

Teachable Machine Lite Package Logo

Downloads MIT License PyPI

Description

A lightweight Python package optimized for integrating exported models from Google's Teachable Machine Platform into robotics and embedded systems environments. This streamlined version of Teachable Machine Package is specifically designed for resource-constrained devices, making it easier to deploy and use your trained models in embedded applications. With a focus on efficiency and minimal dependencies, this tool maintains the core functionality while being more suitable for robotics and IoT projects.

Source Code is published on GitHub

Read more about the project (requirements, installation, examples and more) in the Documentation Website

Supported Classifiers

Image Classification: Use exported and quantized TensorFlow Lite model from Teachable Machine Platform (a model file with tflite extension).

Requirements

For detailed information about package requirements and dependencies, please visit our documentation

Python >= 3.9
numpy < 2.0 (v1.26.4 recommended)

How to install Teachable Machine Lite Package

pip install teachable-machine-lite

Dependencies

numpy
tflite-runtime
Pillow

Example

An example for teachable machine lite package with OpenCV:

from teachable_machine_lite import TeachableMachineLite
import cv2 as cv

cap = cv.VideoCapture(0)

model_path = "model.tflite"
labels_path = "labels.txt"
image_file_name = "screenshot.jpg"

tm_model = TeachableMachineLite(model_path=model_path, labels_file_path=labels_path)

while True:
    ret, img = cap.read()
    cv.imwrite(image_file_name, img)

    results, resultImage = tm_model.classify_and_show(image_file_name, convert_to_bgr=True)
    print("results:", results)

    cv.imshow("Camera", resultImage)
    k = cv.waitKey(1)
    if k == 27:  # Press ESC to close the camera view
        break

cap.release()
cv.destroyAllWindows()

Values of results are assigned based on the content of labels.txt file.

For more; take a look on these examples

Metadata

Release files for teachable-machine-lite 1.2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teachable-machine-lite 1.2.0.2
File Size Uploaded
teachable_machine_lite-1.2.0.2.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for teachable-machine-lite 1.2.0.2
File Interpreter ABI Platform
teachable_machine_lite-1.2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / teachable_machine_lite-1.2.0.2.tar.gz

Download URL teachable_machine_lite-1.2.0.2.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
864973e9bc992d56b973caf3c64a73678990b2335f6f8b98b5bee474deb3c978
BLAKE2b-256 checksum
How to use checksums
f2637ba737cc15b58ef4c2ef49176c6e7ad8bb306011979fc9cfa1045809aed9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2024.

Transparency log

Release files / teachable_machine_lite-1.2.0.2-py3-none-any.whl

Download URL teachable_machine_lite-1.2.0.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11aeb68db2f20f8b82fb098c360a7515307426028290fc1040c40b17759649fb
BLAKE2b-256 checksum
How to use checksums
280b589729a5132a5f72669d15aa7a41b1b834765f8b1ef758ba61d8fdc58157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0.2 This release

2 release files

1.1

2 release files

1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page