-
Notifications
You must be signed in to change notification settings - Fork 7
/
Setup.sh
113 lines (95 loc) · 3.5 KB
/
Setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
echo "!! This program will setup everything you need to use Facenet !!"
echo " "
echo "-- Installing requirements"
echo " "
sudo apt update
sudo apt -y install cmake
pip3 install --user opencv-python
pip3 install --user jsonpickle
pip3 install --user dlib
pip3 install --user imutils
pip3 install --user flask
echo "-- Installing NCSDK"
echo " "
mkdir -p ~/workspace
cd ~/workspace
git clone https://github.com/movidius/ncsdk.git
cd ~/workspace/ncsdk
make install
cd ~/
if [ ! -f "ALL-Detection-System-2019/Facial-Auth/Model/20170512-110547.zip" ]
then
echo "-- Facenet zip does not already exists in Model folder, downloading."
rm -f ./cookies.txt
touch ./cookies.txt
wget --load-cookies ./cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ./cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=0B5MzpY9kBtDVZ2RpVDYwWmxoSUk' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=0B5MzpY9kBtDVZ2RpVDYwWmxoSUk" -O ALL-Detection-System-2019/Facial-Auth/Model/20170512-110547.zip && rm -rf ./cookies.txt
echo "-- Facenet zip downloaded."
else
echo "-- Facenet zip already exists in Model folder"
fi
if [ ! -f "ALL-Detection-System-2019/Facial-Auth/Model/20170512-110547" ]
then
echo "-- Facenet zip not unzipped, unzipping."
cd ALL-Detection-System-2019/Facial-Auth/Model
unzip 20170512-110547.zip
cd ~/
else
echo "-- Facenet zip already unzipped."
fi
if [ ! -f "ALL-Detection-System-2019/Facial-Auth/Model/inception_resnet_v1.py" ]
then
echo "-- Inception Resnet does not already exists in Model folder, downloading."
cd ALL-Detection-System-2019/Facial-Auth/Model
wget -c --no-cache -P . https://raw.githubusercontent.com/davidsandberg/facenet/master/src/models/inception_resnet_v1.py -O inception_resnet_v1.py
sed -i 's/\r//' *.py
chmod +x *.py
cd ~/
else
echo "-- Inception Resnet already exists in Model folder."
fi
cd ALL-Detection-System-2019/Facial-Auth/Model/20170512-110547
if [ ! -e facenet_celeb.data-00000-of-00001 ]
then
mv model-20170512-110547.ckpt-250000.data-00000-of-00001 facenet_celeb.data-00000-of-00001
else
echo "-- data file exists"
fi
if [ ! -e facenet_celeb.index ]
then
mv model-20170512-110547.ckpt-250000.index facenet_celeb.index
else
echo "-- index file exists"
fi
if [ ! -e facenet_celeb.meta ]
then
mv model-20170512-110547.meta facenet_celeb.meta
else
echo "-- meta file exists"
fi
if [ ! -e facenet_celeb_ncs ]
then
echo "-- Converted directory does not exist, doing conversion"
python3 ../convert_facenet.py model_base=facenet_celeb
echo "-- Converted directory"
else
echo "-- Converted directory exists, skipping conversion. "
fi
cd ~/
if [ -e tass.graph ]
then
echo "-- Graph file exists, skipping compilation"
else
echo "-- Compiling graph file"
cd ALL-Detection-System-2019/Facial-Auth/Model/20170512-110547/facenet_celeb_ncs
mvNCCompile facenet_celeb_ncs.meta -w facenet_celeb_ncs -s 12 -in input -on output -o tass.graph
cp tass.graph ../..
cd ../../../
echo "-- Graph compiled"
fi
echo "-- Downloading shape_predictor_68_face_landmarks.dat"
cd ALL-Detection-System-2019/Facial-Auth/Model/dlib
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 -O shape_predictor_68_face_landmarks.dat.bz2
bzip2 -dk shape_predictor_68_face_landmarks.dat.bz2
echo "-- Downloaded and decompressed shape_predictor_68_face_landmarks.dat"
echo "-- Installation complete!"