Skip to content

7 Dashboard

tasuarez edited this page Jul 22, 2019 · 6 revisions

Dashboard

As it is mentioned on the main README file, we have implemented a dashboard in order to have deeper insight on the variables that trigger a near miss situation.

Technology

We developed a real-time dashboard, that enables a side-by-side view of a collision/near-miss event and the representation of the internal variables of the tracked objects that played a part on those events. We chose a Python library called dash(plotly) to develop the dashboard. Dash is a web framework for dashboards. It has real-time support and is easy to implement on python. To feed the dash webapp with the app’s data, we integrated a database. This decision was based on the scalability of the project. We added support for MongoDB, which is a noSQL database document oriented. MongoDB is fast and light enough for our application. We integrated MongoDB drivers for C++ and we have written a script to manage the packages on Ubuntu 16.04. On the Tracker.cpp file, we log the MongoDB events, tracker’s data and collision data on different collections. We wrote the necessary queries on a file "mongo.py" and the dashboard on "graph.py". Both files are on the /scripts folder of the project. In order to keep the project repository clean, we have not added the full python environment used to run the graph.py script, but a "requirements.txt" file is included.

Instalation

First, it is necessary to install mongodb and mongocxx libraries. Run the following command on the project’s top folder:

source ./scripts/mongocxx-install.sh

In order to manually run Mongodb:

sudo service mongod start

To check that mongod is running:

mongo

Then, move to the /scripts folder inside the project:

cd {$Path-to-OpenVINO-For-SmartCity-folder}/scripts/p-envs

Now install virtualenv package for python and create a new virtual environment:

pip3 install virtualenv
virtualenv -p python3 test-env
source test-env/bin/activate

You should see now a "(test-env)" symbol on the terminal. This means that the python scripts ran on that terminal are going to be ran in that virtual environment. Now just update packages and install the requirements.txt file.

pip install --upgrade pip
pip install -r requirements.txt

To run the dashboard app:

python graph.py

Now you can run the smart_city_tutorial program with the -show_graph flag. Please, check first if mongoDB is running. In oder to keep the dash board alive, just leave that terminal open. Now, open a new terminal, go to the /build folder inside the project and run:

./intel64/RelWithDebInfo/smart_city_tutorial -m_vp $vehicle232 -i ../data/villamercedes.mp4 -n_async 16 -tracking -collision -show_graph

To check the graph running, go to a web browser and visit:

localhost:8050