The anonymization method uses AttGAN, an encoder-decoder based neural network, for changing facial attributes. Anonymization is achieved by applying changes to different facial characteristics in two stages. Experiments show promising results, with up to 100% face detection rate. The new method achieves a high face detection rate by maintaining a human-looking face. However, optimizing the anonymization process requires individual adaptions. What works well for one face may not work well for another.
Anonymization is the process of concealing the identity of persons in the data. The amount of change applied by the anonymization method can be represented numerically as a distance between the original and anonymized face. The distance is calculated using facenet-pytorch.
Test on the CelebA identity 5941 Test on the CelebA identity 6011 Test on the CelebA identity 9739 Test on the CelebA identity 10154 Test on the VGGFaces2 n00284 image Another test on the VGGFaces2 n00284 image
Based on the AttGAN-PyTorch: First install AttGAN-PyTorch and make it run. The anonymization process generates a set of random attributes for the AttGAN. Image is processed two times with these attributes, the second time the attributes are inverted.
A PyTorch implementation of AttGAN - Arbitrary Facial Attribute Editing: Only Change What You Want
Test on the CelebA validating set
Inverting 13 attributes respectively. From left to right: Input, Reconstruction, Bald, Bangs, Black_Hair, Blond_Hair, Brown_Hair, Bushy_Eyebrows, Eyeglasses, Male, Mouth_Slightly_Open, Mustache, No_Beard, Pale_Skin, Young
The original TensorFlow version can be found here.
-
Python 3.6
-
PyTorch 1.3.1
-
torchvision 0.4.1
-
tensorboardX
-
pandas 0.25.3
-
pillow 6.2.1
-
matplotlib 3.1.1
-
numpy 1.17.4
-
scikit-learn 0.22.2
-
scipy 1.3.2
-
facenet-pytorch 1.0.1
pip3 install -r requirements.txt
If you'd like to train with multiple GPUs, please install PyTorch v0.4.0 instead of v1.0.0 or above. The so-called stable version of PyTorch has a bunch of problems with regard to nn.DataParallel()
. E.g. pytorch/pytorch#15716, pytorch/pytorch#16532, etc.
pip3 install --upgrade torch==0.4.0
- Dataset
- CelebA dataset
- Images should be placed in
./data/img_align_celeba/*.jpg
- Attribute labels should be placed in
./data/list_attr_celeba.txt
- Images should be placed in
- HD-CelebA (optional)
- Please see here.
- CelebA-HQ dataset (optional)
- Please see here.
- Images should be placed in
./data/celeba-hq/celeba-*/*.jpg
- Image list should be placed in
./data/image_list.txt
- CelebA dataset
- Pretrained models: download the models you need and unzip the files to
./output/
as below,output ├── 128_shortcut1_inject0_none ├── 128_shortcut1_inject1_none ├── 256_shortcut1_inject0_none ├── 256_shortcut1_inject1_none ├── 256_shortcut1_inject0_none_hq ├── 256_shortcut1_inject1_none_hq ├── 384_shortcut1_inject0_none_hq └── 384_shortcut1_inject1_none_hq
See original's readme.