Build OpenCV3.4 (Ubuntu 16.04LTS)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libjpeg-dev libpng-dev libtiff-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 libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python3-dev

wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.0.zip

unzip opencv.zip
unzip opencv_contrib.zip

sudo apt-get install python3-pip
pip3 install numpy

cd ~/opencv-3.4.0/
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D python_version=3 \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.0/modules \
-D BUILD_EXAMPLES=ON ..

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D ENABLE_CXX11 = 1 \
-D python_version=3 \
-D CUDA_HOST_COMPILER=/usr/bin/g++-5 \
-D CUDA_PROPAGATE_HOST_FLAGS=off \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.0/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
-D BUILD_EXAMPLES=ON ..

Windows

CMake_gui.exe

opencv_wordをチェックする。

MAKE

※CPU core num is 4, if core num is 8 -j8

make -j4

sudo make install
sudo ldconfig
pkg-config –modversion opencv

install CUDA

https://developer.nvidia.com/cuda-downloads

sudo sh cuda_10.0.130_410.48_linux.run

Training

https://github.com/spmallick/learnopencv/tree/master/YOLOv3-Training-Snowman-Detector

darknet

pip3 install matplotlib

download pre-trained file

cd ~/darknetwget https://pjreddie.com/media/files/darknet53.conv.74-O ~/darknet/darknet53.conv.74

./darknet detector train ~/card/data/darknet.data ~/card/data/darknet-yolov3.cfg ./darknet53.conv.74 > ~/card/train.log

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です