Leaving off from the last post where we wanted to create an app that would be able to discern the underwear my friend makes, called Apt, or basically any other underwear.

To do this we need an create an Image Classifier that uses Machine Learning.

How it works is that you give it an image and it will try and classify what is in that image and give it a category. It does this by having trained on a test set of images that are already labelled (Apt/not Apt) and then retrained until the Machine Learning model is correct often enough of the time for our purposes.

Collect your data

There need to be at least 10 images per category, at least 299px X 299px in size, and can be any format that Quicktime player can open, which is quite interesting but I will stick to JPEG or PNG for now.

Other considerations for the images we are going to train our model on are:

  • Use images as similar to the images capture conditions that your user will probably have – what lighting conditions and angles are your models going to be tested against in real-world situations?
  • The higher the number of images the model is trained on the higher the model’s precision, roughly speaking. 100 is better than 10 and 1000 is better than 100.
  • The model is only going to be as good as the training data, so make sure the image categories you are using have similar amounts of images in them. Eg. 100 each.

To save time, I will be filming myself (and hopefully another volunteer or 2) wearing different underwear brands and styles from different angles, and then taking still images from the video.

Here’s a sneak peek (maybe NSFW?) – it looks like it worked! I compared 2 pairs of similar black coloured underwear and the model could distinguish between them, and with more data to train the model on the confidence should increase.

In the next post I’ll go through training & testing the data.

You can read the Apple developer docs here.

Leave a Reply

Your email address will not be published. Required fields are marked *