Permalink
Browse files

Fix the installation issue (close #2).

  • Loading branch information...
1 parent d2468c3 commit 97c88b7fec7bda7e485e8b8519e6439818238953 Bofu Chen (bafu) committed May 13, 2017
View
@@ -17,8 +17,9 @@ One of the application of this intelligent gateway is to use the camera to monit
The current supported AI Engines leverage work from the following projects:
* [TensorFlow](https://www.tensorflow.org/)
-* [Darkflow](https://github.com/thtrieu/darkflow)
+* [TensorFlow on RPi3](https://github.com/samjabrahams/tensorflow-on-raspberry-pi) (Sam is looking for donation)
* [Darknet](https://pjreddie.com/darknet/)
+* [Darkflow](https://github.com/thtrieu/darkflow)
The current supported classification model is Inception v3 [[1]](https://arxiv.org/pdf/1512.00567.pdf) and the detection model is TinyYOLO [[2]](https://pjreddie.com/media/files/papers/YOLO9000.pdf)
@@ -33,7 +34,7 @@ $ ./configure
# Start and Stop BerryNet
-BerryNet is managed by [systemd](https://freedesktop.org/wiki/Software/systemd/). You can manage BerryNet via `berry-manager`:
+BerryNet is managed by [systemd](https://freedesktop.org/wiki/Software/systemd/). You can manage BerryNet via `berrynet-manager`:
```
$ berrynet-manager [start | stop | status | log]
View
@@ -19,6 +19,8 @@
# One-click IoT gateway deployment script.
+LOG="/tmp/berrynet.log"
+
install_system_dependencies() {
sudo apt-get update
sudo apt-get install -y python-dev python-opencv mongodb libkrb5-dev libzmq3-dev libyaml-dev imagemagick
@@ -70,7 +72,7 @@ download_classifier_model() {
unzip $INCEPTION_PKGNAME
mv imagenet_comp_graph_label_strings.txt output_labels.txt
mv tensorflow_inception_graph.pb output_graph.pb
- popd
+ popd > /dev/null
fi
popd > /dev/null
}
@@ -80,6 +82,7 @@ download_detector_model() {
mkdir bin
wget -O bin/tiny-yolo.weights http://pjreddie.com/media/files/tiny-yolo.weights
wget -O cfg/tiny-yolo.cfg https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/tiny-yolo.cfg
+ popd > /dev/null
}
install_nodejs() {
@@ -123,24 +126,25 @@ install_systemd_configs() {
}
install_gateway() {
- local working_dir="/usr/local/rpi3-ai-gateway"
+ local working_dir="/usr/local/berrynet"
sudo mkdir -p $working_dir
sudo cp -a broker.js camera.js cleaner.sh config.js dashboard inference journal.js localimg.js mail.js package.json $working_dir
+ sudo cp berrynet-manager /usr/loca/bin
@bradleyscott

bradleyscott May 13, 2017

Looks like a typo here where it should be local rather than loca

# install npm dependencies
pushd $working_dir > /dev/null
sudo npm install
popd > /dev/null
}
-install_system_dependencies
-install_optional_dependencies
-install_tensorflow
-download_classifier_model
-install_darkflow
-download_detector_model
-install_nodejs
-install_dashboard
-install_systemd_configs
-install_gateway
-
-echo "Installation is completed successfully!"
+install_system_dependencies 2>&1 | tee -a $LOG
+install_optional_dependencies 2>&1 | tee -a $LOG
+install_tensorflow 2>&1 | tee -a $LOG
+download_classifier_model 2>&1 | tee -a $LOG
+install_darkflow 2>&1 | tee -a $LOG
+download_detector_model 2>&1 | tee -a $LOG
+install_nodejs 2>&1 | tee -a $LOG
+install_dashboard 2>&1 | tee -a $LOG
+install_systemd_configs 2>&1 | tee -a $LOG
+install_gateway 2>&1 | tee -a $LOG
+
+echo "Installation is completed successfully!" | tee -a $LOG
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway/inference
+WorkingDirectory=/usr/local/berrynet/inference
PIDFile=/tmp/agent.pid
ExecStart=/usr/bin/node agent.js
Restart=always
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway
+WorkingDirectory=/usr/local/berrynet
PIDFile=/tmp/broker.pid
ExecStart=/usr/bin/node broker.js
Restart=always
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway
+WorkingDirectory=/usr/local/berrynet
PIDFile=/tmp/camera.pid
ExecStart=/usr/bin/node camera.js
Restart=always
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway
+WorkingDirectory=/usr/local/berrynet
PIDFile=/tmp/cleaner.pid
ExecStart=/bin/bash cleaner.sh
Restart=always
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway/dashboard
+WorkingDirectory=/usr/local/berrynet/dashboard
PIDFile=/tmp/server.pid
ExecStart=/usr/bin/node server.js
Restart=always
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway/inference/darkflow
+WorkingDirectory=/usr/local/berrynet/inference/darkflow
PIDFile=/tmp/detection_server.pid
ExecStart=/usr/bin/python detection_server.py
Restart=always
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway
+WorkingDirectory=/usr/local/berrynet
PIDFile=/tmp/journal.pid
ExecStart=/usr/bin/node journal.js
Restart=always
View
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-WorkingDirectory=/usr/local/rpi3-ai-gateway
+WorkingDirectory=/usr/local/berrynet
PIDFile=/tmp/localimg.pid
ExecStart=/usr/bin/node localimg.js
Restart=always
View
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+
+import subprocess
+
+from Tkinter import *
+
+class Application(Frame):
+ def publishSnapshotMessage(self):
+ cmd = 'mosquitto_pub -h localhost -t berrynet/event/camera -m snapshot_picam'
+ subprocess.call(cmd, shell=True)
+
+ def startGateway(self):
+ cmd = 'bash ~/codes/BerryNet/berrynet-manager start'
+ subprocess.call(cmd, shell=True)
+
+ def stopGateway(self):
+ cmd = 'bash ~/codes/BerryNet/berrynet-manager stop'
+ subprocess.call(cmd, shell=True)
+
+ def startChromium(self):
+ cmd = 'bash -c "sensible-browser http://localhost:8080/index.html#source=dashboard.json" &'
+ subprocess.call(cmd, shell=True)
+
+ def stopChromium(self):
+ cmd = 'bash -c "kill -9 $(pgrep chromium)"'
+ subprocess.call(cmd, shell=True)
+
+ def startDemo(self):
+ self.startGateway()
+ self.startChromium()
+
+ def stopDemo(self):
+ self.stopChromium()
+ self.stopGateway()
+
+ def cleanSnapshots(self):
+ cmd = 'bash -c "sudo rm /usr/local/berrynet/inference/image/snapshot*"'
+ subprocess.call(cmd, shell=True)
+
+ def createWidgets(self):
+ self.snapshotButton = Button(self, text='Snapshot', width=16, height=5)
+ self.snapshotButton["command"] = self.publishSnapshotMessage
+ self.snapshotButton.pack(fill=X)
+
+ self.startDemoButton = Button(self, text='Start Demo', width=16, height=5)
+ self.startDemoButton["command"] = self.startDemo
+ self.startDemoButton.pack(fill=X)
+
+ self.stopDemoButton = Button(self, text='Stop Demo', width=16, height=5)
+ self.stopDemoButton["command"] = self.stopDemo
+ self.stopDemoButton.pack(fill=X)
+
+ self.cleanButton = Button(self, text='Clean Snapshots', width=16, height=5)
+ self.cleanButton["command"] = self.cleanSnapshots
+ self.cleanButton.pack(fill=X)
+
+ def __init__(self, master=None):
+ Frame.__init__(self, master)
+ self.pack()
+ self.createWidgets()
+
+root = Tk()
+app = Application(master=root)
+app.master.title('Cheese')
+app.master.lift()
+app.master.attributes('-topmost', True)
+app.mainloop()
+root.destroy()
File renamed without changes.

0 comments on commit 97c88b7

Please sign in to comment.