Summer Internship Experience- Part 1

Shivam Sahu
5 min readJul 19, 2019

--

There are decisions in our lives that we regret, and decisions in our lives that we are proud of, but the best decisions are the ones that change the course of your life. In a good way, of course. To me, this internship was one of those decisions.

I took the decision of joining Inturiyam as a Machine Learning Intern in May 2019. Honestly, I wasn’t sure if this is a great company or not, because of their lack of social media presence. Before taking the decision to join them, I tried to stalk them on social media profiles, but there wasn’t much to stalk. I also had other offers, and that made my decision more difficult. However, after an interview with the CEO Anand Hariharan and knowing about his vision for the company, I took the decision of joining them.

I joined as a Machine Learning Intern, and on the very first day, I was asked to learn Estimators in Tensorflow. Earlier doing Andrew NG course I was familiar with TensorFlow, but I have never worked on Estimator, altogether it was going to be a new experience working with new technology, and applying it to a production-level project.

Summary of the project I worked on

I was asked to work on Text detection in Indian Languages from images. Due to unavailability of large dataset,we tried to make our own dataset of Kannada character. We had 10 images per character, and our goal was to classify each character using Siamese network. Extracting the character from the images was a big deal. So thought of model in two steps unlike what YOLO does in object detection in a single step. First model will extract the text from the images and the extracted text will be fed to our siamese network to classify each character. The problem of unavailability of dataset came into play.

YOLO is for object detection, so is EAST model for text detection. I found that it not only resolved our problem of not having dataset, but also it performed well on drawing bounding boxes around text in any language.

Technologies and Environments

Unlike other technology we have very less online content available about Estimators. The only suitable content I found available is documentation on tensorflow site. You can learn about the Estimator implementation and difficulties I faced in part-2 of this blog.

After preparing the CNN model on Estimators, we started training it on Google Colab. Though Google claims that you can use GPUs/ TPUs on Colab, but the problem is that most of the time it is not available. Also one more problem we faced was that the model was training for way less iterations then expected. So we moved on to Google Datalab to get the benefits of GPU. They claim it to be free, but is it actually. :XD

Cloud Datalab is the hosted way to run Jupyter notebooks on Google Cloud. It is a powerful interactive tool created to explore, analyze, transform and visualize data and build machine learning models on Google Cloud Platform. I’ll go over how GCD actually works and some of the caveats I’ve encountered so far :GCD(Google Cloud Platform) isn’t actually a platform in itself, it’s a docker image built and maintained by the Google team on Github.

Note: Although Jupyter-based, GCD only allows Python language so far. It’s a beta though so I’m guessing other languages should be supported soon.

The installation proposed so far is kind of minimalistic : it’s a basic OAuth2 procedure that requires your permission to deploy two servers. One Google Compute Engine instance (which serves only during installation and updates, so remember to shut it down afterwards) and one Google App Engine instance which is the actual Jupyter web server you’ll be using.Code execution is handled by the underlying Google App Engine instance.

Datalab does not offer distributed training. Instead, it trains the models on the Datalab instance.

Google Cloud ML Engine, which is a separate service people often use in conjunction with Datalab allows distributed training of TensorFlow models.It was challenging and fun to work on it as it was not a jupyter notebook that I was working on from past one months.One thing worth mentioning here is the file structure you have to follow to run training on google cloud platform.

We have to create a job folder,inside it there should be three files

  1. __init__.py :It can be an empty file.
  2. setup.py : This contains the list of dependencies used along with their version.
  3. task.py : This file is like .ipynb file in jupyter notebook, except the code has to be in Tensorflow Estimators and only a minimal library support is provided

We used Google ML Engine because it offers the following things-

1- Data Preprocessing- GCP services such as BigQuery, Cloud DataProc, Cloud Dataflow, and Cloud Dataprep are used for acquiring and preparing the data. Cloud Dataprep, a service based on Trifacta, is an intelligent, serverless data service for visually exploring, cleaning, and preparing structured and unstructured data.

2- Training: Cloud MLE speeds up your model by using accelerators (GPU) and clusters (multiple workers). You can do GPU speedup as well as vertical(by using an arbitrarily powerful GCE instance (no code changes required)) and horizontal scaling(by using multi-cores when the underlying library enables it)

3- Hyper parameter: Cloud MLE lets you tune your parameters with Bayesian optimization.

4- Deployment: Cloud MLE deploys your model as an API.

5- Prediction: The core value of machine learning is derived from accurate predictions. Google Cloud ML Engine hosts the fully-trained models for prediction.There are two ways to get predictions from trained models — online prediction, which is also called HTTP prediction (or sometimes “online prediction”), and batch prediction. Online prediction deals with one data point at a time while batch prediction can accept an entire dataset.

6- Monitoring: Cloud ML Engine predictions are tightly integrated with Stackdriver, the monitoring tool of GCP. We can monitor the predictions on an ongoing basis by invoking the APIs to examine running jobs.

I will discuss in 2nd part of the blog about the architecture and workflow…

Thank you for reading. Happy Reading. : XD

Part 2 link : here

Part 3 link : here

--

--

Shivam Sahu

Senior Undergraduate Student @ Madan Mohan Malaviya University of Technology