mirror of
https://github.com/deepinsight/insightface.git
synced 2025-12-30 08:02:27 +00:00
1.4 KiB
1.4 KiB
A tutorial on how to enable mask augmentation on arcface_torch training.
The python package insightface==0.3.2 provides utilities to enable mask augmentation within one line:
transform_list.append(
MaskAugmentation(
mask_names=['mask_white', 'mask_blue', 'mask_black', 'mask_green'],
mask_probs=[0.4, 0.4, 0.1, 0.1], h_low=0.33, h_high=0.4, p=self.mask_prob)
)
Prepare
- Download antelope model pack by
bash> insightface-cli model.download antelopewhich will be located at~/.insightface/models/antelope - Generate BFM.mat and BFM_UV.mat following here, for license concern.
- Generate new mask-rec dataset by
bash> insightface-cli rec.addmaskparam /data/ms1m-retinaface-t1 /data/ms1m-retinaface-t1maskwhich generates and writes the mask params of each image into the record.
Add Mask Renderer Augmentation
just by following code:
from insightface.app import MaskAugmentation
self.transform_list.append(
MaskAugmentation(
mask_names=['mask_white', 'mask_blue', 'mask_black', 'mask_green'],
mask_probs=[0.4, 0.4, 0.1, 0.1],
h_low=0.33, h_high=0.4, p=0.1)
)
Please check dataset_mask.py for detail.
You can override the original dataset.py with this file to simply enable mask augmentation.