Skip to content

Project Setup in Ubuntu 18.04

Pulkit Mishra edited this page Jul 2, 2020 · 11 revisions

Development Enironment setup

Run the following command to setup the virtualenv.

pip3 install virtualenv
virtualenv -p python3 myenv  
source myenv/bin/activate

Clone the repo

git clone https://github.com/pymit/Rekognition
cd Rekognition
pip3 install -r requirements.txt

Postgres setup

sudo apt update
sudo apt install postgresql postgresql-contrib
sudo service postgresql start
sudo -u postgres psql

CREATE DATABASE pmr;
CREATE USER admin WITH PASSWORD 'admin';
ALTER ROLE admin SET client_encoding TO 'utf8';
ALTER ROLE admin SET default_transaction_isolation TO 'read committed';
ALTER ROLE admin SET timezone TO 'UTC';
ALTER USER admin CREATEDB;
ALTER DATABASE pmr OWNER TO admin;

ReactJS setup for frontend

git clone https://github.com/pymit/RekoUI
cd RekoUI
sudo apt install npm
sudo npm install -g npm@latest
npm install
npm start

Downloading the models

//current directory Rekognition

cd media 
mkdir {face,output,similarFace,text,object}
cd ..
cd corelib/model
mkdir facenet
cd facenet
wget https://www.dropbox.com/s/jm8grrifh5yk7is/2017.zip?dl=1 -O 2017.zip
unzip 2017.zip
cd ..
mkdir tfs
cd tfs
wget https://www.dropbox.com/s/0b6yqn4yku96hg5/model_volume.zip?dl=1 -O TFSModels.zip
unzip TFSModels.zip

TensorFlow Serving setup using Docker

sudo apt-get update
sudo apt install docker.io
sudo chmod 666 /var/run/docker.sock
docker pull tensorflow/serving:nightly-devel

docker run -it -p 8500:8500 -p 8501:8501 -v <absolute path to tfs model's parent directory>:/home/ tensorflow/serving:nightly-devel

then in docker shell, run the below command

tensorflow_model_server --port=8500 --rest_api_port=8501 --model_config_file=/home/configs/models.conf


Finally

  • Migrate

    python manage.py makemigrations
    python manage.py migrate
    
  • Staticfiles

    python manage.py collectstatic  --dry-run
    
install ffmpeg
sudo apt install ffmpeg

Start django application

python manage.py runserver 8000

Django app can be accessed at http://localhost:8000

ReactJS app can be accessed at http://localhost:3000