How I’ve spent a week learning Tensorflow.js so that I could put it on my CV

Zdenek Hynek
5 min readMar 12, 2019

--

I’m sitting at my WeWork hot desk and drinking mine third flat white. Even though it’s like 9:30 am and I just got here.

It’s Monday morning, my first day of officially being unemployed. They didn’t get me in the last place, you know? I’m thinking what I should do next. Something that would show my passion for high-paying jobs.

Worked on a project recently where it’d be handy to do some image recognition. And some friends are running an AI/Javascript meetup. So it made me wonder.

How much do I actually need before I can put Tensorflow.js on my CV and get a job as an AI/Javascript specialist?

I’ve decided. 5 days sounds about right.

Day 1

Okay, this is my assignment for the next 120 hours. I have an input generated from an obscure software which looks like this:

And I would really love to know, what are those tiny numbers at the top-right. The numbers that won’t stand still.

It’s software generated number in a mono-space font. So in theory, this should be a walk. Unfortunately, due to the tiny font size, and the lovely drop shadow the digits bleed somewhat together. The 6 next to 5 will look slightly different from 6 next to 2 and if you think that sucks, you are absolutely right, my dear friend.

So I do need to train my neural net on my bespoke dataset. The individual digit will look slightly different, but still very very similar to each other. Which is lucky. Cause I have a tiny amount of training data. Cause I need to generate it and label it myself. And I’m lazy.

The internet says I should be using the convolutional neural networks and I like the sound of it.

Day 2

It’s Tuesday morning and I’ve just made a profound discovery that machine learning is hard. You need to know about computers and math. I can deal with the first. I will struggle with the second.

Still, no turning back now. Read the Tensorflow.js tutorials and it seems like using the model pre-trained on the MINT dataset is the way to go.

Except that I don’t understand how to repurpose the tutorial code to my use case. There are too many options, training in batches and other stuff. After trying for the millionth time to send the right tensor with the right shape to the right model, I’m giving up and deciding that Tensorflow.js is really stupid.

After a cup of WeWork coffee and bit of staring at the London skyline, I start stepping through the call stack and the Tensorflow.js source code. It’s in Typescript but I can still read it. I wonder if that qualifies me to put Typescript on my CV.

I find what I was doing wrong and quickly fixed it. Too late to change my mind about the MINT method not being dumb, though. So I use a method from another tutorial. Decapitated Mobilenet. I should put THAT on my CV.

My god, it’s actually working.

Day 3

Shit, it’s actually not working.

Seems like my training set of two images (that is 1+1) per each digit is not enough.

I have to spend the longest 20 minutes adding more training data.

Holy shit (rarer breed than the ordinary everyday shit), it works.

I should probably really put this into Git already. Except I don’t know if I can use the data from my former employer. Which is the data I’m using. They don’t know it either.

Day 4

I’m starting to write this blog post. Cause I’m too lazy to do what am supposed to do. Which is refactoring. The code is a mess.

In the past couple of days, I’ve ported everything from browser Javascript to Node.js and back. I wanted to work with the file system, and then I’ve realised I actually didn’t. Maybe I’d be much further in life if found a way to focus for a one goddam minute. Twitter.

But all this moving code around made me realised how much I enjoy doing machine learning Javascript.

I know Python. I’ve even built neural networks before in Python. But I’m still so much more comfortable with Javascript. Which is why doing Tensorflow.js still feels by far the easiest data science I’ve done like ever. Comfy, comfy Javascript.

Day 5

I’m hanging out with a friend and not doing much. She just dropped half a million on her first flat. I wonder how much AI/Javascript expert daily rate man-days is that.

Refactored stuff, going up on Github. Done.

The last thing to do is to update my LinkedIn.

The phone rings. Gotta go. Have a wonderful weekend everybody.

--

--

Zdenek Hynek

Freelance developer. Mostly dataviz and datascience/AI.