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
Hands-On Transfer Learning with Python

You're reading from   Hands-On Transfer Learning with Python Implement advanced deep learning and neural network models using TensorFlow and Keras

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788831307
Length 438 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Nitin Panwar Nitin Panwar
Author Profile Icon Nitin Panwar
Nitin Panwar
Raghav Bali Raghav Bali
Author Profile Icon Raghav Bali
Raghav Bali
Tamoghna Ghosh Tamoghna Ghosh
Author Profile Icon Tamoghna Ghosh
Tamoghna Ghosh
Dipanjan Sarkar Dipanjan Sarkar
Author Profile Icon Dipanjan Sarkar
Dipanjan Sarkar
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Machine Learning Fundamentals FREE CHAPTER 2. Deep Learning Essentials 3. Understanding Deep Learning Architectures 4. Transfer Learning Fundamentals 5. Unleashing the Power of Transfer Learning 6. Image Recognition and Classification 7. Text Document Categorization 8. Audio Event Identification and Classification 9. DeepDream 10. Style Transfer 11. Automated Image Caption Generator 12. Image Colorization 13. Other Books You May Enjoy

Building our image language encoder-decoder deep learning model

We have all the essential components and utilities needed to build our model now. As we mentioned earlier, we will be using an encoder-decoder deep learning model architecture to build our image-captioning system.

The following code helps us build the architecture for this model, where we take pairs of image features and caption sequences as input to predict the next possible word in the caption at each time-step:

from keras.models import Sequential, Model 
from keras.layers import LSTM, Embedding, TimeDistributed, Dense, RepeatVector, Activation, Flatten, concatenate 
 
DENSE_DIM = 256 
EMBEDDING_DIM = 256 
MAX_CAPTION_SIZE = max_caption_size 
VOCABULARY_SIZE = vocab_size 
 
image_model = Sequential() 
image_model.add(Dense(DENSE_DIM, input_dim=4096, activation='relu')) 
image_model.add(RepeatVector(MAX_CAPTION_SIZE...
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