Tutorial: Using Teachable Machines and Implementing Models

Teachable Machines is an easy-to-use platform by Google that allows users to create machine learning models without any coding. This tutorial will guide you through:

  1. What is Teachable Machines?
  2. How to Train a Model using Teachable Machines
  3. Using Teachable Machine Models in Python with Colab

1. What is Teachable Machines?

Teachable Machines is a web-based tool that simplifies machine learning. It lets users create models for image, sound, or pose recognition by using examples you provide.

Use Cases:

• Classifying objects in images.

• Sound recognition.

• Gesture/pose detection.

2. Train a Model Using Teachable Machines

Steps to Create a Model:

  1. Go to Teachable Machines
    1. Visit the Teachable Machines website.
  2. Select a Model Type Choose a project type (Image, Audio, or Pose). For this example, we’ll use an Image Classification model.
  3. Add Classes Define classes for your model. For example, if you’re classifying fruits, create classes like “Apple,” “Banana,” and “Orange.”
  4. Collect Training Data Click on the “Upload” or “Webcam” button to gather images for each class. Ensure that you upload multiple images for better accuracy.
  5. Train the Model Click “Train Model.” The tool will process your data and train the model.
  6. Export the Model Once trained, export the model. Select TensorFlow Lite or TensorFlow SavedModel format for Python integration.
  7. Download the .zip file containing the model.

3. Using Teachable Machine Models in Python

We’ll use a pre-trained model in a Python environment via Google Colab.

Step-by-Step:

  1. Open the Colab Notebook

Use the example Colab notebook.

  1. Upload the Model to Colab

• Unzip the downloaded model file.

• In Colab, click on the Files tab to upload the model folder.

3. Run the Results and visualise

Use a mapping of class names to display results:

class_names = ['Apple', 'Banana', 'Orange']

predicted_class = class_names[np.argmax(prediction)]

print(f"Predicted Class: {predicted_class}")

4. Additional Tips

• Experiment with different datasets to improve model accuracy.

• Optimize training by adding more diverse images for each class.

• Use TensorFlow.js to deploy the model directly in a browser.

This tutorial provides a practical approach to train, export, and implement Teachable Machine models. Let me know if you’d like me to create the actual screenshots or modify this guide further!

Using Teachable Machine Models to find the result –

https://colab.research.google.com/github/oceam/agri-image/blob/main/codes/test_teachable_machine_model.ipynb

× How can I help you?