MITB Banner

Google Launches Tool To Adapt ML Models With Transfer Learning

Share

The TensorFlow team at Google recently introduced a new tool for TensorFlow Lite (TFLite) known as Model Maker. The TFLite Model Maker simplifies the process of adapting and converting a TensorFlow Neural Network model to particular input data when deploying this model for on-device ML applications.

Developed by researchers and engineers from the Google Brain team, TensorFlow is one of the most sought after deep learning frameworks of all time. Last year, TensorFlow Lite was open-sourced by the TensorFlow team for mobile devices, and two development boards – Sparkfun and Coral – to perform machine learning tasks on handheld devices like smartphones.

Behind Model Maker

TensorFlow Lite Model Maker is an easy-to-use library which can be used to adapt state-of-the-art machine learning models to the dataset with transfer learning. This library wraps the complex machine learning concepts with an intuitive API, and does not need an expert to get started with machine learning techniques.

This library supports various state-of-the-art models that are available on TensorFlow Hub, including the EfficientNet-Lite and ALBERT-Lite models. Currently, Model Maker supports image classification, and text classification and the researchers claimed that more use cases like Computer Vision and natural language processing (NLP) would be added soon.

How It Works

The researchers developed this tool to provide faster machine learning workflows among organizations. The models created by TensorFlow Lite Model Maker tool already have metadata attached to it. 

According to the researchers, the TensorFlow Lite file format has always had the input/output tensor shape in its metadata. They have also added new fields in the metadata to help understand the developers on how you use the model correctly or what their strengths and weaknesses are.

The two new fields in the metadata are machine-readable parameters, such as normalization parameters like standard deviation, category label files, mean, etc. and human-readable parameters such as model description, model license, etc. The researchers claimed to expand the metadata in their future goals further to support more use cases, including object detection and more NLP tasks.  

With the help of this tool, a developer can easily train a state-of-the-art image classification with only four lines of code, as shown below:

1. Load input data specific to an on-device ML app

data = ImageClassifierDataLoader.from_folder(‘flower_photos/’)

2. Customize the TensorFlow model

model = image_classifier.create(data)

3. Evaluate the model 

loss, accuracy = model.evaluate()

4. Export to Tensorflow Lite model

model.export(‘flower_classifier.tflite’, ‘flower_label.txt’, with_metadata=True)

To gain higher accuracy, a developer can switch to different model architecture by changing one line of code while keeping the rest of the training pipeline. For instance, switching from EfficientNet-Lite to ResNet, one needs to type:

# EfficinetNet-Lite2.

model = image_classifier.create(data, efficientnet_lite2_spec)

# ResNet 50.

model = image_classifier.create(data, resnet_50_spec)

Installation

There are two alternative processes to install the Model Maker library with its dependencies, which are mentioned below:

1| Install directly:

pip install git+https://github.com/tensorflow/examples.git#egg=tensorflow-examples[model_maker]

2| Clone the repo from the HEAD, and then install with pip:

git clone https://github.com/tensorflow/examples

cd examples

pip install .[model_maker]

Wrapping Up

TensorFlow Lite is TensorFlow’s lightweight solution for mobile and embedded devices to enable on-device machine learning inference with low latency and small binary size. For future work, the researchers stated that they would enhance Model Maker to support more tasks, including object detection and several NLP tasks. Furthermore, they will also add BERT support for NLP tasks, such as question and answer, which will help in empowering developers without machine learning expertise to build state-of-the-art NLP models through transfer learning.

Share
Picture of Ambika Choudhury

Ambika Choudhury

A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box.
Related Posts

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

Upcoming Large format Conference

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India