Unstructured set of the helper functions.
Project description
Retinaface
This repo is build on top of https://github.com/biubug6/Pytorch_Retinaface
Differences
Train loop moved to Pytorch Lightning
IT added a set of functionality:
- Distributed training
- fp16
- Syncronized BatchNorm
- Support for various loggers like W&B or Neptune.ml
Hyperparameters are fedined in config file
Hyperparameters that were scattered across the code moved to the config at retinadace/config
Augmentations => Albumentations
Color that were manually implemented replaced by the Albumentations library.
Todo:
- Horizontal Flip is not implemented in Albumentations
- Spatial transforms like rotations or transpose are not implemented yet.
Color transforms are defined in the config.
Added mAP calculation for validation
In order to track thr progress, mAP metric is calculated on validation.
Data Preparation
The pipeline expects labels in the format:
[
{
"file_name": "0--Parade/0_Parade_marchingband_1_849.jpg",
"annotations": [
{
"bbox": [
449,
330,
571,
720
],
"landmarks": [
[
488.906,
373.643
],
[
542.089,
376.442
],
[
515.031,
412.83
],
[
485.174,
425.893
],
[
538.357,
431.491
]
]
}
]
},
You can convert the defaule labels of the WiderFaces to the json of the propper format with this script.
Training
python retinaface/train.py -h
usage: train.py [-h] -c CONFIG_PATH
optional arguments:
-h, --help show this help message and exit
-c CONFIG_PATH, --config_path CONFIG_PATH
Path to the config.
Inference
python retinaface/inference.py -h
usage: inference.py [-h] -i INPUT_PATH -c CONFIG_PATH -o OUTPUT_PATH [-v]
[-g NUM_GPUS] [-m MAX_SIZE] [-b BATCH_SIZE]
[-j NUM_WORKERS]
[--confidence_threshold CONFIDENCE_THRESHOLD]
[--nms_threshold NMS_THRESHOLD] -w WEIGHT_PATH
[--keep_top_k KEEP_TOP_K] [--world_size WORLD_SIZE]
[--local_rank LOCAL_RANK] [--fp16]
optional arguments:
-h, --help show this help message and exit
-i INPUT_PATH, --input_path INPUT_PATH
Path with images.
-c CONFIG_PATH, --config_path CONFIG_PATH
Path to config.
-o OUTPUT_PATH, --output_path OUTPUT_PATH
Path to save jsons.
-v, --visualize Visualize predictions
-g NUM_GPUS, --num_gpus NUM_GPUS
The number of GPUs to use.
-m MAX_SIZE, --max_size MAX_SIZE
Resize the largest side to this number
-b BATCH_SIZE, --batch_size BATCH_SIZE
batch_size
-j NUM_WORKERS, --num_workers NUM_WORKERS
num_workers
--confidence_threshold CONFIDENCE_THRESHOLD
confidence_threshold
--nms_threshold NMS_THRESHOLD
nms_threshold
-w WEIGHT_PATH, --weight_path WEIGHT_PATH
Path to weights.
--keep_top_k KEEP_TOP_K
keep_top_k
--world_size WORLD_SIZE
number of nodes for distributed training
--local_rank LOCAL_RANK
node rank for distributed training
--fp16 Use fp6
python -m torch.distributed.launch --nproc_per_node=<num_gpus> retinaface/inference.py <parameters>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file retinaface_pytorch-0.0.1.tar.gz
.
File metadata
- Download URL: retinaface_pytorch-0.0.1.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd539430f783f600d9565f5480a308a606e86d8e52b944fba46d559e9f6b17f4 |
|
MD5 | 14d8df6f18984a7a8df2946bd58e969f |
|
BLAKE2b-256 | 05dea5f2347e15f2603e6d720093d1a830641ab10dd048563786d87364be8fc5 |
File details
Details for the file retinaface_pytorch-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: retinaface_pytorch-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87b19e589b6c9806eb9155040a0d43b345a963dba001404e276c73ef60b58ce5 |
|
MD5 | 72939d952fa4f2e9c616f18a7e266bd3 |
|
BLAKE2b-256 | 256611ba788928f3e7a9af3628e787c4d4deee4436dcdd38535a6edb4875adb5 |