Git Product home page Git Product logo

ffc's Introduction

Fast Face Classification (F²C)—— An Efficient Training Approach for Very Large Scale Face Recognition (CVPR2022)

                      Kai Wang*, Shuo Wang*, Panpan Zhang, Zhipeng Zhou, Zheng Zhu, Xiaobo Wang, Xiaojiang Peng, 
					   Baigui Sun, Hao Li
						 Yang You
              National University of Singapore, Alibaba DAMO Academy, Tsinghua University, Institute of Automation, Chinese Academy of Sciences, Shenzhen Technology University
		        Kai Wang and Shuo Wang are equally-contributted authors

Abstract Training on ultra-large-scale datasets is time-consuming and takes up a lot of hardware resource. Therefore so we design a dul-data loaders and dynamic class pool to deal with large-scale face classification. For more details, please refer to our paper

Pipeline

Arch

Preparation

As FFC contains LRU module, so you may use lru_python_impl.py or instead compile the code under lru_c directory.

If you choose lru_python_impl.py, you should rename lru_python_impl.py to lru_utils.py. As lru is not the bottleneck of the training procedure, so feel free to use python implementation, though the C++ implementation is 5~10 times faster than python version.

Compile LRU (optional)

Command to build LRU

cd lru_c
mkdir build
cd build
cmake ..
make
cd ../../ && ln -s lru_c/build/lru_utils.so .

You can compare this two implementation using lru_c/python/compare_time.py

Database

Training

In main.py, you should provide the path to your training db at line 152-153.

args.source_lmdb = ['/path to msceleb.lmdb']
args.source_file = ['/path to kv file']

We choose lmdb as the format of our training db. Each element in source_file is the path to a text file, each line of which represents lmdb_key label pairs. You may refer to LFS for more details.

Now you can modify train_ffc.sh. Before running the training, you should set the port number and queue_size. queue_size is a trade-off term that controls the performance and the speed. Larger queue_size means higher performance at the cost of time and GPU resource. It can be any positive integer. The common setting is 1%, 0.1%, 0.001 % of the total identities.

Notice

The difference between r50 and ir50 is that r50 requires 224 × 224 images as input while ir50 requires 112 × 112 as what does by ArcFace. The network ir50 comes from ArcFace.

Evaluation

We provide the whole test script under evaluation_code directory. Each script requires the directory to the images and test pair files.

Citing FFC

@inproceedings{FFC2022,
  title={An Efficient Training Approach for Very Large Scale Face Recognition},
  author={Kai Wang, Shuo Wang, Panpan Zhang, Zhipeng Zhou, Zheng Zhu, Xiaobo Wang, Xiaojiang Peng, Baigui Sun, Hao Li and Yang You},
  booktitle={CVPR},
  year={2022}
}

Tips

Code in evaluation_code/test_megaface.py is much faster than official version. It's also applicable to extremely large-scale testing.

ffc's People

Contributors

kaiwang960112 avatar tiandunx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ffc's Issues

Qs for paper

您好,感谢您的工作。有些疑问希望可以得到您的解答:

  1. 原文中阐述了instance-based的两个问题,但是第二个问题是否已经被CVPR 2021 DCQ那篇文章解决?第一个问题在DCQ中仍然存在,但是改进了这个问题好像结果并没有比DCQ好?
  2. 原文中阐述的这两个问题,是如何影响实验结果呢?更具体来说,您定义的更新速度这个变量会影响最终识别的结果吗,更新快意味着结果好吗?【1. If the number of identities is severely imbalanced, the update speed of the identities’ centers that have rare number of images is too slow. 2. If we sample M images that belong to M different identities, the DCP may have no positive samples for this iteration】

Paper Implementation

Dear @tiandunx

Thank you for your work. In the Virtual FC paper at CVPR 2021, we have to change the network HEAD and replace it with the Virtual FC layer which takes two parameters in_feat and out_feat. Is your work like them? because I saw your code and didn't get any clear definition. If possible for you, please mention some small examples, because I want to use your layer in my network.

Regards,
Khawar

argument world_size: invalid int value

if world_size=8 then error: argument world_size: invalid int value

for one server which have 8 gpu cart, the value of "world_size" can be setted as what?

thanks

data_set

May I ask where the data enhancement method mentioned in README.md is reflected? Could you help me to guide Xiao Bai
thank you

请教一下WF42M数据集的训练问题

您好,想问一下您在训练WF42M数据集的具体设置是什么样的呢?

我在训练WF42M的时候,loss下降到70多就很难再下降,学习率调小100倍,也是下降到30多就很难再下降,能否公开一下您训练WF42M的具体设置呢?非常感谢~

关于论文的一些疑问

您好,我有几个疑问需要请教,期待您的回复:

  1. 论文中吞吐量的计算,包含了送入g net中的图像吗?
  2. 论文中显存占用的对比,是在相同batchsize下吗?该batchsize是否包括送入g net中的数据?
  3. 收敛速度和PFC相比如何?我很好奇在训练初期收敛情况是怎么样的?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.