Giter Club home page Giter Club logo

image-classification-using-aws-sagemaker's Introduction

Image Classification using AWS SageMaker

This assignment is a part of AWS Machine Learning Engineer Nanodegree Program.

The following tasks are performed.

Project Set Up and Installation

Enter AWS through the gateway in the course and open SageMaker Studio. Download the starter files. Download/Make the dataset available.

Dataset

Udacity's Dog Classification Data set is used to complete the task.

The dataset can be downloaded here.

Dependencies

Python 3.7
Pytorch AWS Instance

Files Used in the notebook

  • hpo.py - This script file contains code that will be used by the hyperparameter tuning jobs to train and test/validate the models with different hyperparameters to find the best hyperparameter
  • train_model.py - This script file contains the code that will be used by the training job to train and test/validate the model with the best hyperparameters that we got from hyperparameter tuning
  • inference.py - This script contains code that is used by the deployed endpoint to perform some preprocessing (transformations) , serialization- deserialization and predictions/inferences and post-processing using the saved model from the training job.
  • train_and_deploy.ipynb - This jupyter notebook contains all the code and the steps performed in this project and their outputs.

Hyperparameter Tuning

  • The ResNet model represents the deep Residual Learning Framework to ease the training process.
  • A pair of fully connected Neural Networks has been added on top of the pretrained model to perform the classification task with 133 output nodes.
  • AdamW from torch.optm is used as an optimizer.
  • The Following hyperparamets are used: "batch-size": sagemaker.tuner.CategoricalParameter([32, 64, 128, 256]), "lr": sagemaker.tuner.ContinuousParameter(0.01, 0.1), "epochs": sagemaker.tuner.IntegerParameter(2, 4)

The hpo.py script is used to perform hyperparameter tuning.

Hyperparameters Tuning Hyperparameters

###Training Jobs Training Jobs

Debugging and Profiling

The Graphical representation of the Cross Entropy Loss is shown below. Cross Entropy Loss

Is there some anomalous behaviour in your debugging output? If so, what is the error and how will you fix it?

  • There is no smooth output line and there are different highs and lows for the batch sets. If not, suppose there was an error. What would that error look like and how would you have fixed it?
  • A proper mix of the batches with shuffling could help the model learn better
  • Trying out different neural network architecture.

Profiler Output

The profiler report can be found here.

Model Deployment

  • Model was deployed to a "ml.m5.large" instance type and "endpoint_inference.py" script is used to setup and deploy our working endpoint.
  • For testing purposes ,few test images are stored in the "testImages" folder.
  • Those images are fed to the endpoint for inference/
  • The inference is performed using both the approaches.
    1. Using the Predictor Object

Inference Response

Inference Response

Model Dndpoint

End Point Deployment

image-classification-using-aws-sagemaker's People

Contributors

nhatofo avatar

Stargazers

 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.