Skip to content

06. Installation

John Higgins edited this page Apr 27, 2021 · 2 revisions

Prerequisites

Before you install the JusticeAI software, we recommend that you first install and configure Docker. You are then ready to fetch the codebase and begin installation.

Install and Configure Docker

The easiest, most consistent method for installing Docker on Ubuntu can be found at: https://get.docker.com/

run:

curl -fsSL https://get.docker.com -o get-docker.sh

followed by:

bash get-docker.sh

Once the above has been completed. Open a command prompt window and type the ‘docker’ command to confirm that the Docker service is available and returning the help guide.

Enable GPU support for Docker

Assuming docker has been installed run the following command and install the NVIDIA Docker runtime using the script in the main project folder [GPU LINUX ONLY]:

bash install_nvidia_docker.sh

Install docker-compose

Run:

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

then modify permissions:

sudo chmod +x /usr/local/bin/docker-compose

Fetch Codebase

git clone https://github.com/benetech/VideoDeduplication.git

Building and Running the Application

Docker-Compose

The default approach to build and run the application is to use docker-compose utility.

Shortcut commands to run the application are:

  • make run - build and run application
  • make stop - stop application

The make run will ask you the following questions:

  • Location of your source video files
  • Availability of Nvidia GPU support for Docker (see Enable GPU support for Docker)
  • Whether you want to use pre-built images (dev/prod)
  • Whether to encrypt secrets when using remote fingerprint repository sharing

The command above might throw an error if you already have postgres server running. If that's the case run systemctl stop postgresql (Linux) before using docker-compose or choose alternative postgres-port by setting the BENETECH_PG_PORT environment variable.

Running Scripts

In order to run the main scripts, simply enter the app's docker container by running the following command:

docker exec -it videodeduplication_dedup-app_1 /bin/bash

Once within the container, run one of the main scripts.

Extract video signatures

python extract_features.py

Generate Matches

python generate_matches.py

Template Object Matching

python template_matching.py

Exif Extraction

python extract_exif.py

Single Video Processing

python process_video.py [FILE_PATH] [OUTPUT_DIR]

Arguments:

'FILE_PATH': Path to videofile
'OUTPUT_PATH': Path where the output of running the script will be saved [default: 'data/']
'--config', '-cp' : Path to the project config file [default:'config.yml']
'--save-frames' : Whether to save video frames [default:True]
'--save-features/--no-features': Whether to save features [default=True]
'--save-signatures/--no-signatures': Whether to save features [default = True]
'--save-db' : Whether to save features [default = True]

Exploring Application

Once the docker-compose is running, you will be able to access the following:

  1. User interface on http://localhost:5000
  2. projects notebooks on http://localhost:8888
  3. pgAdmin on http://localhost:16543

You can check your running instances using this command:

sudo docker ps

Take note of the following names:

  1. Deduplication App -> videodeduplication_dedup-app_1
  2. User Interface -> videodeduplication_server_1
  3. Postgres Server -> videodeduplication_postgres_1
  4. PgAdmin -> videodeduplication_pgadmin-compose_1

In order to use pgAdmin, follow these instructions:

  1. Go to http://localhost:1643 and use the credentials as defined on the docker-compose.yml file.
  2. Click create new server
  3. Choose a reference name for the server
  4. Go the connection tab and set the host name to postgres, maintenance database to "videodeduplicationdb" and user / password as postgres and admin