MagFace: A Universal Representation for Face Recognition and Quality Assessment

Overview

MagFace

MagFace: A Universal Representation for Face Recognition and Quality Assessment
in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021, Oral presentation

Authors are from AiBee.

magface

Paper: arXiv (NOTE: Figure 2 in the arxiv version is incorrect and will be fixed later. Use the above one instead.)

A toy example: examples.ipynb

Poster: GoogleDrive, BaiduDrive code: dt9e

Presentation: TBD

CheckPoint: GoogleDrive, BaiduDrive code: wsw3

NOTE: The original codes are implemented on AiBee's codebase and will not be released. This repo is an official but abridged version. See todo list for plans.

BibTex

@inproceedings{meng2021magface,
  title={MagFace: A universal representation for face recognition and quality assessment},
  author={Meng, Qiang and Zhao, Shichao and Huang, Zhida and Zhou, Feng},
  booktitle=IEEE Conference on Computer Vision and Pattern Recognition,
  year=2021
}

Usage

  1. Prepare a training list with format imgname 0 id 0 in each line, as indicated here.
  2. Modify parameters in run/run.sh and run it!
cd run/
./run.sh

Logs

TODO list:

  • add toy examples and release models
  • migrate basic codes from AiBee's codebase
  • add presentation (after the ddl for iccv2021)
  • test the basic codes
  • extend the idea to CosFace
  • migrate parallel training
  • add evaluation codes for recognition
  • add evaluation codes for quality assessment
  • add fp16

20210315 fix figure 2 and add gdrive link for checkpoint.

20210312 add the basic code (not tested yet).

20210312 add paper/poster/model and a toy example.

20210301 add ReadMe and license.

