polofgrs / Computer-Vision-Emergency-Response-Toolkit

Other
0 stars 1 forks source link

Where is the Missing Person Computer Vision Contest

Please visit the contest website for more information.

Introduction

I basically first thought that C# code from the initial repository was not a great idea, for the following reasons :

(Also, I'm very bad at C# coding...)
That is why I decided to take an other direction :

My idea

I am IN LOVE with a particular HTML / CSS / Javascript (Typescript) framework, Angular, for the following reasons :

Software architecture

Right now :

I decided to use the following architecture for my software :

                  SINGLE executable file
+------------------------------------------------------+
|              +-------------------------+             |
|              |        FRONT-END        |             |
|              |       Angular app       |             |
|              |        (Electron)       |             |
|              +-------------------------+             |
|              |      User Interface     |             |
|              | +---------------------+ |             |
|              | |Category 1|Category 2| |             |
|              | |          |          | |             |
|              | |          |   HTML   | |             |
|              | |   JIMP   |  canvas  | |             |
|              | |          |processing| |             |
|              | |          |          | |             |
|              | +---------------------+ |             |
|              +-------------------------+             |
|              |        Category 3       |             |
|              |                         |             |
|              |     HTTP Connexion      |==========++ |
|              +-------+--------+--------+          || |
|                      |        ^                   || |
+----------------------|--------|-------------------||-+
|  Processing request: |        | Algorithm results:|| |
|  * source image,     |        | * result image,   || |
|  * algorithm,        |        | * time,           || |
|  * parameters        |        | * percentage      || |
+----------------------|--------|-------------------||-+
|                      v        |                   || |
|               +------+--------+-------+           || |
|               |        BACK-END       |<==========++ |
|               |     Python server     |   launched   |
|               |     HTTP connexion    |   through    |
|               +-----------------------+  subprocess  |
|               |Algorithm 1|Algorithm 2|              |
|               +-----------------------+              |
|               |Algorithm 3|Algorithm 4|              |
|               +-----------------------+              |
+------------------------------------------------------+

NO FRAMEWORK INSTALLATION IS NECESSARY !
THE WHOLE APP RESIDES IN A SINGLE EXECUTABLE FILE !

Indeed, PyInstaller compiles the server into a single executable file (platform-specific), then that executable is compiled into the Electron app with the ExtraResources directory.

That will enable me to reuse all of the original CVERT Python algorithms, but also simplify the process of adding a new algorithm by simply adding the Python file, and linking it to the front end. The rest will be handled during compilation.

This way, the final user doesn't have to install ANYTHING, just launch the executable file. (He can also install the software just like any other software, through an installer, then find it later on, on his OS).

Used libraries and packages

Front-end:
Node & npm, with the following dev libraries:

And the following prod libraries:

You can find all of the npm libraries in package.json.

Back-end:
Python 3.6 running a web server to handle image processing requests.
It uses the following dev libraries:

And the following prod libraries:

For developers :

NOTE: I am a Linux user. You might need to look around for equivalent Windows or Mac commands and installation processes...

Front-end

Install NodeJS (that will automatically install npm), and Angular. Then:

git clone https://github.com/polofgrs/Computer-Vision-Emergency-Response-Toolkit.git
cd CVERT-ng
npm i
npm run electron

Then, if you want to compile the Electron project into an executable file on your OS :

./node_modules/.bin/electron-builder

Back-end

Install Python 3.6, then the packages in requirements.txt with pip3, then run the server:

sudo apt-get install pyhton3-pip
cd python-server
pip3 install -r requirements.txt
python3 server.py

And to compile it :

pyinstaller server.spec

Additional notes for developers