2월, 2017의 게시물 표시

[Deep learning] Gradient Descent Optimizer

이미지
https://icim.nims.re.kr/post/easyMath/70 알기 쉬운 산업수학 알기 쉬운 산업수학 Gradient Descent Optimizer 2017년 12월 13일(수) | 김민중 URL  (1) 주어진 목적함수  f f 의 최솟값(minimum)을 찾아가는 알고리즘으로 다음과 같은 방식으로 최솟값을 찾아간다. 초기값  x 0 x 0 을 임의로 설정, 적당한 Learning rate  α α  설정 n ≥ 0 n ≥ 0 인 정수에 대해서  x n + 1 x n + 1 은 다음과 같이 정의한다. x n + 1 : = x n − α ⋅ ∇ f ( x n ) x n + 1 := x n − α ⋅ ∇ f ( x n ) 주의사항 함수 f f 의 모양이 convex가 아닌 경우 global minimum이 아닌 local minimum으로  x n x n 이 수렴할 가능성이 있다. Learning rate  α α  값이 큰 경우 최솟값으로  x n x n 이 수렴하는 것이 아니라 발산할 수 있다. Learning rate  α α  값이 작은 경우 수렴하는 속도가 지나치게 느릴 수 있다. 방정식  2 ⋅ x = 10 2 ⋅ x = 10  의 근을 Gradient Descent를 이용해서 찾아보자. 목적함수  f ( x ) : = ( 10 − 2 x ) 2 f ( x ) := ( 10 − 2 x ) 2 으로 설정하겠다( f f 의 최솟값인 0이 되게 하는  x x 값이 우리가 원하는 방정식의 근이다). 초기값  x 0 = 0 x 0 = 0 , Learning rate  α = 0.05 α = 0.05 으로 설정 f ′ ( x ) = 4 ( 2 x − 10 ) f ′ ( x ) = 4 ( 2 x − 10 ) 이므로  x 1 x 1 은 다음과 같이 구할 수 있다. x 1 = x 0 − α ⋅ f ′ ( x 0 ) = 0 − 0.05 ⋅ ( − 40 ) = 2 x

[Fix] “VT-x is not available. (VERR_VMX_NO_VMX)” in VirtualBox

Source from : http://druss.co/2015/06/fix-vt-x-is-not-available-verr_vmx_no_vmx-in-virtualbox/ This site suggests 3 methods. First of all , simply try below command. dism.exe /Online /Disable-Feature :Microsoft-Hyper-V

Setting up for ANPR development environment.

