Privacy-Preserving Portrait Matting [ACM MM-21]

Overview

Privacy-Preserving Portrait Matting [ACM MM-21]

This is the official repository of the paper Privacy-Preserving Portrait Matting.

Jizhizi Li, Sihan Ma, Jing Zhang, and Dacheng Tao

Introduction | PPT and P3M-10k | P3M-Net | Benchmark | Results | Train and Test | Inference code | Statement


📮 News

[2021-11-21]: Publish the dataset P3M-10k (the largest privacy-preserving portrait matting dataset, contains 10421 high-resolution real-world face-blurred portrait images and the manually labeled alpha mattes.), the train code and the test code. The dataset P3M-10k can be accessed from the following link, please make sure that you have read and agreed to the agreement. The train code and test code can be viewed from this code-base page.

[2021-12-06]: Publish the face mask of the training set and P3M-500-P validation set of P3M-10k dataset.

Dataset

Dataset Link
(Google Drive)

Dataset Link
(Baidu Wangpan 百度网盘)

Dataset Release Agreement
P3M-10k Link Link (pw: fgmc) Agreement (MIT License)
P3M-10k facemask (optional) Link Link (pw: f772) Agreement (MIT License)

[2021-11-20]: Publish the inference code and the pretrained model (Google Drive | Baidu Wangpan (pw: 2308)) that can be used to test on your own privacy-preserving or normal portrait images. Some test results on P3M-10k can be viewed from this demo page.

Introduction

Recently, there has been an increasing concern about the privacy issue raised by using personally identifiable information in machine learning. However, previous portrait matting methods were all based on identifiable portrait images.

To fill the gap, we present P3M-10k in this paper, which is the first large-scale anonymized benchmark for Privacy-Preserving Portrait Matting. P3M-10k consists of 10,000 high-resolution face-blurred portrait images along with high-quality alpha mattes. We systematically evaluate both trimap-free and trimap-based matting methods on P3M-10k and find that existing matting methods show different generalization capabilities when following the Privacy-Preserving Training (PPT) setting, 𝑖.𝑒., training on face-blurred images and testing on arbitrary images.

To devise a better trimap-free portrait matting model, we propose P3M-Net, which leverages the power of a unified framework for both semantic perception and detail matting, and specifically emphasizes the interaction between them and the encoder to facilitate the matting process. Extensive experiments on P3M-10k demonstrate that P3M-Net outperforms the state-of-the-art methods in terms of both objective metrics and subjective visual quality. Besides, it shows good generalization capacity under the PPT setting, confirming the value of P3M-10k for facilitating future research and enabling potential real-world applications.

PPT Setting and P3M-10k Dataset

PPT Setting: Due to the privacy concern, we propose the Privacy-Preserving Training (PPT) setting in portrait matting, 𝑖.𝑒., training on privacy-preserved images (𝑒.𝑔., processed by face obfuscation) and testing on arbitraty images with or without privacy content. As an initial step towards privacy-preserving portrait matting problem, we only define the identifiable faces in frontal and some profile portrait images as the private content in this work.

P3M-10k Dataset: To further explore the effect of PPT setting, we establish the first large-scale privacy-preserving portrait matting benchmark named P3M-10k. It contains 10,000 annonymized high-resolution portrait images by face obfuscation along with high-quality ground truth alpha mattes. Specifically, we carefully collect, filter, and annotate about 10,000 high-resolution images from the Internet with free use license. There are 9,421 images in the training set and 500 images in the test set, denoted as P3M-500-P. In addition, we also collect and annotate another 500 public celebrity images from the Internet without face obfuscation, to evaluate the performance of matting models under the PPT setting on normal portrait images, denoted as P3M-500-NP. We show some examples as below, where (a) is from the training set, (b) is from P3M-500-P, and (c) is from P3M-500-NP.

P3M-10k and the facemask are now published!! You can get access to it from the following links, please make sure that you have read and agreed to the agreement. Note that the facemask is not used in our work. So it's optional to download it.

Dataset

Dataset Link
(Google Drive)

Dataset Link
(Baidu Wangpan 百度网盘)

Dataset Release Agreement
P3M-10k Link Link (pw: fgmc) Agreement (MIT License)
P3M-10k facemask (optional) Link Link (pw: f772) Agreement (MIT License)

P3M-Net

