Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with TensorFlow 1.x

You're reading from   Machine Learning with TensorFlow 1.x Second generation machine learning with Google's brainchild - TensorFlow 1.x

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781786462961
Length 304 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Saif Ahmed Saif Ahmed
Author Profile Icon Saif Ahmed
Saif Ahmed
Quan Hua Quan Hua
Author Profile Icon Quan Hua
Quan Hua
Shams Ul Azeem Shams Ul Azeem
Author Profile Icon Shams Ul Azeem
Shams Ul Azeem
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with TensorFlow FREE CHAPTER 2. Your First Classifier 3. The TensorFlow Toolbox 4. Cats and Dogs 5. Sequence to Sequence Models-Parlez-vous Français? 6. Finding Meaning 7. Making Money with Machine Learning 8. The Doctor Will See You Now 9. Cruise Control - Automation 10. Go Live and Go Big 11. Going Further - 21 Problems 12. Advanced Installation

Loading a pre-trained model to speed up the training

In this section, let's focus on loading the pre-trained model in TensorFlow. We will use the VGG-16 model proposed by K. Simonyan and A. Zisserman from the University of Oxford.

VGG-16 is a very deep neural network with lots of convolution layers followed by max-pooling and fully connected layers. In the ImageNet challenge, the top-5 classification error of the VGG-16 model on the validation set of 1,000 image classes is 8.1% in a single-scale approach:

First, create a file named nets.py in the project directory. The following code defines the graph for the VGG-16 model:

    import tensorflow as tf 
    import numpy as np 
 
 
    def inference(images): 
    with tf.name_scope("preprocess"): 
        mean = tf.constant([123.68, 116.779, 103.939],  
    dtype=tf.float32, shape=[1, 1, 1, 3], name='img_mean...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime