Author: Awais Farooq

  • Making new layers and models via subclassing

    Introduction This guide will cover everything you need to know to build your own subclassed layers and models. In particular, you’ll learn about the following features: Let’s dive in. Setup The Layer class: the combination of state (weights) and some computation One of the central abstractions in Keras is the Layer class. A layer encapsulates both a state (the…

  • The Sequential model

    Setup When to use a Sequential model A Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor. Schematically, the following Sequential model: is equivalent to this function: A Sequential model is not appropriate when: Creating a Sequential model You can create a Sequential model by passing a list of layers to…

  • The Functional API

    Setup Introduction The Keras functional API is a way to create models that are more flexible than the keras.Sequential API. The functional API can handle models with non-linear topology, shared layers, and even multiple inputs or outputs. The main idea is that a deep learning model is usually a directed acyclic graph (DAG) of layers. So the functional API…

  • Real Time Prediction using ResNet Model

    ResNet is a pre-trained model. It is trained using ImageNet. ResNet model weights pre-trained on ImageNet. It has the following syntax − Here, Let us understand the model by writing a simple example − Step 1: import the modules Let us load the necessary modules as specified below − Step 2: Select an input Let us choose an…

  • Applications

    Keras applications module is used to provide pre-trained model for deep neural networks. Keras models are used for prediction, feature extraction and fine tuning. This chapter explains about Keras applications in detail. Pre-trained models Trained model consists of two parts model Architecture and model Weights. Model weights are large file so we have to download…

  • Time Series Prediction using LSTM RNN

    In this chapter, let us write a simple Long Short Term Memory (LSTM) based RNN to do sequence analysis. A sequence is a set of values where each value corresponds to a particular instance of time. Let us consider a simple example of reading a sentence. Reading and understanding a sentence involves reading the word…

  • Regression Prediction using MPL

    In this chapter, let us write a simple MPL based ANN to do regression prediction. Till now, we have only done the classification based prediction. Now, we will try to predict the next possible value by analyzing the previous (continuous) values and its influencing factors. The Regression MPL can be represented as below − The…

  • Convolution Neural Network

    Let us modify the model from MPL to Convolution Neural Network (CNN) for our earlier digit identification problem. CNN can be represented as below − The core features of the model are as follows − Step 1 − Import the modules Let us import the necessary modules. Step 2 − Load data Let us import the mnist…

  • Model Evaluation and Model Prediction

    This chapter deals with the model evaluation and model prediction in Keras. Let us begin by understanding the model evaluation. Model Evaluation Evaluation is a process during development of the model to check whether the model is best fit for the given problem and corresponding data. Keras model provides a function, evaluate which does the…

  • Model Compilation

    Previously, we studied the basics of how to create model using Sequential and Functional API. This chapter explains about how to compile the model. The compilation is the final step in creating a model. Once the compilation is done, we can move on to training phase. Let us learn few concepts required to better understand…