Coder Social home page Coder Social logo

mooc's Introduction

Inventory Monitoring at Distribution Centers

Distribution centers often use robots to move objects as a part of their operations. Objects are carried in bins which can contain multiple objects.

In this project, we will have to build a model that can count the number of objects in each bin. A system like this can be used to track inventory and make sure that delivery consignments have the correct number of items.

To build this project we will use AWS SageMaker and good machine learning engineering practices to fetch data from a database, preprocess it, and then train a machine learning model. This project will serve as a demonstration of end-to-end machine learning engineering skills that we have learned as a part of this nanodegree.

Project Set Up and Installation

Dependencies

Python 3.7
PyTorch >=3.6

Installation

pip install -r requirements.txt

For this project, it is highly recommended to use Sagemaker Studio from the course provided AWS workspace.

For local development, you will need to setup a jupyter lab instance.

Follow the jupyter install link for best practices to install and start a jupyter lab instance. If you have a python virtual environment already installed you can just pip install it.

pip install jupyterlab

In AWS Sagemaker, we have created a bucket to store all of our downloaded images.

..

OPTIONAL: If your project has any special installation steps, this is where you should put it. To turn this project into a professional portfolio project, you are encouraged to make your README detailed and self-explanatory. For instance, here you could explain how to set up your project in AWS and provide helpful screenshots of the process.

Dataset

Overview

To complete this project we will be using the Amazon Bin Image Dataset. The dataset contains 500,000 images of bins containing one or more objects. Dataset can be access from here

For each image there is a metadata file containing information about the image like the number of objects, it's dimension and the type of object. For this task, we will try to classify the number of objects in each bin.

Access

1. Resource type

S3 Bucket

2. Amazon Resource Name (ARN)

arn:aws:s3:::aft-vbi-pds

3. AWS Region

us-east-1

4.AWS CLI Access (No AWS account required)

aws s3 ls --no-sign-request s3://aft-vbi-pds/

Dataset is imbalance , here's a dataset distribution.

..

5. AWS Sagemaker Studio

  • Launch AWS Sagemaker Studio.
  • Import jupyter notebook file sagemaker.ipynb
  • Make sure kernel is started.
  • Run cells.

Model Training

For this experiment, we have use a Resnet50 model and decide to tune some parameters:

hyperparameter_ranges = {
    "learning_rate": ContinuousParameter(0.001, 0.1),
    "batch_size": CategoricalParameter([32, 64, 128, 256]),
    "epochs": CategoricalParameter([10,15, 25 , 30 ])    
}

Best hyperpapameters and jobs

..

Best_estimator.hyperparameters

{'_tuning_objective_metric': '"Test Loss"',
 'batch_size': '"32"',
 'epochs': '"25"',
 'learning_rate': '0.0012128565992639416',
 'sagemaker_container_log_level': '20',
 'sagemaker_estimator_class_name': '"PyTorch"',
 'sagemaker_estimator_module': '"sagemaker.pytorch.estimator"',
 'sagemaker_job_name': '"Capstone-awsmle-hpo-job-2022-05-26-07-05-00-441"',
 'sagemaker_program': '"tuner.py"',
 'sagemaker_region': '"us-east-1"',
 'sagemaker_submit_directory': '"s3://sagemaker-us-east-1-310754713715/Capstone-awsmle-hpo-job-2022-05-26-07-05-00-441/source/sourcedir.tar.gz"'}

Model Profiling and Debugging

We've used model debugging and profiling to better monitor and debug your model training job. After that we generate a Profil report.

..

..

Model Evaluation

..

The accuracy of the benchmark model chosen is 56 % (Approx), the experiment model didn’t achieve the results of the Benchmark. So as next steps, must work more on the data and its transformation. Maybe doing some data augmentation or transfer learning.

..

..

Model Querying

  • Open an image
from PIL import Image
img_dict={ "url": "https://aft-vbi-pds.s3.amazonaws.com/bin-images/109.jpg" }
img_bytes = requests.get(img_dict['url']).content
Image.open(io.BytesIO(img_bytes))
  • Inference
response=predictor.predict(json.dumps(img_dict), initial_args={"ContentType": "application/json"})
response[0]
  • Find the class
np.argmax(response, 1)

Furthermore

  • Train oour model on multiple instances.

  • Train our model on spot instances.

    We have seen a notable difference between:

    X (the actual compute-time your training job spent) and

    Y (the time you will be billed for after Spot discounting is applied)

    signifying the cost savings you will get for having chosen Managed Spot Training. This should be reflected in an additional line:

    Managed Spot Training savings:

    $$(1 - \frac{Y}{X})*100%$$

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.