Skip to content

GSoC 2020 Work Product Submission

Pulkit Mishra edited this page Aug 26, 2020 · 2 revisions

Final Report - GSoC 2020

Introduction

My(@PulkitMishra) proposal for Poor Man's Rekognition in CCextractor was selected as an official project for Google Summer of Code 2020 under the mentorship of Amit Kumar (@pymit).

Rekognition is an Amazon service capable of identifying objects, text, and activities, performing facial analysis and recognition, detecting the frequency of objects or an inappropriate scene, and much more using deep learning. This GSoC I have tried to build upon the previous work done on Poor Man’s Rekognition — an open-source version of the commercial service.

The aim of this project is to add features to the already existing project and improve the performance of the ones that already exist.

Work Done and Related PRs

Breakdown of the work done before GSoC and the work done during GSoC is provided below. Worth highlighting is that all the deliverables as highlighted in the original proposal have been achieved. One extended goal that came up while working on the project is still in the pipeline as mentioned below and will be finished in a few days.

  1. Work done before GSoC
  1. Work Done During GSoC
  • Made the existing code PEP-8 compliant (PR #76)
  • Fixed the Code style (PR #80, PR #82)
  • Added option to make choice of network through enums (PR #78)
  • Setup Logger (PR #79, PR #81)
  • Added unit tests (PR #84)
  • Scene Text Extraction API added (PR #92, PR #93, PR #98, PR #103)
  • Object Detection API added (PR #101, PR #104)
  • Scene Classification API added (PR #105, PR #107)
  • Video Analysis of Videos for NSFW classification added (PR #107)
  • Improved the performance of Facial Expression Recognition API (PR #72)
  • Containerized the entire project (PR #110)
  • Refactored code to make it suitable for shipping it as a PIP package (PR #86, PR #109)
  1. Work in the Pipeline
  • Converting corelib modeule into a PIP package (issue #108)

Blogs and Documentation

  1. GSoC Chronicles
  2. GSoC Chronicles - Only Time Will Tell
  3. GSoC Chronicles - Best Kept COde
  4. GSoC Chronicles - commit the CRNN cometh the Text
  5. GSoC Chronicles - Mightier than SSD

Setting Up the project for development

Setup the virtual environment

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

Clone the repository

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;

Downloading the models

cd media 
mkdir {face,output,similarFace,text,object,scene}
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
rm 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
rm TFSModels.zip
cd ../../..

TensorFlow Serving setup

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

Apply Migrations

python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py collectstatic  --dry-run

Install ffmpeg

sudo apt install ffmpeg

Start Django application

python3 manage.py runserver 8000

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

Conclusion

CCExtractor Development as an organization, along with the admin Carlos (@cfsmp3) and mentor Amit (@pymit) have been super amazing to work with. My mentor has played an important role in teaching me the best practices of software development and how to be a part of the community and communicate more effectively. Since my project revolves around deep learning and deploying DL models, his experience in the field has helped me a lot in learning about the state of the art techniques and it is indeed appreciable that he was always available for constructive discussion and guidance whenever I got stuck.

My GSoC experience has not only enhanced my skills but has also increased my confidence as a developer. I only have praise and gratefulness to offer to the community of CCExtractor Development and Google for the same.