-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·47 lines (35 loc) · 1.08 KB
/
run.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
#!/bin/bash
# check if package is installed
# install package if not installed
installPackage() {
retval=0
echo "Installing package $1"
if [ $(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "Package $1 is not installed"
if echo "yes" | sudo apt-get install $1; then
retval=1
fi
else
echo "Package $1 is already installed"
retval=1
fi
return "$retval"
}
Xvfb :1 & export DISPLAY=:1;
if test "$3" != "pi";
then
#Install AWS CLI if required
installPackage awscli;
#Copy Input file to EC2
aws s3 cp s3://image-rec-512/input/$1 /home/ubuntu/darknet;
# Run YOLO
cd /home/ubuntu/darknet;
./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights $1 > output.txt;
else
export PATH=~/.local/bin:$PATH
cd /home/pi/darknet;
./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights "/home/pi/iraas/data/"$1 > output.txt;
fi
# Copy output file to S3
aws s3 cp output.txt s3://image-rec-512/output/$2;