Difference between revisions of "Feeding Tensorflow from GPU"

From ElphelWiki
Jump to: navigation, search
(Setup)
(Setup)
Line 15: Line 15:
 
  cd ~/git/tf_cv_cu
 
  cd ~/git/tf_cv_cu
 
   
 
   
  git clone https://github.com/fierval/tensorflow-object-detection-cpp.git
+
  # Download section
git clone https://github.com/fierval/fast_od.git
+
<nowiki>git clone https://github.com/fierval/tensorflow-object-detection-cpp.git
 +
git clone https://github.com/fierval/fast_od.git
 +
wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
 +
wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel_0.25.2-linux-x86_64.deb
 +
wget https://github.com/tensorflow/tensorflow/archive/v1.15.0.tar.gz -O tensorflow-1.15.0.tar.gz
 +
wget https://github.com/opencv/opencv/archive/3.4.9.tar.gz -O opencv-3.4.9.tar.gz
 +
wget https://github.com/opencv/opencv_contrib/archive/3.4.9.tar.gz -O opencv_contrib-3.4.9.tar.gz</nowiki>
 
   
 
   
  wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
+
  # Unpacking
 
  tar xzvf cmake-3.16.2.tar.gz
 
  tar xzvf cmake-3.16.2.tar.gz
 +
tar xzvf tensorflow-1.15.0.tar.gz
 +
tar xzvf opencv-3.4.9.tar.gz
 +
tar xzvf opencv_contrib-3.4.9.tar.gz
 +
 +
# build & update cmake
 
  sudo apt install libssl-dev
 
  sudo apt install libssl-dev
 
  sudo apt install qt4-default
 
  sudo apt install qt4-default
Line 26: Line 37:
 
  make -j8
 
  make -j8
 
  sudo make install
 
  sudo make install
 +
cd ..
 
   
 
   
 
  cmake -version
 
  cmake -version
 
  cmake-gui -version
 
  cmake-gui -version
 
   
 
   
  wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel_0.25.2-linux-x86_64.deb
+
  # install bazel
 
  sudo dpkg -i bazel_0.25.2-linux-x86_64.deb
 
  sudo dpkg -i bazel_0.25.2-linux-x86_64.deb
 
  bazel version
 
  bazel version
  wget https://github.com/tensorflow/tensorflow/archive/v1.15.0.tar.gz -O tensorflow-1.15.0.tar.gz
+
   
  tar xzvf tensorflow-1.15.0.tar.gz
+
  # build TF
 
  cd ~/git/tensorflow-1.15.0/
 
  cd ~/git/tensorflow-1.15.0/
 
  tensorflow/contrib/makefile/download_dependencies.sh
 
  tensorflow/contrib/makefile/download_dependencies.sh
Line 40: Line 52:
 
  # pick all defaults except select '''yes''' for CUDA support
 
  # pick all defaults except select '''yes''' for CUDA support
 
  bazel build //tensorflow:libtensorflow_cc.so
 
  bazel build //tensorflow:libtensorflow_cc.so
 
wget https://github.com/opencv/opencv/archive/3.4.9.tar.gz -O opencv-3.4.9.tar.gz
 
tar xzvf opencv-3.4.9.tar.gz
 
wget https://github.com/opencv/opencv_contrib/archive/3.4.9.tar.gz -O opencv_contrib-3.4.9.tar.gz
 
tar xzvf opencv_contrib-3.4.9.tar.gz
 

Revision as of 17:17, 14 January 2020

About

Reference guides:

Target projects:

  • tensorflow-object-detection-cpp - contains a sample model, labels and a test video
  • fast_od - contains feeding Tensorflow from GPU

Setup

Kubuntu 18.04:

mkdir -p ~/git/tf_cv_cu
cd ~/git/tf_cv_cu

# Download section
git clone https://github.com/fierval/tensorflow-object-detection-cpp.git
git clone https://github.com/fierval/fast_od.git
wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel_0.25.2-linux-x86_64.deb
wget https://github.com/tensorflow/tensorflow/archive/v1.15.0.tar.gz -O tensorflow-1.15.0.tar.gz
wget https://github.com/opencv/opencv/archive/3.4.9.tar.gz -O opencv-3.4.9.tar.gz
wget https://github.com/opencv/opencv_contrib/archive/3.4.9.tar.gz -O opencv_contrib-3.4.9.tar.gz

# Unpacking
tar xzvf cmake-3.16.2.tar.gz
tar xzvf tensorflow-1.15.0.tar.gz
tar xzvf opencv-3.4.9.tar.gz
tar xzvf opencv_contrib-3.4.9.tar.gz

# build & update cmake
sudo apt install libssl-dev
sudo apt install qt4-default
cd cmake-3.16.2
./bootstrap -qt-gui
make -j8
sudo make install
cd ..

cmake -version
cmake-gui -version

# install bazel
sudo dpkg -i bazel_0.25.2-linux-x86_64.deb
bazel version

# build TF
cd ~/git/tensorflow-1.15.0/
tensorflow/contrib/makefile/download_dependencies.sh
./configure
# pick all defaults except select yes for CUDA support
bazel build //tensorflow:libtensorflow_cc.so