Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#119
Browse files Browse the repository at this point in the history
add FaceViT
  • Loading branch information
GuoxiaWang authored Sep 1, 2022
2 parents 466d877 + ffd3dbc commit d494417
Show file tree
Hide file tree
Showing 4 changed files with 699 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# global configs
Global:
task_type: recognition
train_epoch_func: defualt_train_one_epoch
eval_func: face_verification_eval
checkpoint: null
pretrained_model: null
output_dir: ./output/
device: gpu
save_interval: 1
max_num_latest_checkpoint: 0
eval_during_train: True
eval_interval: 4000
eval_unit: "step"
accum_steps: 1
epochs: 40
print_batch_step: 200
use_visualdl: True
seed: 2022

# FP16 setting
FP16:
level: O2
GradScaler:
init_loss_scaling: 27648.0
# no_unscale_list: ['dist']

DistributedStrategy:
data_parallel: True

# model architecture
Model:
name: FaceViT_tiny_patch9_112
num_features : 512
class_num: 2059906
pfc_config:
sample_ratio: 0.3
model_parallel: True
sparse_update: False

# loss function config for traing/eval process
Loss:
Train:
- MarginLoss:
m1: 1.0
m2: 0.0
m3: 0.4
s: 64.0
model_parallel: True
weight: 1.0

LRScheduler:
name: Poly
learning_rate: 0.001
decay_unit: step
warmup_epochs: 4
warmup_end_lr: 0.001

Optimizer:
name: AdamW
betas: (0.9, 0.999)
epsilon: 1e-8
weight_decay: 0.1
use_master_param: False
exp_avg_force_fp32: True
no_weight_decay_name: ["pos_embed", "norm"]
grad_clip:
name: ClipGradByGlobalNorm
clip_norm: 5.0
no_clip_list: ['dist']


# data loader for train and eval
DataLoader:
Train:
dataset:
name: FaceIdentificationDataset
image_root: ./dataset/WebFace42M
cls_label_path: ./dataset/WebFace42M/label.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- RandFlipImage:
flip_code: 1
- NormalizeImage:
scale: 1.0/255.0
mean: [0.5, 0.5, 0.5]
std: [0.5, 0.5, 0.5]
order: ''
- ToCHWImage:
sampler:
name: DistributedBatchSampler
batch_size: 512
drop_last: False
shuffle: True
loader:
num_workers: 8
use_shared_memory: True

Eval:
dataset:
name: FaceVerificationDataset
image_root: ./dataset/WebFace42M/agedb_30
cls_label_path: ./dataset/WebFace42M/agedb_30/label.txt
transform_ops:
- DecodeImage:
to_rgb: True
channel_first: False
- NormalizeImage:
scale: 1.0/255.0
mean: [0.5, 0.5, 0.5]
std: [0.5, 0.5, 0.5]
order: ''
- ToCHWImage:
sampler:
name: BatchSampler
batch_size: 128
drop_last: False
shuffle: False
loader:
num_workers: 0
use_shared_memory: True

Metric:
Eval:
- LFWAcc:
flip_test: True

Export:
export_type: onnx
input_shape: [None, 3, 112, 112]
1 change: 1 addition & 0 deletions plsc/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .vision_transformer import *
from .deit import *
from .iresnet import *
from .face_vit import *

__all__ = ["build_model"]

Expand Down
Loading

0 comments on commit d494417

Please sign in to comment.