K-FACE Analysis Project on Pytorch

Related tags

Deep Learningmixface
Overview

Installation

Setup with Conda

# create a new environment
conda create --name insightKface python=3.7 # or over
conda activate insightKface

#install the appropriate cuda version of pytorch(https://pytorch.org/)
#example:
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

# install requirements
pip install -r requirements.txt

Data prepration

K-FACE Database

K-FACE AI-hub.

Detail configuration about K-FACE is provided in the paper below.

K-FACE: A Large-Scale KIST Face Database in Consideration with Unconstrained Environments

K-FACE sample images

title

Structure of the K-FACE database

title

Configuration of K-FACE

Configuration_of_KFACE

Detection & Alignment on K-FACE

"""
    ###################################################################

    K-Face : Korean Facial Image AI Dataset
    url    : http://www.aihub.or.kr/aidata/73

    Directory structure : High-ID-Accessories-Lux-Emotion
    ID example          : '19062421' ... '19101513' len 400
    Accessories example : 'S001', 'S002' .. 'S006'  len 6
    Lux example         : 'L1', 'L2' .. 'L30'       len 30
    Emotion example     : 'E01', 'E02', 'E03'       len 3
    
    ###################################################################
"""

# example
cd detection

python align_kfaces.py --ori_data_path '/data/FACE/KFACE/High' --detected_data_path 'kface_retina_align_112x112'

Training and test datasets on K-FACE

Train ID Accessories Lux Expression Pose #Image Variance
T1 A1 1000 E1 C4-10 2,590 Very Low
T2 A1-2 400-1000 E1 C4-10 46,620 Low
T3 A1-A4 200-1000 E1-2 C4-13 654,160 Middle
T4 A1-A6 40-1000 E1-3 C1-20 3,862,800 High
Test ID Accessories Lux Expression Pose #Pairs Variance
Q1 A1 1000 E1 C4-10 1,000 Very Low
Q2 A1-2 400-1000 E1 C4-10 100,000 Low
Q3 A1-4 200-1000 E1-2 C4-13 100,000 Middle
Q4 A1-6 40-1000 E1-3 C1-20 100,000 High

MS1M-RetinaFace (MS1M-R)

MS1M-RetinaFace download link:

  1. The Lightweight Face Recognition Challenge & Workshop.

  2. https://github.com/deepinsight/insightface/wiki/Dataset-Zoo

#Preprocess 'train.rec' and 'train.idx' to 'jpg'

# example
cd detection

python rec2image.py --include '/data/FACE/ms1m-retinaface-t1/' --output 'MS1M-RetinaFace'

Inference

After downloading the pretrained model, run test.py.

Pretrained Model

For all experiments, ResNet-34 was chosen as the baseline backbone.

The model was trained on KFACE

Head&Loss Q1 Q2 Q3 Q4
ArcFace (s=16, m=0.25) 98.30 94.77 87.87 85.41
SN-pair (s=64) 99.20 95.01 91.84 89.74
MixFace (e=1e-22, m=0.25) 100 96.37 92.36 89.80

Note:

  • For ArcFace, We tested (s,m)={(16,0.5), (32,0.25), (64,0.25), (32,0.5), (64,0.5)}, but the model was not trained properly So, we apply (s,m)=(16,0.25).
cd recognition

# example
python test.py --weights 'kface.mixface.1e-22m0.25.best.pt' --dataset 'kface' --data_cfg 'data/KFACE/kface.T4.yaml'

The model was trained on MS1M-R

Head&Loss Q2 Q3 Q4 LFW CFP-FP AgeDB-30
ArcFace (s=64, m=0.5) 98.71 86.60 82.03 99.80 98.41 98.80
SN-pair (s=64) 92.85 76.36 70.08 99.55 96.20 95.46
MixFace (e=1e-22, m=0.5) 97.36 82.89 76.95 99.68 97.74 97.25
cd recognition

# example
python test.py --weights 'face.mixface.1e-22m0.5.best.pt' --dataset 'face' --data_cfg 'data/face.all.yaml'

The model was trained on MS1M-R+T4

