Welcome to Teachable Machine Package

By: Meqdad Darwish

Teachable Machine Package Logo

Downloads MIT License PyPI

Description

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

Table Of Contents

  1. How-To Guide
  2. Requirements
  3. Code Examples
  4. Explanation
  5. Changelog
  6. Contributing
  7. Releasing

Supported Classifiers

Image Classification

Compatibility with recent TensorFlow/Keras releases

Teachable Machine's exported .h5 models embed a legacy DepthwiseConv2D layer config that current Keras (Keras 3, bundled by default since TensorFlow 2.16) rejects with an error such as:

TypeError: Unrecognized keyword arguments passed to DepthwiseConv2D: {'groups': 1}

Some exports also save the model as a Sequential wrapping nested Sequential/Functional submodels, a shape Keras 3's legacy H5 loader mis-rebuilds, which previously surfaced as a misleading FileNotFoundError: Model file not found.

Since v1.3.1, this package patches the model loader to handle both cases, so exported models load correctly on up-to-date TensorFlow/Keras installs, with no need to pin an old TensorFlow version. It also fixes prediction-annotation crashes on Windows / recent Pillow versions (show_prediction_on_image). See issue #2 and the changelog for background.