Google Code Block

2016年12月1日

Environment Setup for Torch and fast-neural-style on Ubuntu

1. Install CUDA 8.0 and CUDNN 5.1

Please refer to Setup CUDA / CUDNN and Chainer for deep learning on Ubuntu 16.04


2. Install Torch from Torch#GetStarted

# in a terminal, run the commands WITHOUT sudo
git clone https://github.com/torch/distro.git ~/torch --recursive cd ~/torch; bash install-deps; ./install.sh # On Linux with bash
source ~/.bashrc

3. Install lua dependencies from torch/rocks on GitHub

git clone https://github.com/torch/rocks

luarocks install totem-0-0.rockspec  && 
luarocks install util-0-0.rockspec  && 
luarocks install fn-0-0.rockspec  && 
luarocks install pprint-0-0.rockspec  && 
luarocks install logroll-0-0.rockspec  && 
luarocks install hdf5-20-0.rockspec  &&

4. Run a Torch project : fast-neural-style

git clone https://github.com/jcjohnson/fast-neural-style

 - Generate a styled image
th fast_neural_style.lua -model models/eccv16/starry_night.t7 -input_image images/content/chicago.jpg -output_image out.png

Setup CUDA / CUDNN and Chainer for deep learning on Ubuntu 16.04



。Install CUDA / CUDNN and Chainer with GPU enabled

1 . Install CUDA 8.0 ( Ubuntu 14.04 )
    1. download http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_8.0.44-1_amd64.deb
    2. sudo dpkg -i cuda-repo-ubuntu1404_8.0.44-1_amd64.deb
    3. sudo apt-get update
    4. sudo apt-get install cuda
2 . Install CUDNN 5.1 for CUDA 8.0
    1. Download https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod/8.0/cudnn-8.0-linux-x64-v5.1-tgz
    2. Extract tgz file
    3. sudo cp lib64/* /usr/local/cuda/lib64/
    4. sudo cp include/* /usr/local/cuda/include/
3. Set environment to build Chainer
    1. export CFLAGS=-I/usr/local/cuda/include
    2. export LDFLAGS=-L/usr/local/cuda/lib64
    3. export LD_LIBRARY_PATH=/usr/local/cuda/lib64
4. pip install chainer --no-cache-dir -vvvv


5. Don't forget to setup the nvcc path
nano ~/.bashrc ( or nano ~/.zshrc if you use zsh :p )
add the following line to the end of the rc file
export PATH=/usr/local/cuda/bin:$PATH


。If you need image processing library on Python ...
pip install Pillow


。Install ffmpeg
tar xvf ffmpeg-release-64bit-static.tar

sudo cp ffmpeg-3.2-64bit-static/* /usr/local/bin/ 

2016年10月14日

Raspberry Pi 常用指令

Default Account password : pi / raspberry


。Machine Info Raspberry Pi B+ 
Architecture:          armv6l
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
Model name:            ARMv6-compatible processor rev 7 (v6l)
CPU max MHz:           1000.0000
CPU min MHz:           700.0000

。Updating
sudo apt-get clean

sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove

。Firmware Updating
sudo apt-get install rpi-update
sudo rpi-update

。Screen
sudo apt-get install screen
screen
screen -list
Reconnect : screen -r

。Show disk info / space
lsblk
df -h
show disk size: du -hs dic/*

。Python 
sudo apt-get install python-pip

。Crontab
 - 編輯 : crontab -e
 - 顯示執行 log : grep CRON /var/log/syslog
 - check status : sudo service cron status
 - restart : sudo service cron restart

。Git
 - Add and push files

git add .
git commit -a -m "commit" (do not need commit message either)
git push
 - Remember Git login info:
git config --global credential.helper 'cache --timeout 360000'