Our proposed P3M-Net consists of four parts

  • A Multi-task Framework: To enable benefits from explicitly modeling both semantic segmentation and detail matting tasks and jointly optimizing for trimap-free matting, we follow [1] and [2], adopt a multi-task framework based on a modified version of ResNet-34, the model pretrained on ImageNet will be listed as follows;

  • TFI: Tripartite-Feature Integration: TFI module is used in each matting decoder block to model the interaction between encoder, segmentation decoder, and the matting decoder. TFI has three inputs, the feature map of the previous matting decoder block, the feature map from the same level semantic decoder block, and the feature map from the symmetrical encoder block. TFI passes them through a projection layer, concats the outputs and feeds into a convolutional block to generate the output feature;

  • sBFI: Shallow Bipartite-Feature Integration: sBFI module is used to model the interaction between the encoder and matting decoder. sBFI adopts the feature map from the first encoder block as a guidance to refine the output feature map from previous matting decoder block since shallow layers in the encoder contain many details and local structural information;

  • dBFI: Deep Bipartite-Feature Integration: dBFI module is used to model the interaction between the encoder and segmentation decoder. dBFI adopts the feature map from the last encoder block as a guidance for the semantic decoder since it contains abundant global semantics. Specifically, dBFI fuses the feature map from the last encoder with the ones from semantic decoder to improve the feature representation ability for the high-level semantic segmentation task.

Here we provide the model we pretrained on P3M-10k and the backbone we pretrained on ImageNet.

Model Pretrained Backbone on ImageNet Pretrained P3M-NET on P3M-10k
Google Drive Link Link

Baidu Wangpan
(百度网盘)

Link
(pw: 2v1t)

Link
(pw: 2308)

Benchmark

A systematic evaluation of the existing trimap-based and trimap-free matting methods on P3M-10k is conducted to investigate the impact of the privacy-preserving training (PPT) setting on different matting models and gain some useful insights. Part of the results are shown as below. Please refer to the paper for full tables.

In the following tables, "B" denotes the blurred images, and "N" denotes the normal images. "B:N" denotes training on blurred images while testing on normal images, vice versa.

Table 1. Results of trimap-based deep learning methods on P3M-500-P.
Setting B:B B:N N:B N:N
Method SAD MSE SAD MSE SAD MSE SAD MSE
DIM 4.8906 0.0115 4.8940 0.0116 4.8050 0.0116 4.7941 0.0116
AlphaGAN 5.2669 0.0112 5.2367 0.0112 5.7060 0.0120 5.6696 0.0119
GCA 4.3593 0.0088 4.3469 0.0089 4.4068 0.0089 4.4002 0.0089
IndexNet 5.1959 0.0156 5.2188 0.0158 5.8267 0.0202 5.8509 0.0204
FBA 4.1330 0.0088 4.1267 0.0088 4.1666 0.0086 4.1544 0.0086
Table 2. Results of trimap-free methods on P3M-500-P.
Setting B:B B:N N:B N:N
Method SAD MSE SAD MSE SAD MSE SAD MSE
SHM 21.56 0.0100 24.33 0.0116 23.91 0.0115 17.13 0.0075
LF 42.95 0.0191 30.84 0.0129 41.01 0.0174 31.22 0.0123
HATT 25.99 0.0054 26.5 0.0055 35.02 0.0103 22.93 0.0040
GFM 13.20 0.0050 13.08 0.0050 13.54 0.0048 10.73 0.0033
BASIC 15.13 0.0058 15.52 0.0060 24.38 0.0109 14.52 0.0054
P3M-Net (Ours) 8.73 0.0026 9.22 0.0028 11.22 0.0040 9.06 0.0028

Results

We test our network on our proposed P3M-500-P and P3M-500-NP and compare with previous SOTA methods, we list the results as below. More results on P3M-10k test set can be found here.

Inference Code - How to Test on Your Images

Here we provide the procedure of testing on sample images by our pretrained model:

  1. Setup environment following this instruction page;

  2. Insert the path REPOSITORY_ROOT_PATH in the file core/config.py;

  3. Download the pretrained P3M-Net model from here (Google Drive|Baidu Wangpan (pw: 2308)) and unzip to the folder models/pretrained/;

  4. Save your sample images in folder samples/original/.;

  5. Setup parameters in the file scripts/test_samples.sh and run by:

    chmod +x scripts/test_samples.sh

    scripts/test_samples.sh;

  6. The results of alpha matte and transparent color image will be saved in folder samples/result_alpha/. and samples/result_color/..

We show some sample images, the predicted alpha mattes, and their transparent results as below. We use the pretrained model from section Network with Hybrid (1 & 1/2) test strategy.

Statement

If you are interested in our work, please consider citing the following:

