Git Product home page Git Product logo

cnn-architectures's Introduction

github linkedin tableau twitter

CNN Architectures

Overview:

A Gold mine dataset for computer vision is the ImageNet dataset. It consists of about 14 M hand-labelled annotated images which contains over 22,000 day-to-day categories. Every year ImageNet competition is hosted in which the smaller version of this dataset (with 1000 categories) is used with an aim to accurately classify the images. Many winning solutions of the ImageNet Challenge have used state of the art convolutional neural network architectures to beat the best possible accuracy thresholds.

Dataset:

XceptionNet
VGG19
VGG16
ResNet50
inceptionv3
Fruits 360
Flowers Recognition

Implementation:

Libraries: NumPy pandas PIL seaborn keras

VGG16:

VGG16 was publised in 2014 and is one of the simplest (among the other cnn architectures used in Imagenet competition). It's Key Characteristics are:

  • This network contains total 16 layers in which weights and bias parameters are learnt.

  • A total of 13 convolutional layers are stacked one after the other and 3 dense layers for classification.

  • The number of filters in the convolution layers follow an increasing pattern (similar to decoder architecture of autoencoder).

  • The informative features are obtained by max pooling layers applied at different steps in the architecture.

  • The dense layers comprises of 4096, 4096, and 1000 nodes each.

  • The cons of this architecture are that it is slow to train and produces the model with very large size.

    The VGG16 architecture is given below:
    Keras library also provides the pre-trained model in which one can load the saved model weights, and use them for different purposes : transfer learning, image feature extraction, and object detection. We can load the model architecture given in the library, and then add all the weights to the respective layers.

from keras.applications.vgg16 import VGG16
vgg16_weights = '../input/vgg16/vgg16_weights_tf_dim_ordering_tf_kernels.h5'
vgg16_model = VGG16(weights=vgg16_weights)
_get_predictions(vgg16_model)


VGG19:

VGG19 is a similar model architecure as VGG16 with three additional convolutional layers, it consists of a total of 16 Convolution layers and 3 dense layers. Following is the architecture of VGG19 model. In VGG networks, the use of 3 x 3 convolutions with stride 1 gives an effective receptive filed equivalent to 7 * 7. This means there are fewer parameters to train.

from keras.applications.vgg19 import VGG19
vgg19_weights = 'vgg19_weights_tf_dim_ordering_tf_kernels.h5'
vgg19_model = VGG19(weights=vgg19_weights)
_get_predictions(vgg19_model,0)


InceptionNet:

Also known as GoogleNet consists of total 22 layers and was the winning model of 2014 image net challenge.

  • Inception modules are the fundamental block of InceptionNets. The key idea of inception module is to design good local network topology (network within a network)
  • These modules or blocks acts as the multi-level feature extractor in which convolutions of different sizes are obtained to create a diversified feature map
  • The inception modules also consists of 1 x 1 convolution blocks whose role is to perform dimentionaltiy reduction.
  • By performing the 1x1 convolution, the inception block preserves the spatial dimentions but reduces the depth. So the overall network's dimentions are not increased exponentially.
  • Apart from the regular output layer, this network also consists of two auxillary classification outputs which are used to inject gradients at lower layers.

The inception module is shown in the following figure:


from keras.applications.inception_v3 import InceptionV3
inception_weights = 'inception_v3_weights_tf_dim_ordering_tf_kernels.h5'
inception_model = InceptionV3(weights=inception_weights)
_get_predictions(inception_model,1)


ResNet:

ResNet

from tensorflow.keras.applications.resnet50 import ResNet50

resnet_weights = 'resnet50_weights_tf_dim_ordering_tf_kernels.h5'
resnet_model = ResNet50(weights='imagenet')
_get_predictions(resnet_model,0)


Checkout complete implementation here

Learnings:

CNN architectures Using pre-trained models

References:

ResNet

Feedback

If you have any feedback, please reach out at [email protected]

๐Ÿš€ About Me

Hi, I'm Pradnya! ๐Ÿ‘‹

I am an AI Enthusiast and Data science & ML practitioner

github linkedin tableau twitter

cnn-architectures's People

Contributors

pradnya1208 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.