This tutorial expands on the DeepDetect REST Tutorial. Here the Deep Detect application and REST APIs are used to connect a webcam from a host machine and use it to stream video to F1, allowing for classification of live images.
The full code of this project is in /home/centos/xfdnn_18_03_19/deepdetect/
For instructions on launching and connecting to instances, see here.
Start by launching two Terminals
Terminal 1
-
Connect to F1
-
Navigate to
/home/centos/xfdnn_18_03_19/deepdetect/
$ cd /home/centos/xfdnn_18_03_19/deepdetect/ $ ls createService.sh libs sdaccel_profile_summary.csv testService.sh dede models sdaccel_profile_summary.html xclbin demo run.sh start_deepdetect_docker.sh xfdnn_scheduler exec_deepdetect_docker.sh runtime templates
-
Execute
./start_deepdetect_docker.sh
to enter application docker -
Navigate to
/opt/deepdetect/
-
Execute
./runDeepDetectServer.sh
to start the DeepDetect Caffe REST Server$ ./start_deepdetect_docker.sh # ./runDeepDetectServer.sh DeepDetect [ commit ] INFO - 16:03:43 - Running DeepDetect HTTP server on 0.0.0.0:8080
When you see the message "INFO - 16:03:43 - Running DeepDetect HTTP server on 0.0.0.0:8080", this indicates that the script has started the webserver correctly.
When the FPGA is ready you will seeXBLAS online! (d=0)
Terminal 2:
-
Connect to F1
-
Navigate to
/home/centos/xfdnn_18_03_19/deepdetect/
$ cd /home/centos/xfdnn_18_03_19/deepdetect/ $ ls createService.sh libs sdaccel_profile_summary.csv testService.sh dede models sdaccel_profile_summary.html xclbin demo run.sh start_deepdetect_docker.sh xfdnn_scheduler exec_deepdetect_docker.sh runtime templates
-
Execute
./createService.sh
This initializes the DeepDetect server in Terminal 1.
Wait for the FPGA to load xclbin in Terminal 1.
On success you will see{"status":{"code":201,"msg":"Created"}}
-
Navigate to
/home/centos/xfdnn_18_03_19/deepdetect/demo/webcam
-
Edit
index.html
(using a text editor such as vi or nano). Find the section below:/******************************************* * TODO: Please update the address below * in 'url' to point to your public IP *******************************************/ var url = null;
Change yourpublicdns.compute-1.amazonaws.com to your instance's public IP address from EC2.
```
var url = ".compute-1.amazonaws.com:8888"; ```
This is for the client browser to upload webcam images to server.py
-
Navigate to
/home/centos/xfdnn_18_03_19/deepdetect/
-
Execute ./exec_deepdetect_docker.sh
-
Navigate to
/opt/deepdetect/demo/webcam/
-
Execute
python server.py
This starts the webcam demo webpage and server.$ cd demo/webcam/ $ ls css index.html jpeg_camera media README server.py streams test.html $ nano index.html $ cd ../.. $ ./exec_deepdetect_docker.sh # cd demo/webcam/ # python server.py serving at port 8888
Once you see serving at port 8888
the application is running and ready.
Host PC: