Coloring B&W Images with Machine Learning

I’m finishing up my Machine Learning Nanodegree from Udacity, and I decided to train models to color black and white images for my final project. While this may sound daunting to some, this particular task has been done by many folks already. I’m following a tutorial posted by Emil Wallner with data that I graciously received from WW2DB. The tutorial is in turn based on another existing project called Deep Koalarization. Google is already beta testing their own colorization functionality for the masses, so chances are people won’t be banging on my door to use my models. However, I’m thrilled that I got a chance to try this out for myself.

Here’s code from Emil’s tutorial:

Here’s a gist of what I tried:

While it’s not perfect, I’m pretty happy with the results right out of the box.

Original Iwo Jima photo from WW2DB, modified to be 256×256
Resulting image colored by the model I trained

I didn’t change much from the original tutorial. It’s still using the soon-to-be-deprecated TensorFlow 1.x, but I added a validation set to minimize the mean squared error along with a few other small things. The training data consists of 1,600 color images related to WWII. At least 75% of them were pre-1950. All of the images I received from WW2DB were modified to be 256×256 beforehand using ImageMagick. Of those 1600, about 5% were used for validation. Finally, 122 colored images were set aside for testing at the end. My script ran through the data about 250 times, and it took under 8 hours to train.

Here’s an example from my test set — the original colors, the colors stripped, and recolored with my model:

Original Colors
Colors Removed
Colored from Black and White with ML

Here’s one where there is no ground truth:

Black and White WWII Iwo Jima Photo (scaled to 256×256)
Colored with ML

The mind-blowing thing about this project is how easy it was for me to start training machine learning models for myself. A simple Google search found previous work from so many other people. I took a Udacity course for more structure in my pursuit of knowledge, but I could have easily gone through this tutorial without it and still have produced good results. I didn’t pay for compute time because I used Google Colab, which gave me access to a free Jupyter notebook environment hooked up to a GPU. I ended up being lucky enough to get a machine with 25+ GB of RAM and 300+ GB of storage. I did pay for extra Google Drive space ($20 per year), but that’s about it. It’s honestly amazing what we can do these days.

Redirecting My Career Back into Machine Learning

Hi. I’m Janice. I am a software engineer. I quit my job this year to shift my career towards Machine Learning. My husband runs dev-notes, and I plan to use it to chronicle my journey. I’m hoping this will also help keep myself accountable to my goal.

My Background

So, why am I doing this?

I’m not new to this field. I have a bachelor’s degree in computer science from 2002. I’ve been programming since I was in high school. I worked for nearly 8 years at IBM Research as a software engineer on speaker recognition, speech recognition, gender detection, keyword search, etc. You’d think this would be easy for me, right? Don’t I know what I need already?

Not quite. (Or, maybe I lack the confidence?)

I paused my career to start a family right around when the state of the art for these sorts of systems shifted from HMM-based models to neural networks. When I worked at IBM, I interacted daily with proprietary code and tools. While I know how to solve problems in general, I don’t have the confidence yet to find a job. I have no portfolio. All of my experience is dated and very specific. I need to address these shortcomings. Artificial intelligence has become so accessible these days that folks with less experience have already found their place. I’m confident that someone like me should be able to do this. (Do I sound confident?)

When I decided to go back to work again after my career break, I had to relearn how to work with the constraints of having a young family. For me, this was a big deal. I timidly took roles at universities in hopes of maintaining a good work-life balance. However, I was doing primarily web development in Ruby on Rails with bits of python thrown in, and it wasn’t fulfilling. Looking back at my career, I was happiest when I was working on machine learning problems. I want to be back there.

My Plan

I just enrolled in the Udacity Machine Learning Nanodegree, with a start date of April 16, 2019. The time commitment is 2 three-month terms for about 10 hours a week. I’m hoping that I’ll be able to complete the course in less time, but I’m a mom to two young kids. We’ll see how it goes. I chose Udacity because I do much better when there’s a structure to my learning. They stress that the course will help build my portfolio, which I’m sure will be useful once I start applying for jobs. This will cost me $999 for two terms, so basically $2k.

I’ve already subscribed to a year of datacamp, so I’m making my way through as many of those courses as I can. A year subscription cost me $180. I think it’s worth it so far.

I hope to at least try a Kaggle competition. Even if I fail, it looks like a great way to get my hands dirty and learn.

Finally, I plan to take the famous Coursera course with Andrew Ng. I hear that this is a great foundational course. I’ve only just started it.

Anyway, thanks for reading. I plan to have regular updates in the coming months.