teachable machine lite
v1.2.0.2
作者:Meqdad Darwish
一款优化的轻量级Python软件包,用于将Google的Tochable Machine平台的导出模型集成到机器人技术和嵌入式系统环境中。此简化的Thentable Machine软件包是专门为资源受限设备设计的,使在嵌入式应用程序中部署和使用训练有素的模型变得更加容易。侧重于效率和最小的依赖性,该工具保持核心功能,同时更适合机器人和物联网项目。
源代码发表在GitHub上
在文档网站中阅读有关项目(要求,安装,示例等)的更多信息
图像分类:使用Techable Machine Platform(具有tflite扩展名的模型文件)的导出和量化Tensorflow Lite模型。
有关包装要求和依赖项的详细信息,请访问我们的文档
Python >= 3.9
numpy < 2.0 (v1.26.4 recommended)
pip install teachable-machine-litenumpy
tflite-runtime
Pillow带有OpenCV的可教机Lite软件包的示例:
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 () results值是根据labels.txt文件的内容分配的。
更多;看看这些例子
文档
PYPI
源代码
可教机平台