Github項目推薦 | retinaface 人臉識別

本項目在 //github.com/biubug6/Pytorch_Retinaface 的基礎上繼續開發優化。
Github項目地址
//github.com/ternaus/retinaface
項目特點
訓練循環已經遷至 Pytorch Lightning 項目中
本項目增加了以下功能:
- 分散式訓練
- fp16
- 同步批次標準
- 支援各種記錄器,如 W&B 或 Neptune.ml
超參數嵌入到配置文件中
分散在程式碼中的超參數嵌入到配置文件 retinadace/config 中
增加=>精鍊
原本需要手動實現的框線顏色效果,已經由Alumentations庫替換。
Todo:
- Alumentations中還沒有實現水平翻轉;
- 尚未實現諸如旋轉或轉置之類的空間變換。
顏色轉換在配置文件中進行定義。
添加了用於驗證的mAP計算
為了跟蹤進度,在驗證時會計算mAP指標。
數據準備
數據管道需要以下格式的標籤:
[
{
"file_name": "0--Parade/0_Parade_marchingband_1_849.jpg",
"annotations": [
{
"x_min": 449,
"y_min": 330,
"width": 122,
"height": 149,
"landmarks": [
488.906,1
373.643,
0.0,
542.089,
376.442,
0.0,
515.031,
412.83,
0.0,
485.174,
425.893,
0.0,
538.357,
431.491,
0.0,
0.82
]
}
]
},
訓練
python retinaface/train.py -h (anaconda3) 15:14:11
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.
推論
python retinaface/inference.py -h (anaconda3) 14:47:09
usage: inference.py [-h] -i INPUT_PATH -c CONFIG_PATH -o OUTPUT_PATH [-v]
[-g NUM_GPUS] [-t TARGET_SIZE] [-m MAX_SIZE]
[--origin_size]
[--confidence_threshold CONFIDENCE_THRESHOLD]
[--nms_threshold NMS_THRESHOLD] [-w WEIGHT_PATH]
[--keep_top_k KEEP_TOP_K]
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 with images.
-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.
-t TARGET_SIZE, --target_size TARGET_SIZE
Target size
-m MAX_SIZE, --max_size MAX_SIZE
Target size
--origin_size Whether use origin image size to evaluate
--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
