2017年8月21日月曜日

PyTorch

Speaking of Deep Learning's library Tensorflow is famous. Since it was released a year and a half ago, I got a name recognition for a moment.
I began looking for other libraries, thinking that it would be better to use a more flexible library than Keras. Then what is Torch's Python version out there!
DeepMind has moved from Torch to Tensorflow, but I anticipate that you are already using PyTorch. Facebook is also one of the representative companies using Torch, and I am involved in the development of PyTorch.

2017年8月16日水曜日

Imaging mnist data


——mnist_data_image.py------
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import numpy as np
5 np.random.seed(20160715)
6
7 from keras.datasets import mnist
8 from keras.utils import np_utils
9
10 (X_train, y_train), (X_test, y_test) = mnist.load_data()
11
12 for xs in X_train[1]:
13 for x in xs:
14 sys.stdout.write('%03d ' % x)
15 sys.stdout.write('\n')
16
17 print('first sample is %d' % y_train[0])
18
19 Y_train = np_utils.to_categorical(y_train, 10)
20
21 sys.stdout.write('[')
22 for y in Y_train[0]:
23 sys.stdout.write('%f ' % y)
24 sys.stdout.write(']\n')

2017年8月9日水曜日

PWA (progressive web application) supported on iOS

As I wrote in an article I posted in the past, PWA (Progressive Web Application) that I could only use in Chrome until now can be used in Safari.

The advantages of PWA are described below.

1. It is possible to provide user experience that is the same as or close to the application on mobile sites

2. Page loading is fast

3. Push notification is possible

4. By using the service worker mechanism, pages can be used even offline. FINANCIAL TIMES is an example.

OpenCV 3.1.0 install

$ sudo apt-get install build-essential cmake git
$ sudo apt-get install ffmpeg libopencv-dev libgtk-3-dev python-numpy python3-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev qtbase5-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip

$ wget https://github.com/Itseez/opencv/archive/3.1.0.zip
$ cd opencv-3.1.0
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
$ make
$ sudo make install
$ sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
$ sudo ldconfig

$ sudo pip3 install opencv-python

2017年8月7日月曜日

Machine learning self-made machine starting with low budget

◼️Hardware
GPU: 1050Ti ( CUDA core:678 , Memory : 4GB, Compute Capability : 6.1 )
PCI Express 3.0

◼️Software
(1) Ubuntu 16.04 install
(2) GPU Check
$ lspci | grep NVIDIA
(3) CUDA install
https://developer.nvidia.com/cuda-downloads
$ nvidia-smi
(4) cuDNN Install
https://developer.nvidia.com/rdp/cudnn-download
cuDNN v5.1 Runtime Lirary for Ubuntu 14.04(Deb)
(5) TensorFlow Install
$ pip install tensorflow-gpu
$ pip install keras
$ pip install h5py

2017年8月5日土曜日

Best Practices for ML Engineering


◼️Rules of Machine Learning: Best Practices for ML Enginnering
http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf


The first rule states "Do not be afraid to launch a product without machine learning". It is suggested that it is better to write the rules yourself, especially when there are few data available for machine learning.
Being able to understand and use machine learning is a necessary condition as a machine learning engineer, but be careful that it is not sufficient condition. The truly important thing is that you can select the optimal method including the heuristic rule base as well.

Character-level CNN

Morphological analysis is used to decompose sentences in Japanese into words. Tools for morphological analysis, such as MeCab, can be used to break sentences into words. However, this morpheme analysis has weaknesses. That means that it can not be used for unknown words.

So there is Character - level CNN. (https://arxiv.org/abs/1509.01626)
Character-level CNN is a method that began to be seen around 2015. One of the features is that no morphological analysis is necessary. Enter the sentences in CNN in character units, put them in the feature map, and pour them into the entire tie layer to learn the classification.

CNN and RNN in natural language processing

In deep learning, RNN (Recurrent Neural Network) is often used for natural language processing. RNN is good at handling sequential inputs. However, in general, RNN learns slower than CNN. Therefore, papers using CNN for natural language processing came out frequently from around last year. For example, recently, the topic that Facebook implements machine translation with CNN came out on 2017/5.

https://code.facebook.com/posts/1978007565818999/a-novel-approach-to-neural-machine-translation/

Cloud service for Deep Learning

Amazon EC2 P2 Instance
 ・Choose a Virginia northern region
 ・AMI(Amazon Machine Image)
Deep Learning AMI Ubuntu Version

Google Cloud Platform

fd-find

 $ sudo apt install fd-find $ fdfind 石