Skip to Content
Python Deep Learning - Second Edition
book

Python Deep Learning - Second Edition

by Ivan Vasilev, Daniel Slater, Gianmario Spacagna, Peter Roelants, Valentino Zocca
January 2019
Intermediate to advanced
386 pages
11h 13m
English
Packt Publishing
Content preview from Python Deep Learning - Second Edition

VGG with Keras, PyTorch, and TensorFlow

All three libraries have pre-trained VGG models. Let's see how to use them. We'll start with Keras, where it's easy to use this model in a transfer learning scenario. You can set include_top to False, which will exclude the fully-connected layers. The following are the steps:

  1. Preload the weights by setting the weights parameter and they will be downloaded automatically:
# VGG16from keras.applications.vgg16 import VGG16vgg16_model = VGG16(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)# VGG19from keras.applications.vgg19 import VGG19vgg19_model = VGG19(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Deep Learning

Python Deep Learning

Valentino Zocca, Gianmario Spacagna, Daniel Slater, Peter Roelants

Publisher Resources

ISBN: 9781789348460Supplemental Content