Skip to content

Commit bc5cedd

Browse files
committed
Added deep learning module
1 parent 1ebf326 commit bc5cedd

File tree

1 file changed

+81
-19
lines changed

1 file changed

+81
-19
lines changed

modules/9-deeplearning/9-deeplearning.sh

Lines changed: 81 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@
2828
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030
# Install Deep learning frameworks
31+
# https://www.elinux.org/Jetson_TX2
3132

3233
# Tensorflow for jetson
3334
# https://github.com/peterlee0127/tensorflow-nvJetson
3435
# https://www.jetsonhacks.com/2017/03/24/caffe-deep-learning-framework-nvidia-jetson-tx2/
35-
# caffe2
36-
# https://github.com/caffe2/caffe2
36+
# Torch7
37+
# http://torch.ch/
38+
# https://github.com/dusty-nv/jetson-reinforcement/blob/master/CMakePreBuild.sh
3739
# Pytorch
40+
# https://pytorch.org/
3841
# https://gist.github.com/dusty-nv/ef2b372301c00c0a9d3203e42fd83426#file-pytorch_jetson_install-sh
42+
# Jetson-Inference
43+
# https://github.com/dusty-nv/jetson-inference
3944

4045
# Default variables load
4146
MODULE_NAME="Install deep learning frameworks"
@@ -45,6 +50,72 @@ MODULE_OPTIONS=("RUN" "STOP")
4550

4651
MODULE_SUBMENU=("Install deep learning module:dp_learning_list" "Set install folder:dp_set_install_folder")
4752

53+
dp_is_enabled()
54+
{
55+
if [[ $DP_PATCH_LIST = *"$1"* ]] ; then
56+
echo "ON"
57+
else
58+
echo "OFF"
59+
fi
60+
}
61+
62+
script_run()
63+
{
64+
65+
if [ $(dp_is_enabled "tensorflow") == "ON" ] ; then
66+
tput setaf 6
67+
echo "Install tensorflow"
68+
tput sgr0
69+
dp_install_tensorflow
70+
fi
71+
72+
if [ $(dp_is_enabled "pyTorch") == "ON" ] ; then
73+
tput setaf 6
74+
echo "Install pyTorch"
75+
tput sgr0
76+
dp_install_pytorch
77+
fi
78+
79+
if [ $(dp_is_enabled "jetson-inference") == "ON" ] ; then
80+
tput setaf 6
81+
echo "Install jetson-inference"
82+
tput sgr0
83+
dp_install_jetson_inference
84+
fi
85+
}
86+
87+
dp_install_jetson_inference()
88+
{
89+
# Local folder
90+
local LOCAL_FOLDER=$(pwd)
91+
92+
tput setaf 6
93+
echo "Install git and cmake"
94+
tput sgr0
95+
sudo apt-get install git cmake
96+
97+
tput setaf 6
98+
echo "Clone jetson-inference repository from @dusty-nv"
99+
tput sgr0
100+
git clone https://github.com/dusty-nv/jetson-inference
101+
102+
tput setaf 6
103+
echo "Configuring CMAKE"
104+
tput sgr0
105+
cd jetson-inference
106+
mkdir build
107+
cd build
108+
cmake ../
109+
110+
tput setaf 6
111+
echo "Make jetson-inference"
112+
tput sgr0
113+
make
114+
115+
# Restore previuous folder
116+
cd $LOCAL_FOLDER
117+
}
118+
48119
dp_install_pytorch()
49120
{
50121
# Local folder
@@ -100,7 +171,7 @@ dp_install_tensorflow()
100171
tput setaf 6
101172
echo "Download and install pip"
102173
tput sgr0
103-
wget https://bootstrap.pypa.io/get-pip.py -o get-pip.py
174+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
104175
sudo python get-pip.py
105176

106177
tput setaf 6
@@ -109,7 +180,7 @@ dp_install_tensorflow()
109180
echo "Thanks @peterlee0127"
110181
tput sgr0
111182
# Download last version of tensor flow
112-
wget https://github.com/peterlee0127/tensorflow-nvJetson/releases/download/binary/$DP_TENSORFLOW
183+
wget --output-document $DP_TENSORFLOW https://github.com/peterlee0127/tensorflow-nvJetson/releases/download/binary/$DP_TENSORFLOW
113184

114185
tput setaf 6
115186
echo "Install Tensorflow $DP_TENSORFLOW"
@@ -165,38 +236,29 @@ script_info()
165236
echo " - Installation folder: $DP_FOLDER"
166237
}
167238

168-
dp_is_enabled()
169-
{
170-
if [[ $PKGS_PATCH_LIST = *"$1"* ]] ; then
171-
echo "ON"
172-
else
173-
echo "OFF"
174-
fi
175-
}
176-
177239
dp_learning_list()
178240
{
179241
if [ -z ${DP_PATCH_LIST+x} ] ; then
180242
# Empty kernel patch list
181243
DP_PATCH_LIST="\"\""
182244
fi
183245

246+
#"caffe" "A fast open framework" $(dp_is_enabled "caffe") \
247+
#"caffe2" "Lightweight, modular, and scalable" $(dp_is_enabled "caffe2") \
248+
#"torch7" "Scientific computing framework" $(dp_is_enabled "torch7") \
249+
184250
local PKGS_PATCH_LIST_TMP
185251
DP_PATCH_LIST_TMP=$(whiptail --title "$MODULE_NAME" --checklist \
186-
"Which new packages do you want add?" 15 75 6 \
187-
"caffe" "A fast open framework" $(dp_is_enabled "caffe") \
188-
"caffe2" "Lightweight, modular, and scalable" $(dp_is_enabled "caffe2") \
252+
"Which new packages do you want add?" 15 75 3 \
189253
"tensorflow" "Open source machine learning framework" $(dp_is_enabled "tensorflow") \
190-
"torch7" "Scientific computing framework" $(dp_is_enabled "torch7") \
191254
"pyTorch" "Tensors & Dynamic neural networks in Python" $(dp_is_enabled "pyTorch") \
192255
"jetson-inference" "Inference net & deep vision with TensorRT" $(dp_is_enabled "jetson-inference") 3>&1 1>&2 2>&3)
193256

194-
exitstatus=$?
257+
local exitstatus=$?
195258
if [ $exitstatus = 0 ]; then
196259
# Save list of new element to patch
197260
DP_PATCH_LIST="$DP_PATCH_LIST_TMP"
198261
fi
199-
200262
}
201263

202264
dp_set_install_folder()

0 commit comments

Comments
 (0)