This blog post is for setup ANPR development environment. We will use keras and theano . ( The same except "mkvirtualenv deepLab_anpr ) And open a terminal and run the following commands. $ workon deepLab_anpr $ pip install  matplotlib $ pip install -U scikit-image $ pip install mahotas $ pip install Pillow $ pip install commentjson If you do run into the issue where your matplotlib plots are not displaying then take the following steps. 1. Install a few dependencies. $ sudo apt-get install tcl-dev tk-dev python-tk python3-tk 2. Uninstall matplotlib $ workon deepLab_anpr $ pip uninstall matplotlib 3. Install matplotlib from source $ git clone https://github.com/matplotlib/matplotlib.git $ cd matplotlib $ python setup.py install

Install chrome , Sublme Text3 and Pycharm on ubuntu 16.04

You will probably meet some problems when you are trying to install chrome ( maybe 3rd party sw ) with software center. I am not sure but it should be installed by terminal. ( Ubuntu don't support 3rd party software ) This is method how can you install several softeware by ternimal. 1. Chrome wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt-get install libxss1 libgconf2-4 libappindicator1 libindicator7 sudo dpkg -i google-chrome-stable_current_amd64.deb if error messages pop up after running the command  "sudo dpkg -i google-chrome-stable_current_amd64.deb" then run the command sudo apt-get install -f and then re-run the previous command. 2. Sublime Text3 sudo add-apt-repository ppa:webupd8team/sublime-text-3 sudo apt-get update sudo apt-get install sublime-text-installer 3. Pycharm sudo add-apt-repository ppa:mystic-mirage/pycharm sudo apt-get update * for 30-day free trial sudo apt-get install pych

Install deep learning library keras

The rest of this blog post will assume that you have already installed  CUDA Toolkit and cuDNN  , the appropriate  Python bindings and OpenCV  on your system. Install keras 1. Install some dependencies $ mkvirtualenv deepLab_keras $ pip install numpy $ pip install scipy $ pip install scikit-learn $ pip install imutils $ pip install h5py 2. Install Theano and keras Note: Keras always uses the latest version of Theano.            We should install it from repository $ pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git $ pip install keras 3. If you want to get sklearn-theano to utilize the GPU $ cd ~ $ nano ~/.theanorc Add following lines [global] floatX = float32 device = gpu0 [nvcc] fastmath = True 4. Change backend from Tensorflow to Theano $ nano ~/.keras/keras.json Modify two lines. "image_dim_ordering" : "tf"   -> "image_dim_ordering": "th" &qu

Install deep learning library nolearn

The rest of this blog post will assume that you have already installed  CUDA Toolkit and cuDNN  , the appropriate  Python bindings and OpenCV  on your system. Install nolearn 1. Install required packages in virtual environment $ mkvirtualenv deepLab_nolearn $ pip install numpy $ pip install matplotlib $ pip install scipy $ pip install scikit-learn 2. Install cudamat to use GPU $ git clone https://github.com/cudamat/cudamat.git $ cd cudamat $ python setup.py install 3. Install nolearn $ git clone https://github.com/dnouri/nolearn.git $ cd nolearn $ git checkout 0.5b1 ( This is not normal , if you need specific version then do like it ) $ python setup.py install 4. Test nolearn $ python >>> import nolearn >>> 5. If you want to use OpenCV $ cd ~/.virtualenvs/deepLab_nolearn/lib/python2.7/site-packages/ $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so $ ln -s /usr/local/lib/pytho

Install deep learning library sklearn-theano

The rest of this blog post will assume that you have already installed  CUDA Toolkit and cuDNN  , the appropriate  Python bindings and OpenCV  on your system. Install sklearn-theano 1. Installing prerequisites library $ cd ~ $ mkvirtuanenv deepLab_sktheano $ pip install numpy $ pip install scipy $ pip install scikit-learn $ pip install pillow $ pip install matplotlib $ pip install Theano $ pip install imutils $ pip install h5py $ pip install commentjson 2. Download sklearn-theano from GitHub and install it $ git clone https://github.com/sklearn-theano/sklearn-theano $ cd sklearn-theano $ python setup.py install $ cd ~ $ rm -rf sklearn-theano 3. Test your installation $ python >>> import sklearn_theano >>> 4. If you want to use OpenCV then you must create sum-link $ cd ~/.virtualenvs/deepLab_sktheano/lib/python2.7/site-packages/ $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so $ ln -s /usr

Install deep learning frameworks Caffe

The rest of this blog post will assume that you have already installed  CUDA Toolkit and cuDNN  , the appropriate Python bindings and OpenCV on your system. Install Caffe  1. Installing some dependencies $ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libboost-all-dev $ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev 2. Create virtual environment for Caffe test $ mkvirtualenv deepLab_caffe 3. Create sum-link for our opencv in virtual environment $ cd ~/.virtualenvs/deepLab_caffe/lib/python2.7/site-packages/ $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so $ ln -s /usr/local/lib/python2.7/site-packages/cv.py cv.py 4. Download Caffe repository and installing the required Python packages requirements.txt has the dependencies list in python folder. $ cd ~ $ workon deepLab_caffe $ git clone https://github.com/BVLC/caffe.git $ cd caffe/python $ for re

Install opencv with GPU option and python

The rest of this blog post will assume that you have already installed CUDA Toolkit and cuDNN . 1. Install OpenCV prerequisites Keep up  to date packages $ sudo apt-get update $ sudo apt-get upgrade Install the required developer tools and packages $ sudo apt-get install build-essential cmake pkg-config Install the image packages. Theses packages allow you to load various image file format such as JPEG, PNG, TIFF, etc $ sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev Install GTK development library to build Graphical User Interfaces and OpenCV's highgui which allow you to view images on your screen. $ sudo apt-get install libgtk2.0-dev Install the necessary video I/O packages to load video files using OpenCV $ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev Install additional libraries. $ sudo apt-get install libatlas-base-dev gfortran 2. Not must be installed but will be helpful library. Install 

Nvidia graphic driver install for deep learning ( CUDA Toolkit and cuDNN )

This is my experienced guide line to install Nvidia driver.  GPU: GM107M [Geforce GTX 950M]  OS : Ubuntu 16.04 System : Lenovo ideated 700 151sk Note : dual graphics card ( intel , nvidia ) There are three prerequisite conditions. A> Root privilege is needed. B> X-Server must be stopped. C> Neuveau driver must be removed. D> Secure boot to legacy[CSM] from Bios.

How do i know what computer video card i have.

이미지
In ubuntu environment. 1. You can use command "lspci | grep VGA" But this command is not work that if you have multiple graphic cards. 2. sudo lshw -C display  My laptop has two graphics cards.  So this command displays two graphics cards information. * if you are working on window this link is for you.

Create bootable ubuntu USB stick ( from windows )

이미지
This is for create bootable Ubuntu USB stick. Before you begin, 1. you need to download Ubuntu . 2. you need to download bootable USB creator.    There are several software. ( Rufus , LinuxLive USB Creator, Universal USB Installer ,,, )    We will use " Universal USB-Installer ". 3. After run it.    Step1. select "Ubuntu".    Step2. select ubuntu iso file.    Step3. select USB drive    Step4. not important.