Applying models from TensorFlow Hub
TensorFlow Hub contains many reusable models. For example, in image classification tasks, there are pretrained models such as Inception V3, ResNet of different versions, as well as feature vectors available. In this chapter, we will take a look at how to load and use a ResNet feature vector model for image classification of our own images. The images are five types of flowers: daisy, dandelion, roses, sunflowers, and tulips. We will use the tf.keras
API to get these images for our use:
- You may use Google Cloud AI Platform's JupyterLab environment for this work. Once you are in the AI Platform's JupyterLab environment, you may start by importing the necessary modules and download the images:
import tensorflow as tf import tensorflow_hub as hub import matplotlib.pyplot as plt import numpy as np data_dir = tf.keras.utils.get_file( 'flower_photos', 'https://storage.googleapis...