Using a TensorFlow module

This page gives a brief guide to finding a TensorFlow module on AI Hub and using the module in your machine learning (ML) program.

A TensorFlow module is a self-contained piece of a TensorFlow graph and the associated weights and assets. You can use the TensorFlow Hub API to reuse a module in your TensorFlow program.

By using a TensorFlow module, you can:

  • Preprocess input feature vectors.
  • Train a model with a smaller dataset than is necessary if you start from scratch.
  • Speed up the training of your model.
  • Improve model generalization.

Currently, TensorFlow modules are available only in the public assets on AI Hub.

Prerequisites

Follow the instructions in the TensorFlow Hub installation guide to install TensorFlow and the TensorFlow Hub API.

Find a TensorFlow module and use the module in your TensorFlow program

Here's an overview of how to find a TensorFlow module and use the module in your code:

  1. To find a TensorFlow module:

    1. Open your web browser and go to AI Hub.
    2. Click TensorFlow module under Category to filter the list of assets to display only modules, then browse or search to find a module.
    3. Once you find the TensorFlow module you are interested in, click the module's name. AI Hub displays a description of the module and information on how to use it. For more information on how to find assets, read the guide to finding assets on AI Hub.
  2. On the module page on AI Hub, click Copy URL under Use this asset. AI Hub copies the URL of the TensorFlow module into your clipboard. The URL is the path to the module directory that you use to instantiate the module in your code.

The module page on AI Hub includes a code snippet and other details to help you use the module.

What's next