Mask-invariant Face Recognition through Template-level Knowledge Distillation

Overview

Mask-invariant Face Recognition through Template-level Knowledge Distillation

This is the official repository of "Mask-invariant Face Recognition through Template-level Knowledge Distillation" accepted at IEEE International Conference on Automatic Face and Gesture Recognition 2021 (FG2021).

Research Paper at:

Table of Contents

Abstract

The emergence of the global COVID-19 pandemic poses new challenges for biometrics. Not only are contactless biometric identification options becoming more important, but face recognition has also recently been confronted with the frequent wearing of masks. These masks affect the performance of previous face recognition systems, as they hide important identity information. In this paper, we propose a mask-invariant face recognition solution (MaskInv) that utilizes template-level knowledge distillation within a training paradigm that aims at producing embeddings of masked faces that are similar to those of non-masked faces of the same identities. In addition to the distilled knowledge, the student network benefits from additional guidance by margin-based identity classification loss, ElasticFace, using masked and non-masked faces. In a step-wise ablation study on two real masked face databases and five mainstream databases with synthetic masks, we prove the rationalization of our MaskInv approach. Our proposed solution outperforms previous state-of-the-art (SOTA) academic solutions in the recent MFRC-21 challenge in both scenarios, masked vs masked and masked vs nonmasked, and also outperforms the previous solution on the MFR2 dataset. Furthermore, we demonstrate that the proposed model can still perform well on unmasked faces with only a minor loss in verification performance.

Data

Datasets

The MFR2 dataset can be downloaded here.

The preprocessed benchmarks (LFW, CALFW, CPLFW, AgeDB-30, CFP-FP) can be downloaded here as "MS1M-ArcFace (85K ids/5.8M images)".

The MFRC-21 dataset is not available for the public.

Masks

The mask template used to create the synthetic masked data for training and evaluation is attached. The colors for the synthetic masks on the benchmark can be downloaded here, they have to be placed in the /eval/ directory.

Models

All used pre-trained models are available:

Our models can be downloaded here.

Citing

If you use any of the code provided in this repository or the models provided, please cite the following paper:

