Building a CNN based mobile app for face matchingThis little writeup describes the process in building a Convolutional Neural Net based mobile application. The app takes a picture of someone's face and tries to match it to a famous actor/actress. OverviewThis is a not a theorethical explanation of how CNN work. There is plenty of litterature on the subject on the web. Here I'm going over some technical details on how to build an image recognition application without any dataset handy. The process is roughly the following:
Define your methodologyGetting a good dataset is one of the most important things for getting decent results from your model. I've found this to be poorly documented, since people usually rely on academic datasets like Imagenet/Cifar etc. If you want to build a practical application, you will usually want to build your own. You need to define what data you want clearly beforehand, which labels you are going to use etc. Here I have the following:
Building the training/validation datasetScrape your imagesA good dataset is one of the most important things to get right. In this case we want lots of pictures of movie star faces. The first step is to download all the pictures from the internet. IMDB is a good source for this. Using tools like beautiful soup and joblib, you can make this relatively easily. See the following script: Data preprocessingImages from IMDB often contain multiple actors. What we want is only the right actor's face. In order to extract only the right faces with the right size, here is the approach used:
Resize your images $ parallel -j8 convert {} -resize 256x256! {} ::: */*.jpg Training the modelIn order to train the model, let's use the libccv library. Building the mobile appiPhone app Room for improvement
|