How To: Training an AI Fashion Blogger

by Leanne Luce

The AI Fashion Blogger

#robotswearingclothes — you can follow this hash tag or my profile to see new generative fashion blogger posts on instagram!

In a recent interview with Floydhub, I discussed a project I’ve been working on: teaching a computer to generate images in the style of a fashion blogger. I used Floydhub’s platform to train a model that generated the cover image on my upcoming book, Artificial Intelligence for Fashion, which is available for pre-sale now on Amazon!

I’d like to come right out and say that I, in no way, believe that teaching a computer how to generate fashion blogger images replaces the work of the fashion blogger. There are a lot of talented and creative bloggers who are rock at what they do {I’m talking about you Damsel in Dior and Song of Style}. My intention is not to diminish this type of work or try to automate it. This project is an ongoing fun project, exploratory challenge, and a chance to get hand-ons.

Generative Adversarial Networks (GANs)

To teach a computer to generate these kind of images I relied on a machine learning method called a GAN, which stands for Generative Adversarial Network. To learn more about generative networks, I recommend this article on OpenAI’s blog. To summarize, a GAN consists of 2 dueling neural networks. One network generates images and the other determines whether or not the images are real or fake. As the model keeps training, it gets better at generating images that the second neural network determines are real.

In this post, I won’t get into explaining all the technical jargon of what a neural network is or what a GAN is. I will show you the beginnings of what a GAN can do with fashion blogger data and how you can train your own model or generate images using mine on Floydhub.

Step 1. Discovery

This step isn’t a technical step, but I believe it’s important to say. Whenever I start out diving into a project that I don’t know how to accomplish, I start by making small time investments across a number of solutions before deciding to invest a lot of time into a single one. For the GAN fashion blogger, my approach was no different. I knew I wanted to use a GAN but I had never implemented one and didn’t know what to do. I searched for examples on Google and Medium, trying things along the way, until I stumbled across this post. I thought it was a promising sign that the author was able to accomplish this project within the time frame of a Hackathon. As I looked into it, I realized he had referenced Floydhub’s example DCGAN, which would allow me to quickly and easily train a machine learning model on their machine learning platform. In fact, Floydhub was built to do exactly that.

Step 2. The Data

A friend of mine helped me by scraping a bunch of fashion blogger accounts and gave me a huge dataset go sort through, full of relevant data. However, there are many ways to get data from the internet. For example, you can download Chrome Extensions, like Image Downloader which allow you to bulk download image from a webpage. Just be careful that you’re not violating a site’s terms of use while doing it.

Having good data and a lot of it is crucial… more on that later.

Step 3. Data Mining

What I did following this step, I admit I am not proud of! I hand sorted this data, pulling out (at first) about 1,200 images of full body front view figures. In this process, I wanted to create a dataset which would only contain images that were full body and front view in order to constrain the problem. For many fashion bloggers, there are a wide variety of images on their page: close-ups of items, back views, landscapes, and more.

Now that I do have a solid dataset of these images however, it will be easier to get more of them by training a classifier than can sort the data instead of doing it by hand!

 A screenshot from my full body, front view fashion bloggers dataset.

A screenshot from my full body, front view fashion bloggers dataset.

Step 4. Training

To train the basic DCGAN that was already hosted on Floydhub, I followed their instructions almost verbatim. You can find them here. If you’re interested in doing the same, I’ve added a few tips to my Readme docs for this project. I admit, using this tool does require using terminal, just a little bit.

What I learned quickly was that my original 1,200 images was not enough. I built my dataset up to about 4,000 images and started seeing much more high quality results. Although, frankly, even that wasn't enough.

 During training, the early results (on the left) are far less detailed.  Eventually the images towards the right become more human-like and gestural.

During training, the early results (on the left) are far less detailed.  Eventually the images towards the right become more human-like and gestural.

Step 5. Generate

Once the model is trained, you can select images from the output data or use the generate.py scripts to make more images using the pre-trained model. The output images will look something like this:

#robotswearingclothes generative fashion blogger images by leanne luce
#robotswearingclothes generative fashion blogger images by leanne luce
#robotswearingclothes generative fashion blogger images by leanne luce

There’s a lot more work to be done to make these images higher resolution and more human-like. Join our mailing list and follow The Fashion Robot for improvements to this project.