The End

Ayush Agrawal
GSoC ’19
Published in
6 min readAug 26, 2019

Hi there! Long time no see.

I don’t know from where to start writing this post.

It’s 26th August today, exactly 6 months since I first saw TensorFlow in GSoC Orgs list and contacted Paige on 26th February, 2019.

Little did I knew that that 1 email will change me completely.

Most of you have been here with me, following my work pretty closely but those who are new, let me give a brief introduction about myself:

My name is Ayush Agrawal and I’m a 3rd year Undergrad student at BITS Pilani — K.K. Birla Goa Campus, India studying toward a Bachelor of Engineering (B.E. Hons.) degree in Electronics and Instrumentation Engineering. I am more interested in the field of Computer Science than my major as you would all have guessed it by now.

I had been accepted in Google Summer of Code 2019 program to work with TensorFlow, Google. Since last 3 months I’ve been working with the Swift for TensorFlow(S4TF) Team on the project “End-to-End Mobile Swift for TensorFlow” in which my main task was making mobile Colab notebooks which can act as examples, guides and documentations for S4TF.

The purpose of this particular blog post is to act as a core writeup document describing the project, what was accomplished, what was learned, my experience, and future goals for this project. So one by one, let’s get started 😁

The Project

This project was all about convert the TensorFlow’s Udacity course materials implemented in Python to Swift. These notebooks could be used in a future course, specifically targeted at mobile app developers (“Intro to Machine Learning with S4TF”).

The target was to have a batch of tutorials that work, are well-written, and that would be effective teaching tools to a new user learning Swift for TensorFlow. To have them as an end product tutorials that could be used by someone taking an equivalent to the Udacity course, only in Swift.

Implemented project 👉🏻 https://github.com/Ayush517/S4TF-Tutorials

Mentors: Paige Bailey, Brad Larson and Richard Wei.

I can’t even explain HOW MUCH they all have helped me. Every time I felt low, they motivated me and kept on pushing me to give as good results as possible. Brad even debugged my code along with me once 😂

What was accomplished

So, as far as the project completion is considered, I believe I’ve done what I set out to do.

There were 11 notebooks in the original Udacity course ranging from basics to Image Classification to Transfer Learning. In the implemented project, there are 8 notebooks (S4TF_Tutorial_1 to S4TF_Tutorial_8) which correspond to the first 8 notebooks from the Udacity course. Apart from these 8 notebooks, there are 2 more notebooks which are associated with GANs and Autoencoders.

I’m also working on a Transfer Learning notebook. The code is completed, just the documentation part is left but right now it’s on hold because of the Final evaluation. The last 3 notebooks couldn’t be converted beacuse S4TF currently lacks SavedModel loading and Model importing. Right now, we can only pull pretrained weights from checkpoints via Raw TensorFlow operators. Since, we couldn’t have a solid story for a generalized weight loading mechanism in time for these notebooks, Transfer Learning notebooks were not converted.

What was learned

I myself had never coded a single line in Swift before GSoC. In this project I wrote coding tutorials that’ll hopefully be used by thousands of developers one day. Seeing the irony?

  • For starters, I learnt Swift Programming language along with most of its code style. I suggest going over these materials if you want to learn it yourself:

Swift API Design Guidelines

Swift API Design Guidelines video

Google Swift Style Guide

  • I learnt about the “Swift for TensorFlow” framework and it’s tremendous capabilities.
  • About how and what to search. This is a very undervalued but an important trait that I can associate with a developer. If you can’t search effectively and efficiently, life is gonna be tough. During this project, I had to search so much — sometimes for a library, sometimes for a function, sometimes about how to implement that particular function in swift etc. Once I had to read the entire implementation of ndarray and array in numpy to understand and solve an issue.
  • Libraries that I read and extensively: PIL, numpy, glob, subprocess, matplotlib.
  • I also learnt about the tremendous speed increase that GPUs and inbuilt functions can have on a function. Use GPU operations instead of CPU operations whenever possible e.g. resizing a tensor and then converting it to a numpy image instead of first converting to numpy image and then resizing the numpy image array. Tensor operations happen in GPU whereas numpy operation take place in CPU. Further, In one of the notebooks I thought of using my own function for image conversion from RGB to Grayscale. It took 1.5 hours to create a tensor dataset of 3000 images. Then, I used inbuilt PIL function to do the same. You just guess for a moment how much time that took.

It took just 20 minutes. 20 minutes for a task that was earlier taking 90 minutes. Result: I was 🤯

  • Apart from all these things, I learnt the value of good guidance. I was once stuck on a problem for 2 days. After getting frustrated badly, I mailed Brad. He guided me and I solved the problem that day itself. This is what having good mentors mean. They help you when you’ve lost all hope and they get you out of it.

My experience

That’s not me but the scenario is almost the same
My experience in a nutshell
PS: Numbers can be deceptive 😈

Future goals for this project

  • Adding Transfer Learning Notebook
  • Bringing it into core documentation

Apart from the experience gained by working closely with these many Google SDEs, the perks that come are unparalleled.

TensorFlow T-shirt and socks

I genuinely recommend all of you to start contributing to the TensorFlow project. No matter how small the contribution might be, the things that you’ll learn while working with the team are in plain simple terms **AWESOME!!!**.

This blog post wasn’t the kind that I’ve written earlier where I’ve explained every step in notebooks. But after my last blog post, the kind of notebooks that I worked on, needed more research and less explanation. That’s why I didn’t write any posts for them. But in case you still want to know about my thought process or the path in which I moved for this project, do ping me on twitter or facebook.

That’s all folks! I hope you liked it.

Between

May 27, 2019: Acceptance Mail

And

26 August: Final Merge

3 months passed by so quickly…

--

--

Ayush Agrawal
GSoC ’19

Deep Learning Enthusiast | TensorFlow GSoC ’20 Mentor, GSoC ’19 Dev & GCI ’19 Mentor | BITS Pilani, India