@inproceedings{10.1145/3474085.3475512,
author = {Li, Jizhizi and Ma, Sihan and Zhang, Jing and Tao, Dacheng},
title = {Privacy-Preserving Portrait Matting},
year = {2021},
isbn = {9781450386517},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3474085.3475512},
doi = {10.1145/3474085.3475512},
booktitle = {Proceedings of the 29th ACM International Conference on Multimedia},
pages = {3501–3509},
numpages = {9},
keywords = {trimap, benchmark, portrait matting, deep learning, semantic segmentation, privacy-preserving},
location = {Virtual Event, China},
series = {MM '21}
}

This project is under MIT licence.

For further questions, please contact Jizhizi Li at [email protected] or Sihan Ma at [email protected].

Relevant Projects

[1] Bridging Composite and Real: Towards End-to-end Deep Image Matting, IJCV, 2021 | Paper | Github
     Jizhizi Li, Jing Zhang, Stephen J. Maybank, Dacheng Tao

[2] Deep Automatic Natural Image Matting, IJCAI, 2021 | Paper | Github
     Jizhizi Li, Jing Zhang, and Dacheng Tao

Comments
  • Could you open the downloader link about P3M-10k?

    Could you open the downloader link about P3M-10k?

    This work is great, and I want to reappear your work for more detail. And we want to test our method on P3M-10k, so, would you open the download link?

    opened by kings-rgb 1
  • 代码复现结果

    代码复现结果

    Hi!我想请教一下代码复现的问题。我复现了P3MNet模型,在P和NP数据集上都进行了测试,但是结果和论文有一定差距。我按照ViTAE-Transformer-Matting这篇文章中训练设置进行训练,“We train P3M-Net variants on NVIDIA Tesla V100 GPUs with a batch size of 8 for 150 epochs, which takes about 2 days.”,但是效果有差距。论文在P、NP数据集上SAD上结果为8.73和11.2300,我1卡bs8得到的结果是9.6051和15.9386,同时也尝试了4卡bs32,结果为9.6127和13.5515。想请教一下是我训练时哪儿有问题吗?还是有用到一些trick?感谢!! image

    opened by Sunnyiren 0
  • test_choice RESIZE or HYBRID?

    test_choice RESIZE or HYBRID?

    Hi,

    Thanks for making the code available for this awesome work! I was wondering which test_choice did you use when reporting the accuracies in the paper? RESIZE or HYBRID?

    opened by yataoz 0
  • Loss differs slightly from paper

    Loss differs slightly from paper

    I just saw that the final loss in the implementation differs from what was described in the paper (Eqn. (5)). In the implementation (https://github.com/JizhiziLi/P3M/blob/master/core/train.py#L85), loss_fusion_alpha is used in two terms, giving it a higher weight than described in the paper. The second term can simply be skipped to make it equivalent to the paper, i.e., change it to:

    loss = loss_global/6+loss_local*2+loss_fusion_alpha*2+loss_fusion_comp
    

    instead of:

    loss = loss_global/6+loss_local*2+loss_fusion_alpha*2+loss_fusion_alpha+loss_fusion_comp
    
    opened by poier 0
  • Gradient metric different from reference paper

    Gradient metric different from reference paper

    Hi,

    first, very nice work. Thanks.

    In the paper you refer to [Rhemann et al., CVPR 2009] for the gradient based (GRAD) metric. In [Rhemann et al., CVPR 2009] they compute this as the sum of the distance between the normalized gradients of the prediction and ground truth. However, in you implementation you compute the distance between the gradient magnitudes (and divide the sum of the squared distance by 10; https://github.com/JizhiziLi/P3M/blob/master/core/evaluate.py#L154-L158). What is the reason for that?

    Best, Georg

    [Rhemann et al., CVPR 2009] https://www.microsoft.com/en-us/research/wp-content/uploads/2009/01/cvpr09-matting-Eval_TR.pdf

    opened by poier 0
Owner
Jizhizi_Li
Ph.D. student at the University of Sydney - Artificial Intelligence
Jizhizi_Li
MODNet: Trimap-Free Portrait Matting in Real Time

MODNet is a model for real-time portrait matting with only RGB image input.

Zhanghan Ke 2.8k Dec 30, 2022
Official implementation of the paper "Lightweight Deep CNN for Natural Image Matting via Similarity Preserving Knowledge Distillation"

Lightweight-Deep-CNN-for-Natural-Image-Matting-via-Similarity-Preserving-Knowledge-Distillation Introduction Accepted at IEEE Signal Processing Letter

DongGeun-Yoon 19 Jun 7, 2022
A Peer-to-peer Platform for Secure, Privacy-preserving, Decentralized Data Science

PyGrid is a peer-to-peer network of data owners and data scientists who can collectively train AI models using PySyft. PyGrid is also the central serv

OpenMined 615 Jan 3, 2023
Bachelor's Thesis in Computer Science: Privacy-Preserving Federated Learning Applied to Decentralized Data

federated is the source code for the Bachelor's Thesis Privacy-Preserving Federated Learning Applied to Decentralized Data (Spring 2021, NTNU) Federat

Dilawar Mahmood 25 Nov 30, 2022
This is the research repository for Vid2Doppler: Synthesizing Doppler Radar Data from Videos for Training Privacy-Preserving Activity Recognition.

Vid2Doppler: Synthesizing Doppler Radar Data from Videos for Training Privacy-Preserving Activity Recognition This is the research repository for Vid2

Future Interfaces Group (CMU) 26 Dec 24, 2022
Privacy as Code for DSAR Orchestration: Privacy Request automation to fulfill GDPR, CCPA, and LGPD data subject requests.

Meet Fidesops: Privacy as Code for DSAR Orchestration A part of the greater Fides ecosystem. ⚡ Overview Fidesops (fee-dez-äps, combination of the Lati

Ethyca 44 Dec 6, 2022
《Deep Single Portrait Image Relighting》(ICCV 2019)

Ratio Image Based Rendering for Deep Single-Image Portrait Relighting [Project Page] This is part of the Deep Portrait Relighting project. If you find

null 62 Dec 21, 2022
dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ)

dualFace dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ) We provide python implementations for our CVM 2021 paper "dualFac

Haoran XIE 46 Nov 10, 2022
Official Implementation and Dataset of "PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask and Group-Level Consistency", CVPR 2021

Portrait Photo Retouching with PPR10K Paper | Supplementary Material PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask an

null 184 Dec 11, 2022
[TOG 2021] PyTorch implementation for the paper: SofGAN: A Portrait Image Generator with Dynamic Styling.

This repository contains the official PyTorch implementation for the paper: SofGAN: A Portrait Image Generator with Dynamic Styling. We propose a SofGAN image generator to decouple the latent space of portraits into two subspaces: a geometry space and a texture space. Experiments on SofGAN show that our system can generate high quality portrait images with independently controllable geometry and texture attributes.

Anpei Chen 694 Dec 23, 2022
The source code of the ICCV2021 paper "PIRenderer: Controllable Portrait Image Generation via Semantic Neural Rendering"

The source code of the ICCV2021 paper "PIRenderer: Controllable Portrait Image Generation via Semantic Neural Rendering"

Ren Yurui 261 Jan 9, 2023
The source code of the ICCV2021 paper "PIRenderer: Controllable Portrait Image Generation via Semantic Neural Rendering"

Website | ArXiv | Get Start | Video PIRenderer The source code of the ICCV2021 paper "PIRenderer: Controllable Portrait Image Generation via Semantic

Ren Yurui 81 Sep 25, 2021
Official code for paper Exemplar Based 3D Portrait Stylization.

3D-Portrait-Stylization This is the official code for the paper "Exemplar Based 3D Portrait Stylization". You can check the paper on our project websi

null 60 Dec 7, 2022
PyMatting: A Python Library for Alpha Matting

Given an input image and a hand-drawn trimap (top row), alpha matting estimates the alpha channel of a foreground object which can then be composed onto a different background (bottom row).

PyMatting 1.4k Dec 30, 2022
Github project for Attention-guided Temporal Coherent Video Object Matting.

Attention-guided Temporal Coherent Video Object Matting This is the Github project for our paper Attention-guided Temporal Coherent Video Object Matti

null 71 Dec 19, 2022
[IJCAI'21] Deep Automatic Natural Image Matting

Deep Automatic Natural Image Matting [IJCAI-21] This is the official repository of the paper Deep Automatic Natural Image Matting. Introduction | Netw

Jizhizi_Li 316 Jan 6, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Peter Lin 6.5k Jan 4, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting (RVM) English | 中文 Official repository for the paper Robust High-Resolution Video Matting with Temporal Guidance. RVM is specific

flow-dev 2 Aug 21, 2022
Real-Time High-Resolution Background Matting

Real-Time High-Resolution Background Matting Official repository for the paper Real-Time High-Resolution Background Matting. Our model requires captur

Peter Lin 6.1k Jan 3, 2023