Convolutional Neural Network(Can be implemented in AWS Sagemaker)


Amazon SageMaker is a fully managed machine learning service. With SageMaker, data scientists and developers can quickly and easily build and train machine learning models, and then directly deploy them into a production-ready hosted environment. It provides an integrated Jupyter authoring notebook instance for easy access to your data sources for exploration and analysis, so you don’t have to manage servers. It also provides common machine learning algorithms that are optimized to run efficiently against extremely large data in a distributed environment. With native support for bring-your-own-algorithms and frameworks, SageMaker offers flexible distributed training options that adjust to your specific workflows. Deploy a model into a secure and scalable environment by launching it with a few clicks from SageMaker Studio or the SageMaker console. Training and hosting are billed by minutes of usage, with no minimum fees and no upfront commitments.

SageMaker Studio

An integrated machine learning environment where you can build, train, deploy, and analyze your models all in the same application.

Here We are Using AWS Sagemaker Studio to deploy Our CNN

Convolutional Neural Network

A Convolutional Neural Network (ConvNet/CNN) is a Deep Learning algorithm which can take in an input image, assign importance (learnable weights and biases) to various aspects/objects in the image and be able to differentiate one from the other. The pre-processing required in a ConvNet is much lower as compared to other classification algorithms. While in primitive methods filters are hand-engineered, with enough training, ConvNets have the ability to learn these filters/characteristics.

The architecture of a ConvNet is analogous to that of the connectivity pattern of Neurons in the Human Brain and was inspired by the organization of the Visual Cortex. Individual neurons respond to stimuli only in a restricted region of the visual field known as the Receptive Field. A collection of such fields overlap to cover the entire visual area.

Here We are going to identify the Rock,Paper or Scissors using CNN

Here We have three classes

  1. Rock
  2. Paper
  3. Scissors

Check the following Dataset



Using this commands we’ll be able to download dataset

Here we are extracting Zip files and seperating our dataset into training and validation

In respecting training and validation we have three defined classes

and each class will be having images


When working with deep learning models, I have often found myself in a peculiar situation when there is not much data to train my model. It was in times like these when I came across the concept of image augmentation.

The image augmentation technique is a great way to expand the size of your dataset. You can come up with new transformed images from your original dataset. But many people use the conservative way of augmenting the images i.e. augmenting images and storing them in a numpy array or in a folder. I have got to admit, I used to do this until I stumbled upon the ImageDataGenerator class.Keras ImageDataGenerator is a gem! It lets you augment your images in real-time while your model is still training! You can apply any random transformations on each training image as it is passed to the model. This will not only make your model robust but will also save up on the overhead memory! Now let’s dive deeper and check out the different ways in which this class is so great for image augmentation.

Image Data Generator


RELU (for hidden layers):The rectified linear activation function or ReLU for short is a piecewise linear function that will output the input directly if it is positive, otherwise, it will output zero. It has become the default activation function for many types of neural networks because a model that uses it is easier to train and often achieves better performance.

SOFTMAX (for output):Softmax is a mathematical function that converts a vector of numbers into a vector of probabilities, where the probabilities of each value are proportional to the relative scale of each value in the vector.

RMS OPTIMIZER : The RMSprop optimizer is similar to the gradient descent algorithm with momentum. The RMSprop optimizer restricts the oscillations in the vertical direction. Therefore, we can increase our learning rate and our algorithm could take larger steps in the horizontal direction converging faster. The difference between RMSprop and gradient descent is on how the gradients are calculated. The following equations show how the gradients are calculated for the RMSprop and gradient descent with momentum. The value of momentum is denoted by beta and is usually set to 0.9. If you are not interested in the math behind the optimizer, you can just skip the following equations.

Here Input shape of image is 150*150

Here We are using 2*2 Pooling layer and 3*3 Convolutional layer


And upload the image

Path : Path of image upload

Links for referance :





Love podcasts or audiobooks? Learn on the go with our new app.

Understand Evaluation Metrics of Object Detection: GloU, Objectness, Classification, Precision…

Deep Learning on Heroku tutorial (Iris classification)

Stock Price Expectation Using CNN

Convolutional Neural Networks for Medical Image classification

人臉辨識, Face recognition (ArcFace)

ML Paper Challenge Day 29, 30 — Adam: A Method for Stochastic Optimization

Building a mixed-data neural network in Keras

Daily Newsletter — 13th January 2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Govind M Lipne

Govind M Lipne

More from Medium

IoT to ML Reference Architecture — Updated v1.1

Score After Flipping Matrix

Build A Text Recommendation System with Python

Data Compression with Brotli