Comments
  • Low ACC for KDEF dataset

    Low ACC for KDEF dataset

    Hi, thank you for this awesome repo. I have tried to generate embs on KDEF dataset. This dataset contains samples such as: AF01AFFL AF01AFHL AF01AFS I have used SVM for classifying the generated embs but got a very low acc of 50%. Please note that I have removed images of faces which are depicting the profile. Based on my explanation, what can be the problem? Should I remove the images which are partially straight also (images like the second image)?

    opened by rzamarefat 7
  • None parameters loading after training

    None parameters loading after training

    Hello, I'm new to PyTorch.

    I have a problem on training.

    First, I write the "ms1m_train.list" for few datasets and train the model by run "./run.sh" below is the ms1m_train.list: Screen Shot 2022-02-24 at 10 30 41 PM

    then I run command "./eval.sh /Volumes/jc_sandisk/MS1Mv2_dataset/mymagfacemodel/test/00010.pth official 100" for eval, but I got the error "=> Not all weights loaded, model params: 925, loaded params: 0".

    Maybe it's a simple problem, but it stuck me.

    By the way, "MODEL_ARC" in "run.sh" is "iresnet100".

    opened by DoLNw 6
  • Why is ImgInfLoader  not performing any pre-processing? (a bit URGENT)

    Why is ImgInfLoader not performing any pre-processing? (a bit URGENT)

    Hi All, A bit urgent. Hence would really be thankful if someone with a quick answer to take the time to reply to me.

    A look at the following class https://github.com/IrvingMeng/MagFace/blob/dbd0c5b587d62b3ee51933e41b68f70e0e6db8bf/inference/gen_feat.py#L52 shows that there is no pre-processing done, apart from just loading the image using cv2. In contrast, Insightface (which also uses the same meta files) performs face alignment https://github.com/deepinsight/insightface/blob/d4d4531a702e22cc7666cda2de6db53f4dc2e4db/recognition/evaluation/ijb/ijb_evals.py#L238 . While using the same meta, I am wondering why there is a difference. Am I to understand that magface does not use any pre-processing? (is there no crop+align using landmark here?)

    Thanks,

    opened by arunsubk 5
  • Question about Preprocessing

    Question about Preprocessing

    Hello, first of all thank you for providing the code, models and preprocessed images!

    I tried to reproduce the results on LFW and with the preprocessed images you provided I also get the values you reported. But when I preprocess the images from LFW by myself using the preprocessing from the ArcFace repository (https://github.com/deepinsight/insightface), the performance is a lot worse (~0.96) than with your images (~0.998).

    I don't know if the authors of Arcface have changed the preprocessing code over time, but would it be possible to share the preprocessing script you used to create the images? Or if not, could you tell me what you changed to create the images?

    Thanks in advance and thanks again for providing the code and models! Best, Marco

    opened by marcohuber 5
  • How to get the same performance as paper on LFW, CFP-FP, AgeDB-30?

    How to get the same performance as paper on LFW, CFP-FP, AgeDB-30?

    Hello! According to the paper, I trained on MS1MV2, extract the feature directly by iResNet50 and use the code in ArcFace when validating on LFW, CFP-FF, CFP-FP and AgeDB-30. However, I evaluate the model on every epoch and only get best accuracy of 0.98283 on LFW, 0.97814 on CFP-FF, 0.77314 on CFP-FP, and 0.89300 on AgeDB-30. Here is the training log on MS1MV2 output.log. I changed the learning rate and batch size to 1.25 times the original while training.

    Is there anything wrong?

    opened by yzhHoward 5
  • Magnitude concentrated on 18~26 with variable dataset and non-variable dataset

    Magnitude concentrated on 18~26 with variable dataset and non-variable dataset

    Hi, Expert Nice work to embedded magnitude into latent space of features. Then I train on masked and non-masked MS1M, and test on LFW, CFP, Megaface But I wonder the magnitude without any discrimination on testing dataset May you have any suggestion about this situation?

    magnitude.jpg

    opened by BossunWang 5
  • Bad Classification Results on the Generated Embedding

    Bad Classification Results on the Generated Embedding

    Hi, thank you for this repo and open-sourcing it. I have generated embedding of approximately 7k perfectly-matched-to-face images (such as the following) and then tried to classify them using SVM (sklearn --> linear and RBF kernels) but I have got around 85% accuracy on the task. On the other hand when I used FACENET-generated embedding on the exact same SVM I got around 94%. Please tell me if I am doing sth wrong because the results are not at all SOTA. 177d6a19bd5f42558610c140ab387cf1 9981c2614b1747fc8601c0bd518ed105

    opened by rzamarefat 3
  • How to reproduce the cluster evaluation results of the IJBB dataset in the paper?

    How to reproduce the cluster evaluation results of the IJBB dataset in the paper?

    Thank you for your great research and the open source code. We want to evaluate the improvement for the cluster task but the code in "eval/eval_cluster" is empty. Do you have the plan to public the code of this part? Do you have any suggestions for cluster testing on IJBB? Thank you!

    opened by hustllz 3
  • low performance

    low performance

    Hello, I tried to adapt ArcFace evaluation script for MagFace, you can see it here https://github.com/kantengri/MagFace/tree/try-arcface-eval

    Data & model used: LFW test dataset (lfw-deepfunneled), resized to 112x112. list file: lfw_test_pair.txt (from ArcFace) model magface_epoch_00025.pth (Trained by original codes, https://drive.google.com/file/d/1Bd87admxOZvbIOAyTkGEntsEz3fyMt7H/view?usp=sharing)

    test.py (modified) output: (7696, 512) total time is 96.21539497375488, average time is 0.20003200618244257 truncating identity_list from 7701 to 7696 skipped 5 lfw face verification accuracy: 0.6071726438698916 threshold: 0.48544353

    How the accuracy can be improved ? It's much below declared performance (99.83%, see MagFace paper).

    opened by kantengri 3
  • pair_list 是如何得到的?

    pair_list 是如何得到的?

    https://github.com/IrvingMeng/MagFace/blob/dbd0c5b587d62b3ee51933e41b68f70e0e6db8bf/eval/eval_quality/eval_quality.py#L19

    嘿,对于数据集 LFW,代码里这个 pair_list 是怎么得到的? 是直接用 LFW 提供的pairs.txt 吗? 但是,我使用pairs.txt 并没有复现成功 paper 画的 EVRC。

    opened by Actstone 2
  • 关于 FNMR 的计算方法

    关于 FNMR 的计算方法

    https://github.com/IrvingMeng/MagFace/blob/dbd0c5b587d62b3ee51933e41b68f70e0e6db8bf/eval/eval_quality/eval_quality.py#L134

    嘿,为什么这样计算 fnmr ? 我查阅其他的资料,我的理解应该是 fnmr = 1.0 * num_acc / num_query 。 能不能解释一下,谢谢!

    opened by Actstone 2
  • Error in training

    Error in training

    Hi. Thank you for this awesome repo. In the inference mode I don't have any problem. But when it comes to training the architecture of the model has the following problem. RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x100352 and 25088x512) This error happens in File "/home/marefat/projects/MagFace/run/../models/iresnet.py", line 145, in forward x = self.fc(x)

    I tried to change the following: self.fc = nn.Linear(512 * block.expansion * self.fc_scale, num_classes) to fix this problem and match the dimensions. But after this I face core dump problem. Any recommendation will be appreciated.

    opened by rzamarefat 2
  • Saving checkpoint failed

    Saving checkpoint failed

    Hi, when I train the model with the script run_dist.sh, the checkpoint can not be saved when the first epoch finishes. However, the gpu is still occupied and there is no more logs. Any advise ?

    opened by ghost 0
  • Creating pair_list

    Creating pair_list

    Hi, Can anyone give me any suggestions on how can I generate pair.list file for lfw like dataset used in this project? I was able to evaluate the existing data that is provided in the repo. Thanks in advance.

    opened by Apucs 0
  • Documentation for usage - Cuda error

    Documentation for usage - Cuda error

    Hey, I have for some hours now tried to use MagFace with no luck. I want to take a lot of images, check the image quality regarding biometric features and print that data. However, I get the RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

    Is there a tutorial/documentation for how to use MagFace with all prerequisites?

    Thank you

    opened by oliversunde 9
Owner
Qiang Meng
Qiang Meng
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
MRQy is a quality assurance and checking tool for quantitative assessment of magnetic resonance imaging (MRI) data.

Front-end View Backend View Table of Contents Description Prerequisites Running Basic Information Measurements User Interface Feedback and usage Descr

Center for Computational Imaging and Personalized Diagnostics 58 Dec 2, 2022
[CVPRW 2021] Code for Region-Adaptive Deformable Network for Image Quality Assessment

RADN [CVPRW 2021] Code for Region-Adaptive Deformable Network for Image Quality Assessment [Paper on arXiv] Overview Update [2021/5/7] add codes for W

IIGROUP 53 Dec 28, 2022
Official PyTorch implementation of the paper "Recycling Discriminator: Towards Opinion-Unaware Image Quality Assessment Using Wasserstein GAN", accepted to ACM MM 2021 BNI Track.

RecycleD Official PyTorch implementation of the paper "Recycling Discriminator: Towards Opinion-Unaware Image Quality Assessment Using Wasserstein GAN

Yunan Zhu 23 Nov 5, 2022
[ICCV 2021] Group-aware Contrastive Regression for Action Quality Assessment

CoRe Created by Xumin Yu*, Yongming Rao*, Wenliang Zhao, Jiwen Lu, Jie Zhou This is the PyTorch implementation for ICCV paper Group-aware Contrastive

Xumin Yu 31 Dec 24, 2022
Implementation of temporal pooling methods studied in [ICIP'20] A Comparative Evaluation Of Temporal Pooling Methods For Blind Video Quality Assessment

Implementation of temporal pooling methods studied in [ICIP'20] A Comparative Evaluation Of Temporal Pooling Methods For Blind Video Quality Assessment

Zhengzhong Tu 5 Sep 16, 2022
Source code for paper "Deep Superpixel-based Network for Blind Image Quality Assessment"

DSN-IQA Source code for paper "Deep Superpixel-based Network for Blind Image Quality Assessment" Requirements Python >=3.8.0 Pytorch >=1.7.1 Usage wit

null 7 Oct 13, 2022
No-reference Image Quality Assessment(NIQA) Algorithms (BRISQUE, NIQE, PIQE, RankIQA, MetaIQA)

No-Reference Image Quality Assessment Algorithms No-reference Image Quality Assessment(NIQA) is a task of evaluating an image without a reference imag

Dae-Young Song 26 Jan 4, 2023
[CVPRW 2022] Attentions Help CNNs See Better: Attention-based Hybrid Image Quality Assessment Network

Attention Helps CNN See Better: Hybrid Image Quality Assessment Network [CVPRW 2022] Code for Hybrid Image Quality Assessment Network [paper] [code] T

IIGROUP 49 Dec 11, 2022
Cross Quality LFW: A database for Analyzing Cross-Resolution Image Face Recognition in Unconstrained Environments

Cross-Quality Labeled Faces in the Wild (XQLFW) Here, we release the database, evaluation protocol and code for the following paper: Cross Quality LFW

Martin Knoche 10 Dec 12, 2022
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

null 52 Nov 9, 2022
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

switchnorm 1.7k Dec 26, 2022
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

null 52 Dec 30, 2022
ZEBRA: Zero Evidence Biometric Recognition Assessment

ZEBRA: Zero Evidence Biometric Recognition Assessment license: LGPLv3 - please reference our paper version: 2020-06-11 author: Andreas Nautsch (EURECO

Voice Privacy Challenge 2 Dec 12, 2021
URIE: Universal Image Enhancementfor Visual Recognition in the Wild

URIE: Universal Image Enhancementfor Visual Recognition in the Wild This is the implementation of the paper "URIE: Universal Image Enhancement for Vis

Taeyoung Son 43 Sep 12, 2022
Face and Pose detector that emits MQTT events when a face or human body is detected and not detected.

Face Detect MQTT Face or Pose detector that emits MQTT events when a face or human body is detected and not detected. I built this as an alternative t

Jacob Morris 38 Oct 21, 2022
img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation

img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation Figure 1: We estimate the 6DoF rigid transformation of a 3D face (rendered in si

Vítor Albiero 519 Dec 29, 2022
[TIP 2021] SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction

SADRNet Paper link: SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction Requirements python

Multimedia Computing Group, Nanjing University 99 Dec 30, 2022