跳至主要内容

How to retrain an image classification model by using transfer learning?

What is transfer learning?

Ordinarily, training an image classification model can take several days, but transfer learning is a technique that takes a model already trained for a related task and uses it as the starting point to create a new model. Usually this takes less than an hour. (This process is sometimes also called "fine-tuning" the model.)

Transfer learning can be done in two ways:
  • Last layers-only retraining: This approach retrains only the last few layers of the model, where the final classification occurs. This is fast and it can be done with a small dataset.
  • Full model retraining: This approach retrains each layer of the neural network using the new dataset. It can result in a model that is more accurate, but it takes more time, and you must retrain using a dataset of significant sample size to avoid overfitting the model.
Transfer learning is most effective when the features learned in the pre-trained model are general, not highly specialized. For example, a pre-trained model that can recognize household objects might be re-trained to recognize new office supplies, but a model pre-trained to recognize different dog breeds might not.

This tutorial shows you how to retrain an image classification model to recognize a new set of classes. You'll use a technique called transfer learning to retrain an existing model and then compile it to run on an Edge TPU device—you can use the retrained model with either the Coral Dev Board or the Coral USB Accelerator.
Specifically, this tutorial shows you how to retrain a quantized MobileNet V1 model to recognize different types of flowers (adopted from TensorFlow's docs). But you can reuse these procedures with your own image dataset, and with a different pre-trained model.
Tip: If you want a shortcut to train an image classification model, try Cloud AutoML Vision. It's a web-based tool that allows you to train a model with your own images, optimize it, and then export it for the Edge TPU.
You can Edge TPU devices from Google global distributor: Gravitylink--https://store.gravitylink.com/global 

评论

此博客中的热门博文

10 questions you should know about Google Edge TPU

1. What is the Edge TPU? The Edge TPU is a small ASIC designed by Google that provides high performance ML inferencing for low-power devices. For example, it can execute state-of-the-art mobile vision models such as MobileNet V2 at almost 400 FPS, in a power efficient manner. Google offers multiple products that include the Edge TPU built-in. Two Edge TPU chips on the head of a US penny 2. What machine learning frameworks does the Edge TPU support? TensorFlow Lite only. 3. What type of neural networks does the Edge TPU support? The first-generation Edge TPU is capable of executing deep feed-forward neural networks (DFF) such as convolutional neural networks (CNN), making it ideal for a variety of vision-based ML applications. 4. How do I create a TensorFlow Lite model for the Edge TPU? You need to convert your model to TensorFlow Lite and it must be quantized using either quantization-aware training (recommended) or full integer post-training quantization. (To create a compatible model...

How to Retrain an object detection model

This tutorial shows you how to retrain an object detection model to recognize a new set of classes. You'll use a technique called transfer learning to retrain an existing model and then compile it to run on an Edge TPU device—you can use the retrained model with either the Coral Dev Board or the Coral USB Accelerator. Specifically, this tutorial shows you how to retrain a MobileNet V1 SSD model (originally trained to detect 90 objects from the COCO dataset) so that it detects two pets: Abyssinian cats and American Bulldogs (from the Oxford-IIIT Pets Dataset). But you can reuse these procedures with your own image dataset, and with a different pre-trained model. The steps below show you how to perform transfer-learning using either last-layers-only or full-model retraining. Most of the steps are the same; just keep an eye out for the different commands depending on the technique you desire. Note: These instructions do not require deep experience with TensorFlow o...

Introducing Google Coral Dev Board

Introducing Google Coral Dev Board (Part 1) Introducing Google Coral Dev Board (Part 2) Introducing Google Coral Dev Board (Part 3) Introducing Google Coral Dev Board (Part 4)