Do it yourself for programming of image recognition. It works!

cat-205757_640Recently, Facebook, Pinterest and Instagram have gotten very popular.  A lot of pictures and images are generated and sent by users.  From human faces to landscape, there are a lot of varieties of pictures on them.  In order to enhance their services,  image recognition technology has been developed at the astonishing rate.  By this technology, computers can understand what the objects in images are.  Today,  I would like to re-create the simple image recognition by just following the tutorials on the web.

Image recognition can be done by the state of the art “deep learning”.  This is  one of the latest iterations of computer programming. It sounds so complicated that business personnel may not want to do that by themselves.  However,  specific programming languages for deep learning are provided as open source and good tutorials are also available on the web,  it is possible that the business persons  program simple image recognition by themselves even though  they may have no expertise in computer science. Let me tell you my experience of that.


1. Choose programming languages

There are several programming languages for deep learning. I choose “Torch” is provided Facebook artificial intelligence research as it becomes open source at the beginning of this year. I think it is easy to learn for beginners.


2.  Find good tutorials for the theory

In order to understand what the theory is behind image recognition,   I find the best tutorials and lectures provided by the Computer Science Department of University of Oxford 1 .  This is a good reference to understand what deep learning is and its applications.  Even though the theory is not always required for programming,  it is recommended to watch the tutorials before programming in order to grasp broad pictures of image recognition.


3.  Let us program image recognition and find what computer says

Programm itself is provided by the tutorial 2.  In the tutorial I use image dataset, which has the classes: ‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’.  So computer should classify each image into one of 10 classes above. I just copy and past programs which are provided in the tutorial.  It takes less that 10 minutes. I run the program and obtain the results. Then I choose three of the results and see what the computer says. Name of objects above images are correct answers.  The computer  provides its answers as the probability of the each class.  Therefore sum of the 10 numbers below is close to “1”.

スクリーンショット 2015-08-04 15.59.42

In this result, the correct answer is “frog”.  In computer answer, frog has the highest probability of 0.4749….  So  the computer has a good guess!


スクリーンショット 2015-08-04 15.58.41

In this result, the correct answer is “cat”.  In computer answer, cat has the highest probability of 0.3508….  So  the computer has a good guess!


スクリーンショット 2015-08-04 16.00.08

In this result, the correct answer is “automobile”.  In computer answer, automobile has the highest probability of 0.3622….  So  the computer has a good guess!  Although this program is not perfect in terms of accuracy of whole test results, it is reasonable to learn programming of image recognition.


You may not be  a computer scientist.  However, it is good to program this image recognition by themselves because it enables you to understand how it works based on the state of art deep learning.  Once you do it,  you do not need to consider image recognition as “Black box”.  It is beneficial for you at the age of the digital economy.

Yes, torch and the tutorials are free.  No fee is required.  Could you try it as your hobby?



1.   Machine Learning: 2014-2015,  Nando de Freitas, the Computer Science Department of University of Oxford

2.  Deep Learning with Torch – A 60-minute blitz



Note: Toshifumi Kuga’s opinions and analyses are personal views and are intended to be for informational purposes and general interest only and should not be construed as individual investment advice or solicitation to buy, sell or hold any security or to adopt any investment strategy.  The information in this article is rendered as at publication date and may change without notice and it is not intended as a complete analysis of every material fact regarding any country, region market or investment.

Data from third-party sources may have been used in the preparation of this material and I, Author of the article has not independently verified, validated such data. I accept no liability whatsoever for any loss arising from the use of this information and relies upon the comments, opinions and analyses in the material is at the sole discretion of the user. 

Can you be next “Mark Zuckerberg” with open source software?


I like open source software because it is  almost free to use,  modify and distribute. For example,  I use “R language” for data analysis as I can share code to anyone without cost.  R is an example of open source software. When I used to be a risk manager more than 10 years ago, I used MATLAB.  This is an awesome software for data analysis. However, we need to buy a license to use it. So I cannot recommend it for everyone.  But I can do that for R as it is free.


Open source software is strong enough to change the landscape of developing computer programs. Especially I look at the movement driven by Facebook, it looks like a big tsunami to take over the industry. It has more than 200 open source software projects from mobile application development to artificial intelligence according to the article. Mark Zuckerberg,  Founder and CEO of Facebook, have been taking initiative open source movement for many years.  For new start-up, it is very good and helpful because


1.  It accelerates development of applications

Because startups usually do not have enough resources to develop the applications from scratch, it is very helpful for them to use open source software. All they should do is modify the software to make applications. Facebook is also built by using open source software, although it becomes one of the biggest IT companies in the world.


2. There are more choices provided by open source softwares

When there are several kinds of open sources for specific purposes, we can choose the best one for our own purpose. All we should do is  to assess each of them.  For example, when you are interested in artificial intelligence, there are many major open source softwares,  such as TheanoPylearn2Torch, OpenDeep, Chainer and so on.  Each of them is a little different in terms of functionality and structures. Therefore, we should choose the best one for our own purpose. When we have the best choice. it allows us to develop applications rapidly and effectively.


3.  Open source softwares can lower the entrance barriers

It is usually difficult for start-ups to develop complex programs, such as deep learning, from scratch. But supported by open source software, start-ups can learn and develop the applications at the same time. It is very important in the digital economy as the supply of experts in such fields are always less than the demands in labor markets.



Going forward, I would like to develop an economic analysis system by using open source software and make it available for everyone who is interested in.  I hope everyone can analyze the economy in his/her own country by him/herself in the business.