Flexible Transfer Learning with TensorFlow and Keras Applications

Joshua Owoyemi, PhD
1 min readApr 27, 2019

--

Tensorflow + Keras

I have been searching for a simple yet flexible way to do transfer learning with TensorFlow recently. However, most examples I see are either too cryptic and involved or too rigid to be repurposed.

So, I stumbled on this tutorial on the TensorFlow website, which helped only if I wanted to use the pretrained models as feature extractor or just finetune them. I wanted more. I wanted a way to be able to use the pretrained layers and weights. Then I realized the tutorial was based on the keras applications which is a collection of pretrained models and weights provided by the Keras team and ported into TensorFlow.

After some tinkering using the TensorFlow and Keras API, we can easily reuse layers and pretrained weights of the models from the Keras applications. The code snippet is provided below or in this Github Gist. You might need to see the TensorFlow tutorial first if you are not familiar with transfer learning.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Joshua Owoyemi, PhD
Joshua Owoyemi, PhD

Written by Joshua Owoyemi, PhD

Co-Founder and CEO of ModAstera Inc.

No responses yet

Write a response