Deploying a People Counter Application at the Edge Using Intel OpenVINO Toolkit

Original article was published by Prateek Sawhney on Artificial Intelligence on Medium


Running the Main Application

After converting the downloaded model to the OpenVINO IR format, all the three servers can be started on separate terminals i.e.

  • MQTT Mosca server
  • Node.js* Web server
  • FFmpeg server

Setting up the environment

Configuring the environment to use the Intel® Distribution of OpenVINO™ toolkit one time per terminal session by running the following command:

source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5

Further, from the main directory:

Step 1 — Starting the Mosca server

cd webservice/server/node-server
node ./server.js

The following message is displayed, if successful:

Mosca server started.

Step 2 — Starting the GUI

Opening a new terminal and executing below commands:

cd webservice/ui
npm run dev

The following message is displayed, if successful:

webpack: Compiled successfully

Step 3 — FFmpeg Server

Opening a new terminal and executing below command:

sudo ffserver -f ./ffmpeg/server.conf

Step 4 — Running the code

Opening a new terminal and executing below command:

python main.py -i resources/Pedestrian_Detect_2_1_1.mp4 -m faster_rcnn_inception_v2_coco_2018_01_28/frozen_inference_graph.xml -l /opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension_sse4.so -d CPU -pt 0.4 | ffmpeg -v warning -f rawvideo -pixel_format bgr24 -video_size 768x432 -framerate 24 -i - http://0.0.0.0:3004/fac.ffm

Implementation on Local Machine

The project is implemented on Udacity’s workspace. If the same project is to be implemented on the local machine, some changes have to be made in “constants.js” file located at the given path from the root directory of the project:

webservice/ui/src/constants/constants.js

In the “constants.js” file, “CAMERA_FEED_SERVER” and “MQTT_SERVER” are configured according to the Udacity’s workspace configuration. The value of these two properties should be changed to the following for proper implementation:

CAMERA_FEED_SERVER: "http://localhost:3004"
...
MQTT_SERVER: "ws://localhost:3002"