TX2入门教程软件篇-安装Caffe(jetpack3.0)
TX2入门教程软件篇-安装Caffe
说明:
- 介绍如何在TX2上安装深度学习框架caffe
步骤:
- 建立dl目录,下载安装脚本:
mkdir dl
cd dl
git clone https://github.com/ncnynl/installCaffeJTX2.git
cd installCaffeJTX2
- 设置CPU and GPU clocks为最大,这个文件位于用户根目录:
$ sudo ~/jetson_clocks.sh
安装Caffe
- 安装Caffe脚本
$ ./installCaffe.sh
- installCaffe.sh脚本内容为:
#!/bin/sh
# Script for installing Caffe with cuDNN support on Jetson TX2 Development Kits
# 3-19-17 JetsonHacks.com
# MIT License
# Install and compile Caffe on NVIDIA Jetson TX2 Development Kit
# Prerequisites (which can be installed with JetPack 3):
# L4T 27.1 (Ubuntu 16.04)
# OpenCV4Tegra
# CUDA 8.0
# cuDNN v5.1
# Tested last with Github Caffe commit: 317d162acbe420c4b2d1faa77b5c18a3841c444c
sudo add-apt-repository universe
sudo apt-get update -y
/bin/echo -e "\e[1;32mLoading Caffe Dependencies.\e[0m"
sudo apt-get install cmake -y
# General Dependencies
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev \
libhdf5-serial-dev protobuf-compiler -y
sudo apt-get install --no-install-recommends libboost-all-dev -y
# BLAS
sudo apt-get install libatlas-base-dev -y
# Remaining Dependencies
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev -y
sudo apt-get install python-dev python-numpy -y
sudo usermod -a -G video $USER
/bin/echo -e "\e[1;32mCloning Caffe into the home directory\e[0m"
# Place caffe in the home directory
cd $HOME
# Git clone Caffe
git clone https://github.com/BVLC/caffe.git
cd caffe
cp Makefile.config.example Makefile.config
# If cuDNN is found cmake uses it in the makefile
# Regen the makefile; On 16.04, aarch64 has issues with a static cuda runtime
cmake -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
# Include the hdf5 directory for the includes; 16.04 previously had issues for some reason
# The TX2 seems to handle this correctly now
# echo "INCLUDE_DIRS += /usr/include/hdf5/serial/" >> Makefile.config
/bin/echo -e "\e[1;32mCompiling Caffe\e[0m"
make -j6 all
# Run the tests to make sure everything works
/bin/echo -e "\e[1;32mRunning Caffe Tests\e[0m"
make -j6 runtest
# The following is a quick timing test ...
# tools/caffe time --model=models/bvlc_alexnet/deploy.prototxt --gpu=0
测试:
Jetson TK1 vs. Jetson TX1 vs. Jetson TX2 Caffe GPU Example Comparison 10 iterations, times in milliseconds |
|||
---|---|---|---|
Machine | Average FWD | Average BACK | Average FWD-BACK |
Jetson TK1 (32-bit OS) | 234 | 243 | 478 |
Jetson TX1 (64-bit OS) | 80 | 119 | 200 |
Jetson TX2 (Mode Max-Q) | 78 | 97 | 175 |
Jetson TX2 (Mode Max-P) | 65 | 85 | 149 |
Jetson TX2 (Mode Max-N) | 56 | 75 | 132 |
参考:
- https://github.com/ncnynl/installROSTX2
- http://www.jetsonhacks.com/2017/03/24/caffe-deep-learning-framework-nvidia-jetson-tx2/
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号