watch -d -n 0.1 nvidia-smi
Deep Learning
- NVIDIA GPU monitoring 2019.11.05
- Bagging & Boosting ์ฐจ์ด 2019.06.12
- arm64 opencv-contrib-python installation 2019.05.14
- ํํ์ ๋ถ์๊ธฐ Mecab ์ค์น 2019.05.09 1
NVIDIA GPU monitoring
Bagging & Boosting ์ฐจ์ด
๋น๊ต | Bagging | Boosting |
ํน์ง |
๋ณ๋ ฌ ์์๋ธ ๋ชจ๋ธ (๊ฐ ๋ชจ๋ธ์ ์๋ก ๋ ๋ฆฝ์ ) |
์ฐ์ ์์๋ธ (์ด์ ๋ชจ๋ธ์ ์ค๋ฅ๋ฅผ ๊ณ ๋ ค) |
๋ชฉ์ | Variance ๊ฐ์ | Bias ๊ฐ์ |
์ ํฉํ ์ํฉ |
๋ณต์กํ ๋ชจ๋ธ (High Variance, Low Bias) |
Low Variance, High Bias ๋ชจ๋ธ |
๋ํ ์๊ณ ๋ฆฌ์ฆ | Random Forest | Gradient Boosting, AdaBoost |
Sampling | Randomg Sampling | Random Sampling with weight on error |
์ฐธ๊ณ : https://www.slideshare.net/freepsw/boosting-bagging-vs-boosting
arm64 opencv-contrib-python installation
#!/bin/bash
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <Install Folder>"
exit
fi
folder="$1"
user="nvidia"
passwd="nvidia"
echo "** Install requirement"
sudo apt-get update
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl
sudo apt-get update
echo "** Download opencv-4.0.0"
cd $folder
curl -L https://github.com/opencv/opencv/archive/4.0.0.zip -o opencv-4.0.0.zip
curl -L https://github.com/opencv/opencv_contrib/archive/4.0.0.zip -o opencv_contrib-4.0.0.zip
unzip opencv-4.0.0.zip
unzip opencv_contrib-4.0.0.zip
cd opencv-4.0.0/
echo "** Building..."
mkdir release
cd release/
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.0.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j3
sudo make install
sudo apt-get install -y python-opencv python3-opencv
echo "** Install opencv-4.0.0 successfully"
echo "** Bye :)"โ
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
sudo reboot
sudo apt-get install build-essential git cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
cd ~
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
cd ~
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv_contrib
git checkout 3.1.0
sudo apt-get install python3-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install numpy
cd ~/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=${ARCH_BIN} \
-D CUDA_ARCH_PTX="" \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=ON \
-D WITH_LIBV4L=ON \
-D WITH_GSTREAMER=ON \
-D WITH_GSTREAMER_0_10=OFF \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/nvidia/Research/opencv_contrib/modules \
-D BUILD_opencv_legacy=OFF \
../
make -j4
sudo make install
sudo ldconfig
ํํ์ ๋ถ์๊ธฐ Mecab ์ค์น
์ต๊ทผ Kakao์์ Khaiii๋ฅผ ๋ฐํํด์ ์กฐ๊ธ ์ธ๊ธฐ๊ฐ ์ฝํด์ง๊ธด ํ์ง๋ง, ์ฌ์ ํ Khaiii์ ๋ง๋จน๋ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋ mecab์ค์น๋ฅผ ์งํํด ๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
1. ์ฐ์ mecab ํํ์ด์ง์์ ์ต์ ๋ฒ์ ์ ๋ค์ด๋ก๋ ํฉ๋๋ค.
ํ์ฌ๋ mecab-0.996-ko-0.9.2.tar.gz ์ด ํ์ผ์ด ์ต์ ์ด๋ค์.
https://bitbucket.org/eunjeon/mecab-ko/downloads/
2. ํ์ผ์ ๋ค์ด๋ฐ์์ ํน์ ๋๋ ํ ๋ฆฌ์ ์ ์ฅ ํ๊ณ ์์ถ์ ํ์ด ์ค๋๋ค.
tar -zxvf mecab-*-ko-*.tar.gz
3. ํด๋น ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํ์ฌ configure/make/make install ์ ์งํ ํฉ๋๋ค.
cd mecab-0.996-ko-0.9.2
./configure
make
make check
sudo make install
4. ์ค์น ๋ฒ์ ์ ํ์ธํ๋ฉด ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ ํฉ๋๋ค.
mecab --version
5. ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ก๋ฉํด์ฃผ๊ณ ๋ค์ ๋ฒ์ ์ ํ์ธํ๋ฉด ์ ์์ ์ผ๋ก ํ์ ๋ฉ๋๋ค.
sudo ldconfig
mecab --version
** ์ด ๋ฐฉ๋ฒ ์ธ์ ์๋ ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ๋ฉด ํ๋ฒ์ ์ค์น ํ ์๋ ์์ต๋๋ค.
pip install python-mecab-ko
6. ๋ค์์ ํ๊ตญ์ด ์ฌ์ ์ ์ค์นํด ๋ณด๊ฒ ์ต๋๋ค.
์ฐ์ ์ฌ์ ์ ์ต์ ๋ฒ์ ์ ๋ค์ด๋ฐ์ ๋ง์ฐฌ๊ฐ์ง๋ก ์์ถ์ ํ์ด ์ค๋๋ค.
ํ์ฌ์ ์ต์ ๋ฒ์ ์ mecab-ko-dic-2.1.1-20180720.tar.gz ์ด๊ตฐ์.
https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/
tar -zxvf mecab-ko-dic-2.1.1-20180720.tar.gz
7. ์์ถ์ ํผ ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํ์ฌ make๋ฅผ ์งํํฉ๋๋ค.
cd mecab-ko-dic-2.1.1-20180720
./configure
make
sudo make install
8. ํ ์คํธ๋ฅผ ํด๋ด ๋๋ค. Khaiii์ฒ๋ผ ์๋ ๋ช ๋ น์ด๋ฅผ ์คํํ ํ ๋ถ์ํ๊ณ ์ ํ๋ ๋ฌธ์ฅ์ ์ ๋ ฅํ๋ฉด ๋ฉ๋๋ค.
mecab -d /usr/local/lib/mecab/dic/mecab-ko-dic
์ค์น๊ฐ ์ ๋์์ต๋๋ค.
9. Python์์ ์ ๋๋์ง ํ ์คํธ ํด ๋ด ๋๋ค.
import mecab
mecab = mecab.MeCab()
mecab.morphs('์๋ฑํฌ๊ตฌ์ฒญ์ญ์ ์๋ ๋ง์ง ์ข ์๋ ค์ฃผ์ธ์.')
# ['์๋ฑํฌ๊ตฌ์ฒญ์ญ', '์', '์', '๋', '๋ง์ง', '์ข', '์๋ ค', '์ฃผ', '์ธ์', '.']
์ด์์ผ๋ก ๋ง์น๊ฒ ์ต๋๋ค.