Head&Loss Q2 Q3 Q4 LFW CFP-FP AgeDB-30
ArcFace (s=8, m=0.25) 76.58 73.13 71.38 99.46 96.75 93.83
SN-pair (s=64) 98.37 94.98 93.33 99.45 94.90 93.45
MixFace (e=1e-22, m=0.5) 99.27 96.85 94.79 99.53 96.32 95.56

Note:

  • For ArcFace, we tested (s,m)={(8, 0.5), (16, 0.25), (16,0.5), (32,0.25), (64,0.25), (32,0.5), (64,0.5)}, but the model was not trained properly So, we apply (s,m)=(8,0.25).
cd recognition

# example
python test.py --weights 'merge.mixface.1e-22m0.5.best.pt' --dataset 'merge' --data_cfg 'data/merge.yaml'

Training

Multi-GPU DataParallel Mode

Example script for training on KFACE

cd recognition

# example 
python train.py --dataset 'kface' --head 'mixface' --data_cfg 'data/KFACE/kface.T4.yaml' --hyp 'data/face.hyp.yaml' --head_cfg 'models/head.kface.cfg.yaml' --name 'example' --device 0,1

Multi-GPU DistributedDataParallel Mode

Example script for training on KFACE

cd recognition

# example
python -m torch.distributed.launch --nproc_per_node 2 train.py --dataset 'kface' --head 'mixface' --data_cfg 'data/KFACE/kface.T4.yaml' --hyp 'data/face.hyp.yaml' --head_cfg 'models/head.kface.cfg.yaml' --name 'example' --device 0,1

Note:

  • For MS1M-R, change args --dataset face, --data_cfg data/face.all.yaml, and --head_cfg model/head.face.cfg.yaml.
  • For MS1M-R+T4, change args --dataset merge, --data_cfg data/merge.yaml, and --head_cfg model/head.merge.cfg.yaml.
  • The args --nodrop should be used if you train with the metric loss(e.g., SN-pair, N-pair, etc.) on MS1M-R or MS1M-R+T4.
  • The args --double should be used if you train with the metric loss(e.g., SN-pair, N-pair, etc.) or MixFace on MS1M-R or MS1M-R+T4.
  • DistributedDataParallel is only available to classification loss(e.g., arcface, cosface, etc.)

Reference code

Thanks for these source codes porviding me with knowledges to complete this repository.

  1. https://github.com/biubug6/Pytorch_Retinaface.
  2. https://github.com/deepinsight/insightface.
  3. https://github.com/ultralytics/yolov5
Owner
Jung Jun Uk
Jung Jun Uk
Code repo for "RBSRICNN: Raw Burst Super-Resolution through Iterative Convolutional Neural Network" (Machine Learning and the Physical Sciences workshop in NeurIPS 2021).

RBSRICNN: Raw Burst Super-Resolution through Iterative Convolutional Neural Network An official PyTorch implementation of the RBSRICNN network as desc

Rao Muhammad Umer 6 Nov 14, 2022
VL-LTR: Learning Class-wise Visual-Linguistic Representation for Long-Tailed Visual Recognition

VL-LTR: Learning Class-wise Visual-Linguistic Representation for Long-Tailed Visual Recognition Usage First, install PyTorch 1.7.1+, torchvision 0.8.2

40 Dec 12, 2022
Implementation of Change-Based Exploration Transfer (C-BET)

Implementation of Change-Based Exploration Transfer (C-BET), as presented in Interesting Object, Curious Agent: Learning Task-Agnostic Exploration.

Simone Parisi 29 Dec 04, 2022
Official pytorch code for SSAT: A Symmetric Semantic-Aware Transformer Network for Makeup Transfer and Removal

SSAT: A Symmetric Semantic-Aware Transformer Network for Makeup Transfer and Removal This is the official pytorch code for SSAT: A Symmetric Semantic-

ForeverPupil 57 Dec 13, 2022
python 93% acc. CNN Dogs Vs Cats ( Pytorch )

English | 简体中文(测试中...敬请期待) Cnn-Classification-Dog-Vs-Cat 猫狗辨别 (pytorch版本) CNN Resnet18 的猫狗分类器,基于ResNet及其变体网路系列,对于一般的图像识别任务表现优异,模型精准度高达93%(小型样本)。 项目制作于