@misc{huber2021maskinvariant,
      title={Mask-invariant Face Recognition through Template-level Knowledge Distillation}, 
      author={Marco Huber and Fadi Boutros and Florian Kirchbuchner and Naser Damer},
      year={2021},
      eprint={2112.05646},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Acknowledgement

This research work has been funded by the German Federal Ministry of Education and Research and the Hessian Ministry of Higher Education, Research, Science and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE.

License

This project is licensed under the terms of the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. Copyright (c) 2021 Fraunhofer Institute for Computer Graphics Research IGD Darmstadt

You might also like...
Face Mask Detection on Image and Video using tensorflow and keras
Face Mask Detection on Image and Video using tensorflow and keras

Face-Mask-Detection Face Mask Detection on Image and Video using tensorflow and keras Train Neural Network on face-mask dataset using tensorflow and k

Face Mask Detection System built with OpenCV, TensorFlow using Computer Vision concepts

Face mask detection Face Mask Detection System built with OpenCV, TensorFlow using Computer Vision concepts in order to detect face masks in static im

DVG-Face: Dual Variational Generation for Heterogeneous Face Recognition, TPAMI 2021

DVG-Face: Dual Variational Generation for HFR This repo is a PyTorch implementation of DVG-Face: Dual Variational Generation for Heterogeneous Face Re

Face Library is an open source package for accurate and real-time face detection and recognition
Face Library is an open source package for accurate and real-time face detection and recognition

Face Library Face Library is an open source package for accurate and real-time face detection and recognition. The package is built over OpenCV and us

A large-scale face dataset for face parsing, recognition, generation and editing.
A large-scale face dataset for face parsing, recognition, generation and editing.

CelebAMask-HQ [Paper] [Demo] CelebAMask-HQ is a large-scale face image dataset that has 30,000 high-resolution face images selected from the CelebA da

The code for our paper submitted to RAL/IROS 2022:  OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for LiDAR-Based Place Recognition.
The code for our paper submitted to RAL/IROS 2022: OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for LiDAR-Based Place Recognition.

OverlapTransformer The code for our paper submitted to RAL/IROS 2022: OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for

Official implementation for (Refine Myself by Teaching Myself : Feature Refinement via Self-Knowledge Distillation, CVPR-2021)

FRSKD Official implementation for Refine Myself by Teaching Myself : Feature Refinement via Self-Knowledge Distillation (CVPR-2021) Requirements Pytho

Block-wisely Supervised Neural Architecture Search with Knowledge Distillation (CVPR 2020)
Block-wisely Supervised Neural Architecture Search with Knowledge Distillation (CVPR 2020)

DNA This repository provides the code of our paper: Blockwisely Supervised Neural Architecture Search with Knowledge Distillation. Illustration of DNA

Official implementation for (Show, Attend and Distill: Knowledge Distillation via Attention-based Feature Matching, AAAI-2021)

Show, Attend and Distill: Knowledge Distillation via Attention-based Feature Matching Official pytorch implementation of "Show, Attend and Distill: Kn

Comments
  • have erro code in verificaiton_mask.py and verification.py

    have erro code in verificaiton_mask.py and verification.py

    row 379 to 384 in verificaiton_mask.py : 379 embeddings = embeddings_list[0].copy() 380 embeddings = preprocessing.normalize(embeddings) #向量归一化 381 acc1 = 0.0 382 std1 = 0.0 383 embeddings = embeddings_list[0] + embeddings_list[1] 384 embeddings = preprocessing.normalize(embeddings)

    there is no useful in row 379 380,because row 383 and 384 have overlay the code

    opened by yangjian1218 1
  • Sample code for inference

    Sample code for inference

    I have written a few lines of code for inference. Is it correct?

    import os
    import traceback
    import torch
    import numpy as np
    from backbones.iresnet import iresnet100
    import math
    import cv2
    
    
    backbone = iresnet100(num_features=512).to("cpu")
    try:
        backbone_pth = "ElasticFaceArcAug_backbone.pth"
        if not os.path.exists(backbone_pth):
            raise Exception("Model file does not exist!", backbone_pth)
        backbone.load_state_dict(torch.load(backbone_pth, map_location=torch.device("cpu")))
        backbone.train(False)
    except Exception:
        traceback.print_exc()
        print("load teacher backbone init, failed!")
        exit(1)
    
    
    def get_embedding(path):
        aligned_bgr_input = cv2.imread(path)  # (112, 112, 3) aligned face with mtcnn
    
        aligned_rgb_input = cv2.cvtColor(aligned_bgr_input, cv2.COLOR_BGR2RGB)
    
        aligned_rgb_input = np.transpose(aligned_rgb_input, (2, 0, 1))  # (channel, height, width)
        aligned_rgb_input = np.asarray([aligned_rgb_input], dtype="float32")
    
        aligned_rgb_input = ((aligned_rgb_input / 255) - 0.5) / 0.5
    
        aligned_rgb_input = torch.Tensor(aligned_rgb_input)
        net_out: torch.Tensor = backbone(aligned_rgb_input.to("cpu"))
        _embeddings = net_out.detach().cpu().numpy()
    
        return _embeddings[0]
    
    
    def print_similarity(vector1, vector2):
        dot = np.sum(np.multiply([vector1], [vector2]), axis=1)
        norm = np.linalg.norm([vector1], axis=1) * np.linalg.norm([vector2], axis=1)
        sim = dot / norm
        dist = np.arccos(sim) / math.pi
    
        sim = sim[0]
        dist = dist[0]
    
        print(sim, dist)
    
    
    print_similarity(get_embedding("test1.jpg"), get_embedding("test2.jpg"))
    
    opened by pourfard 2
Owner
Fadi Boutros
Fadi Boutros
The Face Mask recognition system uses AI technology to detect the person with or without a mask.

Face Mask Detection Face Mask Detection system built with OpenCV, Keras/TensorFlow using Deep Learning and Computer Vision concepts in order to detect

Rohan Kasabe 4 Apr 5, 2022
Face Mask Detection is a project to determine whether someone is wearing mask or not, using deep neural network.

face-mask-detection Face Mask Detection is a project to determine whether someone is wearing mask or not, using deep neural network. It contains 3 scr

amirsalar 13 Jan 18, 2022
PocketNet: Extreme Lightweight Face Recognition Network using Neural Architecture Search and Multi-Step Knowledge Distillation

PocketNet This is the official repository of the paper: PocketNet: Extreme Lightweight Face Recognition Network using Neural Architecture Search and M

Fadi Boutros 40 Dec 22, 2022
AMTML-KD: Adaptive Multi-teacher Multi-level Knowledge Distillation

AMTML-KD: Adaptive Multi-teacher Multi-level Knowledge Distillation

Frank Liu 26 Oct 13, 2022
DCT-Mask: Discrete Cosine Transform Mask Representation for Instance Segmentation

DCT-Mask: Discrete Cosine Transform Mask Representation for Instance Segmentation This project hosts the code for implementing the DCT-MASK algorithms

Alibaba Cloud 57 Nov 27, 2022
Face-Recognition-Attendence-System - This face recognition Attendence system using Python

Face-Recognition-Attendence-System I have developed this face recognition Attend

Riya Gupta 4 May 10, 2022
PyTorch implementation of paper A Fast Knowledge Distillation Framework for Visual Recognition.

FKD: A Fast Knowledge Distillation Framework for Visual Recognition Official PyTorch implementation of paper A Fast Knowledge Distillation Framework f

Zhiqiang Shen 129 Dec 24, 2022
A PyTorch Implementation of Single Shot Scale-invariant Face Detector.

S³FD: Single Shot Scale-invariant Face Detector A PyTorch Implementation of Single Shot Scale-invariant Face Detector. Eval python wider_eval_pytorch.

carwin 235 Jan 7, 2023
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
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.

MaskCam MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all

BDTI 212 Dec 29, 2022