This article is a continuation of Building a python environment for artificial intelligence (Chainer / TensorFlow / CSLAIER).
In this article, we will install Chainer, a popular artificial intelligence library in Japan. I installed it myself, and there were many things I didn't understand, so I summarized what I investigated. I hope it will be helpful for those who install Chainer from now on.
・ MacBook Pro (Retina, 13inch, Early 2015) · MacOS Sierra (version 10.12.2) ・ Processor (2.7 GHz Intel Core i5) · Memory (8 GB 1867 MHz DDR3) · Graphics (Intel Iris Graphics 6100 1536 MB)
-Homebrew, pyenv, anaconda2-4.2.0 / anaconda3-4.2.0 are assumed to be installed. If you do not have it installed, please read Building a python environment for artificial intelligence (Chainer / TensorFlow / CSLAIER).
If you look at Chainer's git, all you need to use Chainer is
Minimum requirements: -Python 2.7.6 +, 3.4.3 +, 3.5.1+ ・ NumPy 1.9, 1.10, 1.11 ・ Six 1.9
Requirements for some features( Requirements for some functions): ・ CUDA support CUDA 6.5, 7.0, 7.5, 8.0 filelock g++ 4.8.4+ ・ CuDNN support cuDNN v2, v3, v4, v5, v5.1 ・ Caffe model support Protocol Buffers (pip install protobuf) protobuf>=3.0.0 is required for Py3 ・ Image dataset support Pillow ・ HDF5 serialization support h5py 2.5.0 ・ Testing utilities Mock Nose
(Git can download the source code, and at the bottom of the page you will find what you need to use the library and how to use it easily, so it will be helpful when you use it for the first time). I thought it was hard because it was something I had hardly heard of, but because "Python", "Numpy", and "Six", which are necessary to execute the minimum functions, are included in anaconda. , No need to install.
Also, "g ++", which is a requirement for some functions, is installed from the beginning on Mac. "Filelock", "Pillow", "h5py", and "Nose" are also included in anaconda, so there is no need to newly install them.
Numpy Numpy is an extension module for efficient numerical calculation in python.
"How to use NumPy-programming bulletin" http://programming.blogo.jp/python/numpy/introduction
When training artificial intelligence, I do matrix calculations, You can use Numpy to make calculations very smoothly.
Six Six is a package to absorb the difference between python 2 series and 3 series. For example, even if there are libraries with different names in the 2nd and 3rd series, you can use them with the same name by installing them via Six.
"Library Six for writing version-neutral code in Python" http://momijiame.tumblr.com/post/67465721521/python-%E3%81%A7%E3%83%90%E3%83%BC%E3 % 82% B8% E3% 83% A7% E3% 83% B3% E3% 83% 8B% E3% 83% A5% E3% 83% BC% E3% 83% 88% E3% 83% A9% E3% 83 % AB% E3% 81% AA% E3% 82% B3% E3% 83% BC% E3% 83% 89% E3% 82% 92% E6% 9B% B8% E3% 81% 8F% E3% 81% 9F % E3% 82% 81% E3% 81% AE% E3% 83% A9% E3% 82% A4% E3% 83% 96% E3% 83% A9% E3% 83% AA-six
CUDA CUDA (pronounced CUDA) is a comprehensive development environment for GPU computers provided by NVIDIA. GPU (abbreviation of graphical processing unit, specializing in image processing, good at processing simple and huge data, CPU is good at continuous calculation, but GPU is good at parallel calculation) and CUDA For more information, please refer to the following site.
"GPU computing starting from scratch" http://www.gdep.jp/page/view/248
filelock filelock is for exclusive control. Exclusive control means that when a conflict occurs with a shared resource that can be used by multiple processes when the program is executed, if one process uses the resource exclusively, another process uses it. Do not allow.
"Exclusive control is" lock "(lock): -IT terminology binary" http://www.sophia-it.com/content/%E6%8E%92%E4%BB%96%E5%88%B6%E5%BE%A1
g++ What is g ++?
A C ++ compiler included with GNU's GCC.
I didn't understand what it was. GNU is read as Gnu, and it seems to be an OS (short for operating system, software for running computers) and a wide collection of computer software.
GCC is a compiler developed and published by GNU Project (a general term for development projects of UNIX compatible software groups). ..
Is it that an organization trying to popularize free software is making an OS called GNU that is compatible with UNIX and compiling it (making human-written code readable by computers)?
「g++」 http://kaworu.jpn.org/cpp/g++
cuDNN cuDNN is a GPU-optimized library provided by a company called NVIDIA for DNN (Deep Neural Network) development.
Deep learning is simple, but it takes a lot of time with a CPU because it performs a huge amount of calculations, and in some cases it hardly progresses. I think it's okay if you think that deep learning can be done faster than the CPU.
"GTC 2015 --CUDA library" cuDNN "for deep learning" http://news.mynavi.jp/articles/2015/04/10/gtc2015_cudnn/
Protocol Buffers This article was very straightforward about Protocol Buffers.
"I searched for Protocol Buffers." http://qiita.com/aiueo4u/items/54dc5dd8c4772253634c
Pillow Pillow is a python image processing library that can process a large number of images at once. By the way, there is a similar one called PIL, but since this does not support pyhton3 series, Pillow is often used.
In order to learn artificial intelligence, it is necessary to load a large number of images, but the images to be loaded must be the same size, or the images are processed to increase the number of images. This library is convenient in such a case.
"How to use the Python 3.5 compatible image processing library Pillow (PIL)" https://librabuch.jp/blog/2013/05/python_pillow_pil/
h5py Is it a library for using the file format HDF5?
If this prevents Chainer from installing, take a look at this article.
"Unofficial tips for people who have trouble installing Chainer 1.5" http://qiita.com/unnonouno/items/c491b6df59352159cbf0
Mock I think it's good to think that it is used when testing software.
"Exploring Moq-Part 1-: What is Moq? What is Mock? And Mock Generation #adcjcs" http://blogs.wankuma.com/masaru/archive/2010/12/03/195469.aspx
Nose I think Nose is a test execution environment.
"I wrote a unit test with Python nose" http://blog.chocolapod.net/momokan/entry/8
The minimum requirements are already installed, so immediately Let's install Chainer.
Install Chainer
$ pip install chainer
pip is a python package management tool. pip is already in anaconda, so you don't need to install it again. By installing Chainer with pip, you can install Chainer in the environment of the python version you are currently using.
The installed Chainer is in User / your_name / .pyenv / versions / anaconda2-4.2.0 / lib / python2.7 / site-packages / chainer.
You have now installed Chainer. Next time, I will install CSLAIER, which allows machine learning to be performed with a GUI (graphical user interface).
Recommended Posts