/rt21

Project at big data analysis for real-world applications at FERI, 2nd and 3rd year, CS.

Primary LanguageCApache License 2.0Apache-2.0

Logo

Table of Contents

About

Project at big data analysis for real-world applications at FERI, 2nd and 3rd year, CS. The project theme was traffic. The android application takes the camera feed and sends that image to API for road signs recognition. The android app also uses GPS to track location, monitors mean and max speed, and detects vibration to determine road quality. API stores all essential info in the database. The website displays stored data and other statistical info to the user.


The project consists of 5 main components: database, API, website, android application and AR app as shown in the following image and table:
Project components

Project section Technologies used
Server Docker, bash
Database MongoDB
API Flask
Android app Java
Computer vision OpenCV, TensorFlow, Keras
Website HTML5, Bootstrap, React
Documents LaTeX
STM32 Discovery C, Python
Algorithm Python
Parallel Python
AR app Unity, Blender

Server

Docker Shell Script Nginx Linux Heroku GNU Bash Markdown Git Manjaro

For website and API hosting, we choose Heroku. Both applications are running inside docker containers, and by doing that, we achieve effortless transfer to another hosting provider in case of necessity. By using Heroku, all apps automatically get support for HTTPS protocol. For the web server, we choose Nginx.

Contributor:

David Slatinek Github avatar
David Slatinek

Database

MongoDB diagrams.net MongoDB Atlas

For the database, we choose the NoSQL database type, specifically MongoDB. The database is being hosted by MongoDB Atlas. In the database, we store information about the user, his drives, the locations of these drives, and information about traffic signs.

Collections can be seen from the following image:

Collections

Contributor:

David Slatinek Github avatar
David Slatinek

API

Python Flask Postman JSON

The API serves as an intermediate link between the clients and the database. It limits unauthorized access to the database and makes the development of front-end applications simpler, as the developers working on it are not involved in retrieving data from the database, but instead retrieve it in a specific format and then use it in further development.

The API was made with python framework flask, follows the REST architectural style, and returns data in JSON format. On the security aspect, the system contains the following security mechanisms:

  1. API key.
  2. HTTPS protocol.

One of the methods:

@app.route('/api/user/<user_id>', methods=['GET'])
def app_get_user(user_id):
    if request.headers.get('X-API-Key') != app.config['API_KEY']:
        return create_response("error", "api key not given or invalid", 401)
    return get_user(user_id)

The API supports all CRUD operations and can also identify traffic signs from a picture.

Contributor:

David Slatinek Github avatar
David Slatinek

Android app

Android Java OpenStreetMap

Android app was made with Java. The main app functionality is an image and data capture from sensors and sending them to the server. The app uses GPS to track location and detects vibration to determine road quality. In addition to that, the app also monitors mean and max speed.

App main form App drive form

Contributor:

Marcel Iskrač Github avatar
Marcel Iskrač

Computer vision

OpenCV TensorFlow Keras NumPy Pandas

For traffic sign recognition, we made a program with a convolutional neural network. The program is called by API when it receives an appropriate request.

prediction = model.predict(img)
index = np.argmax(prediction)
return class_names[index]
from detect_road_sign import recognize
return create_response('sign_type', recognize('image' + file_ext), 200)

Contributor:

Marcel Iskrač Github avatar
Marcel Iskrač

Website

HTML5 Bootstrap React Npm Leaflet

The website was created using the React library, HTML and CSS, and Boostrap, which was used for effortless design. We used React for the layout and calls to the application components and communication between the API and the website. The main website functionality is data visualization.

Website - road sign Website - road quality

Contributor:

Marcel Iskrač Github avatar
Marcel Iskrač

Documents

LaTeX Overleaf

All documents were written with LaTeX on Overleaf. We choose LaTeX due to the following advantages:

  • Appealing documents
  • Superb and consistent management of internal references and citations
  • Separation of content and style
  • Flexibility - a lot of packages

All documents are available here.

Contributor:

David Slatinek Github avatar
David Slatinek

Security and portability

Data security is of paramount importance in any project. For this purpose, we use the HTTPS protocol for all parts of the project, and user passwords are stored as hashes in the database. By using Docker, we achieve portability. The following table shows the security of the project and the portability of a specific part:

Project part Security Portability
Server Service provider, HTTPS Yes, docker
Database Service provider, accounts, HTTPS Yes, data transfer
API Service provider, API keys, HTTPS Yes, docker
Android app HTTPS No, only Android platform
Website Service provider, HTTPS Yes, docker

STM32 Discovery

C Python

We used an accelerometer on the SMT32 Discovery board for simulating road quality values. We then made a python script to get data from it and to visualize it.

Data visualization

Contributor:

Vid Kreča Github avatar
Vid Kreča

Data compression algorithm

Python Shell script

We made an algorithm for compressing road quality numbers with python. When the API receives an appropriate request, it gets all road quality data from the database and compresses it into a binary file, which he then sends to the client. The client can then perform decompression and uses the data in further analysis.

if rule == 0:
    bits = get_rule_0_bits(number)
    result += str('{0:b}'.format(bits - 2).zfill(2))
    result += str('{0:b}'.format(get_rule_0_value(number))).zfill(bits)
elif rule == 1:
    counter = 0
    while counter < 8:
        if len(numbers_2) == 0:
            break
        value = numbers_2.pop(0)
        if value != 0:
            numbers_2.insert(0, value)
            break
        counter += 1
    result += str('{0:b}'.format(counter)).zfill(3)
elif rule == 10:
    result += "1" if number < 0 else "0"
    result += str('{0:b}'.format(abs(number)).zfill(8))

Contributor:

David Slatinek Github avatar
David Slatinek

Parallel app

Python

To achieve higher performance, we used Open MPI for image processing. The main program receives the request and the images, distributes them to the other computers, and then receives their responses.

MPI program
Vid Kreča Github avatar
Vid Kreča
Marcel Iskrač Github avatar
Marcel Iskrač

AR app

Unity Blender

We made traffic signs with Blender and we used Unity to make an AR app. The app uses GPS location to get the closest traffic sign and the closest road quality.

Project video
Marcel Iskrač Github avatar
Marcel Iskrač