Little girl image judgment system Lolinco machine learning

Introduction

This article is SLP_KBIT Part 2 Advent Calendar 2016 --Qiita's 7th day article.

This article is the second part of the previous and next parts, so please read here before reading this article.

Lolinco Machine Learning Edition

Then, in the app called Lolinco created with gembaf at the hackathon held at SLP, I I will explain the part of machine learning that I was in charge of. (It's quite fluffy, such as how to use it, because it can be quite long if you don't understand it or explain all the code.)

Development environment

This time, we will use a machine learning library called Tensorflow published by Google.

Python 2.7.6 List of pips tensorflow (0.5.0)

Refer to the following for installation http://qiita.com/bohemian916/items/4f0736dcea932a162d9e

Process flow

Of this process flow, Tensorflow is used for the part that determines whether it is the last loli. image

Implementation

1. Creating a model

In this phase, the loli and other images explained in Front are trained as teacher data to build a model.

Create test.txt and train.txt that contain the image path and image classification (loli or other) of the data to be trained first and the test data.

test.txt,train.txt


train_img/loli/image_2942_0.jpg 1
train_img/others/image_1150_0.jpg 0
train_img/others/image_588_1.jpg 0 
・
・
・

Based on these teacher data, create a model from the following code. https://github.com/SLP-KBIT/Lolinco/blob/master/lib/init_model.py

As you can see at the end of the code, the resulting model is saved as model.ckpt.

2. Image discrimination

Now, use the model.ckpt mentioned earlier to determine the image.

Code that determines the image https://github.com/SLP-KBIT/Lolinco/blob/master/lib/judge_loli.py

Execute the image you want to determine at runtime as a runtime argument In this case, the face image is extracted from the image with OpenCV, and the face image is discriminated.

Extraction of face images and discrimination of images are described in Sinatra's routing. https://github.com/SLP-KBIT/Lolinco/blob/master/app.rb

References

Identify the anime Yuruyuri production company with TensorFlow http://kivantium.hateblo.jp/entry/2015/11/18/233834

Impressions

I don't usually do machine learning, so the truth is that I found a good sample and managed to move it after this project started.

I tried to understand as much as possible in 2 days, but even the explanation of the code was difficult with many technical terms ... orz Also, if I have a chance to touch Tensorflow, I would like to start from the basics.

Recommended Posts

Little girl image judgment system Lolinco machine learning
Little girl image judgment system Lolinco front edition
Practical machine learning system memo
Machine learning
"OpenCV-Python Tutorials" and "Practical Machine Learning System"
Judgment of igneous rock by machine learning ②
Face image dataset sorting using machine learning model (# 3)
Inflated learning image
[Memo] Machine learning
Machine learning classification
Machine Learning sample
Image collection Python script for creating datasets for machine learning
I tried to compress the image using machine learning