A Python package designed to simplify the integration of exported models from Google's Teachable Machine platform into various environments. This tool was specifically crafted to work seamlessly with Teachable Machine, making it easier to implement and use your trained models.
Project description
Teachable Machine
By: Meqdad Darwish
A Python package designed to simplify the integration of exported models from Google's Teachable Machine platform into various environments. This tool was specifically crafted to work seamlessly with Teachable Machine, making it easier to implement and use your trained models.
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 keras model from Teachable Machine platform.
Requirements
Python >= 3.7
How to install package
pip install teachable-machine
Example
An example for teachable machine package with OpenCV:
from teachable_machine import TeachableMachine
import cv2 as cv
cap = cv.VideoCapture(0)
model = TeachableMachine(model_path="keras_model.h5",
labels_file_path="labels.txt")
image_path = "screenshot.jpg"
while True:
_, img = cap.read()
cv.imwrite(image_path, img)
result, resultImage = model.classify_and_show(image_path)
print("class_index", result["class_index"])
print("class_name:::", result["class_name"])
print("class_confidence:", result["class_confidence"])
print("predictions:", result["predictions"])
cv.imshow("Video Stream", resultImage)
k = cv.waitKey(1)
if k == 27: # Press ESC to close the camera view
break
cap.release()
cv.destroyAllWindows()
Values of result
are assigned based on the content of labels.txt
file.
For more; take a look on these examples
Links:
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
File details
Details for the file teachable_machine-1.2.tar.gz
.
File metadata
- Download URL: teachable_machine-1.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bba194943219bb172e8d37e1b6c964337e526b1afa14473878dbc38052163d15 |
|
MD5 | 0abe9618ddf55115e4071ca26560eaec |
|
BLAKE2b-256 | 290a9ec89552e997477a156a201328b149ed3330de0a5053ff556bbcc5be4e8c |
File details
Details for the file teachable_machine-1.2-py3-none-any.whl
.
File metadata
- Download URL: teachable_machine-1.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe6fe6f53196018b15516829c8bc2932584a2c60854fbfa0deac74f46c0587a |
|
MD5 | aa1513ba0c098dc9a773ce76b6b83cb2 |
|
BLAKE2b-256 | bfc49f16987e6c436fb1f7d1ab072f4c11cf3be50adaf84ea348fc448426068e |