apple ye 1 May 22, 2022
SOFT: Softmax-free Transformer with Linear Complexity, NeurIPS 2021 Spotlight

SOFT: Softmax-free Transformer with Linear Complexity SOFT: Softmax-free Transformer with Linear Complexity, Jiachen Lu, Jinghan Yao, Junge Zhang, Xia

Fudan Zhang Vision Group 272 Dec 25, 2022
Human Action Controller - A human action controller running on different platforms.

Human Action Controller (HAC) Goal A human action controller running on different platforms. Fun Easy-to-use Accurate Anywhere Fun Examples Mouse Cont

27 Jul 20, 2022
PyAF is an Open Source Python library for Automatic Time Series Forecasting built on top of popular pydata modules.

PyAF (Python Automatic Forecasting) PyAF is an Open Source Python library for Automatic Forecasting built on top of popular data science python module

CARME Antoine 405 Jan 02, 2023
🔥🔥High-Performance Face Recognition Library on PaddlePaddle & PyTorch🔥🔥

face.evoLVe: High-Performance Face Recognition Library based on PaddlePaddle & PyTorch Evolve to be more comprehensive, effective and efficient for fa

Zhao Jian 3.1k Jan 02, 2023
ML-based medical imaging using Azure

Disclaimer This code is provided for research and development use only. This code is not intended for use in clinical decision-making or for any other

Microsoft Azure 68 Dec 23, 2022
LSTM model trained on a small dataset of 3000 names written in PyTorch

LSTM model trained on a small dataset of 3000 names. Model generates names from model by selecting one out of top 3 letters suggested by model at a time until an EOS (End Of Sentence) character is no

Sahil Lamba 1 Dec 20, 2021
Confidence Propagation Cluster aims to replace NMS-based methods as a better box fusion framework in 2D/3D Object detection

CP-Cluster Confidence Propagation Cluster aims to replace NMS-based methods as a better box fusion framework in 2D/3D Object detection, Instance Segme

Yichun Shen 41 Dec 08, 2022
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Li Shengyan 270 Dec 31, 2022
Code for our ALiBi method for transformer language models.

Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation This repository contains the code and models for our paper Tra

Ofir Press 211 Dec 31, 2022
A U-Net combined with a variational auto-encoder that is able to learn conditional distributions over semantic segmentations.

Probabilistic U-Net + **Update** + An improved Model (the Hierarchical Probabilistic U-Net) + LIDC crops is now available. See below. Re-implementatio

Simon Kohl 498 Dec 26, 2022
RE3: State Entropy Maximization with Random Encoders for Efficient Exploration

State Entropy Maximization with Random Encoders for Efficient Exploration (RE3) (ICML 2021) Code for State Entropy Maximization with Random Encoders f

Younggyo Seo 47 Nov 29, 2022
Project page of the paper 'Analyzing Perception-Distortion Tradeoff using Enhanced Perceptual Super-resolution Network' (ECCVW 2018)

EPSR (Enhanced Perceptual Super-resolution Network) paper This repo provides the test code, pretrained models, and results on benchmark datasets of ou

Subeesh Vasu 78 Nov 19, 2022
An implementation of Video Frame Interpolation via Adaptive Separable Convolution using PyTorch

This work has now been superseded by: https://github.com/sniklaus/revisiting-sepconv sepconv-slomo This is a reference implementation of Video Frame I

Simon Niklaus 984 Dec 16, 2022
Generative Query Network (GQN) in PyTorch as described in "Neural Scene Representation and Rendering"

Update 2019/06/24: A model trained on 10% of the Shepard-Metzler dataset has been added, the following notebook explains the main features of this mod

Jesper Wohlert 313 Dec 27, 2022
The open source code of SA-UNet: Spatial Attention U-Net for Retinal Vessel Segmentation.

SA-UNet: Spatial Attention U-Net for Retinal Vessel Segmentation(ICPR 2020) Overview This code is for the paper: Spatial Attention U-Net for Retinal V

Changlu Guo 151 Dec 28, 2022