Artificial Intelligence 4: Train your AI Model

Train your AI Model

Artificial Intelligence 4

This lesson will help you earn points in explaining your AI model in the Demo video part of the rubric.

In this lesson, you will…

  • Decide on a platform to train your AI model
  • Gather your dataset and train your AI model for your project

Key Terms and Concepts

  • Platform -software or website that allows its users to perform a task or use a tool
  • Extension - external software that be easily added to an existing program or platform to gain special features or capabilities
  • Classification - Machine learning model used to identify or categorize different data

By now you should have gathered your data for your dataset. As a reminder, there are three ways of collecting data:

  1. Collect training data from your community
  2. Invention gathers data with sensors or user input
  3. Use data from public datasets for training data

You also should have decided on what type of data you want to use in your dataset - images, text, sound, or poses. 

Let’s take a final check that your dataset meets the following criteria:

  • The right kind of data
  • Lots of examples
  • Varied examples - diverse and representative (unbiased)

Choosing a Platform

There are many platforms available online to train an AI model. Most of the platforms work in a similar way. You input your data, either through upload or using the webcam for images, then you train the model, and finally test it to make sure it is accurate. Choosing which platform to use will depend on your project and what you want to do with your model once it is trained. They all allow you to create AI models that will classify or categorize things, so they are called classification systems.

 

The AI model training platforms we recommend for ease of use for novices and integration with software to allow your model to take action are:

Thunkable does have AI capability but does not give you the ability to train your own model and use it in your app. You can use Microsoft’s Azure Image Recognition, a pre-built AI model, as part of the Camera component in Thunkable. You can also use the Web API component and external Machine Learning platforms to integrate your own AI model into a Thunkable project.

In this video from IJCAI 2021, Pratham Goradia from Maker Bay in Hong Kong shows how to make an app to identify coral species. Pratham uses Ximilar to train the AI model and then uses the Web API component in Thunkable to integrate his model  into his project.

There are other more advanced AI tools available as well. Some are listed in our Additional Resources section. They may require using advanced languages like Java, Python, or Swift and will most likely entail using APIs (Application Programming Interface).

Below is a little more information about each of the platforms suggested above. Read through to determine which platform will work best for your project. It may depend on the type of data in your dataset, as not every platform can train every type of data. If you are intending to make a mobile app, App Inventor or Machine Learning for Kids are options. If you hope to integrate some sort of hardware device such as micro:bit or Raspberry Pi, you should investigate Stretch3 and mblock. 

Try out one or more of the tutorials from one or two platforms to see which platform will help you achieve the goals for your project.

Teachable Machine

teachablemachine.withgoogle.com

Google's Teachable Machine lets you easily train AI models that can be used with other platforms. In this video, learn a little about Teachable Machine and training an AI model. Teachable Machine can be used with several other websites and tools. The most straightforward integration with a blocks-based language is Stretch3, a version of Scratch. If you are intending to use any external hardware devices such as micro:bit, Arduino, or Raspberry Pi, Stretch3 in combination with Teachable Machine is a good option because it has many extensions built into it to integrate those devices.

 

Here are three tutorials to try out Teachable Machine using different data types.

Pose classification to detect head tilt

Machine Learning for Kids
MIT App Inventor
mblock

Activity: Training your AI Model

What you will do:

1. Review the different platforms above and choose one or two tutorials to test out the platform. The platform should:

    • Be able to train the type of dataset you are using (images, sounds, text, etc)
    • Allow you to use the model to integrate into your proposed AI solution. Some possibilities are:
      • Mobile app
      • Invention with sensors
      • Physical system with hardware devices

2. After you have experimented with one or two platforms/tools, decide which one your team will use for your Technovation AI Project.

3. Train your AI model with your dataset. If you haven’t completely gathered all the data examples for your dataset, you can start to add examples and add more as you collect more data. Don’t forget to save your project/model so you can return to it later!

4. Once you have trained your AI model, test it with some additional examples. These test examples should be different from the training examples you used.

5. If your AI model is not performing well, go back and add more training examples. Did you add enough examples? Were the examples diverse and representative?

Reflection

Hopefully you have chosen the platform you will use to train your AI model and eventually use to build your AI project. Consider the following questions. Answering these will help you make your case for why you chose AI and why you chose this particular technology for your Technovation project.

  • What type of data is in your dataset?
  • What aspects of your chosen platform made it a good choice for this type of data?
  • What do you hope to achieve with your AI model now that you have built it?
  • Are you confident the platform you chose will help you achieve your goals?

Additional Resources: Advanced Integrations

Remember to go over Coding 13: Cloud Storage and APIs to learn more about integrating outside services to your app. Some of these are only compatible with more advanced coding languages (such as Java or Swift) but they’re definitely worth a look regardless if you intend to use it in your app.

  • Dialogflow
    • Great for creating conversational AI apps
  • TensorFlow
    • Lots of tools like transcribing handwritten numbers, pose guessing, and more!
  • Google

VianAI

Learn from VianAI engineers how to code in Python with Google’s Colab platform to build an AI tool to help people find search results that help people achieve their dreams.

 

Also check out DialogFlow with Google Engineers: