These are codes of RetinaFace used for blurring images of Figure Skating and CrossFit motions as a part of the joint project with Elancer Inc. Note that the codes in this github are gathered from various other sources on Github. (https://github.com/deepinsight/insightface and etc.) Paper: RetinaFace: Single-stage Dense Face Localisation in the Wild (https://paperswithcode.com/paper/190500641) The code is modified to be used as face blurring tool.
This project aims to blur face of action models in every video. The steps are as follows:
- Step 1: we split each video into frames(images)
- Step 2: use RetinaFace to find face coordinates
- Step 3: use OpenCV library to blur the facial area given from the second step
- Step 4: Compress the image frames as tar file
We provide two different pretrained models for RetinaFace in 'weights' directory. Both models are trained using the WiderFace dataset.
mobilenet0.25_Final.pth
: a trained RetinaFace model using Mobilenet as its backboneResnet50_Final.pth
: a trained retinaFace model using Resnet as its backbone (USED)
Codes in this directory are implemented using Python 3.7. This repository contains the code for RetinaFace. The required Python packages are described in ./requirments.txt.
- The major codes of RetinaFace is in this directory.
main.py
: the code that takes in video folder path as input, creates a pkl file of total paths and activates make_images.py to perform blurring.make_images.py
: the code related to using RetinaFace model to find face coordinates and blur imagesmodels/retinaface.py
: the code that contains the implementation of RetinaFace model.models/net.py
: the code related to feature extraction of images.utils/find_every_path.py
: the code that finds and returns all file paths in a folder.utils/box_utils.py
: the code that contains bounding box related methods.
Type the following command to blur videos:
python main.py --func make_images --file (folder path of your videos) --gpu (gpu)
The script will create the following pkl file:
current directory
└── total_paths.pkl
the processed files are stored in the same directory as the input folder:
current directory
└── your video folder
├── video1.avi
└── video1.tar (TAR FILE)