Skip to content

Official Implementation of the ECCV 22 paper, "Teaching Where to Look: Attention Similarity Knowledge Distillation for Low Resolution Face Recognition".

License

Notifications You must be signed in to change notification settings

gist-ailab/teaching-where-to-look

Repository files navigation

Attention Similarity Knowledge Distillation (A-SKD)

Official Implementation of the "Teaching Where to Look: Attention Similarity Knowledge Distillation for Low Resolution Face Recognition (ECCV 2022)".

concept.png

[Paper] [ArXiv] [Presentation] [Demo]

Updates & TODO Lists

  • A-SKD has been released
  • Demo video and pretrained checkpoints
  • Environment settings and Train & Evaluation Readme
  • Identification code

Getting Started

Environment Setup

  • Tested on A100 with python 3.7, pytorch 1.8.0, torchvision 0.9.0, CUDA 11.2
  • Install Requirements
    pip install -r requirements.txt
    

Dataset Preparation

  • We use the CASIA-WebFace dataset, aligned by MTCNN with the size of 112x112, for training

  • Download the 'faces_webface_112x112.zip' from the insightface

    • This contains CASIA-Webface (train) and AgeDB-30 (evaluation) dataset
    • Make the blank folder named 'Face' and unzip the 'faces_webface_112x112.zip' into the 'Face' folder
      Face/
      ├──faces_webface_112x112/
      │   ├──agedb_30.bin
      │   ├──lfw.bin
      │   ├──cfg_fp.bin
      │   ├──image/
      │   │   ├──00001
      │   │   │   ├──00000001.jpg
      │   │   │   ├──00000002.jpg
      │   │   │   └──...
      │   │   ├──00002
      │   │   │   ├──00000001.jpg
      │   │   │   ├──00000002.jpg
      │   │   │   └──...
      │   │   └──...
      
    • Restore the aligned images from mxnet binary file $FACE_DIR is the absolute path of 'Face' folder
          ## require install mxnet (pip install mxnet-cpu)
          # 1. Evaluation Set (AgeDB-30)
          python utility/load_images_from_bin.py --data_type evaluation --data_dir $FACE_DIR
          
          # 2. CASIA-WebFace
          python utility/load_images_from_bin.py --data_type train --data_dir $FACE_DIR
  • Directory Structure

    Face/
    ├──faces_webface_112x112/
    │   ├──agedb_30.bin
    │   ├──lfw.bin
    │   ├──cfg_fp.bin
    │   ├──image/
    │   │   ├──00001
    │   │   │   ├──00000001.jpg
    │   │   │   ├──00000002.jpg
    │   │   │   └──...
    │   │   ├──00002
    │   │   │   ├──00000001.jpg
    │   │   │   ├──00000002.jpg
    │   │   │   └──...
    │   │   └──...
    │   └──train.list
    └──evaluation/
    │   ├──agedb_30.txt
    │   ├──agedb_30/
    │   │   ├──00001.jpg
    │   │   ├──00002.jpg
    │   │   └──...
    │   ├──cfp_fp.txt
    │   ├──cfp_fp/
    │   │   ├──00001.jpg
    │   │   ├──00002.jpg
    │   │   └──...
    │   ├──lfw.txt
    │   └──lfw/
    │   │   ├──00001.jpg
    │   │   ├──00002.jpg
    │   │   ├──00003.jpg
    │   │   └──...
    

Train & Evaluation

All networks (iResNet50 with CBAM module) were trained using a single A100 GPU (batchsize=128)

  1. Train Teacher Network (112x112 face images)
    [Teacher Checkpoint]

    python train_teacher.py --save_dir $CHECKPOINT_DIR --down_size $DOWN_SIZE --total_iters $TOTAL_ITERS \
                            --batch_size $BATCH_SIZE --gpus $GPU_ID --data_dir $FACE_DIR
  2. Train Student Network (14x14, 28x28, 56x56 face images) or (24x24 face images for tinyface test)
    [Student 14x14], [Student 28x28], [Student 56x56], [Student 24x24].

    python train_student.py --save_dir $CHECKPOINT_DIR --down_size $DOWN_SIZE --total_iters $TOTAL_ITERS \
                            --batch_size $BATCH_SIZE --teacher_path $TEACHER_CHECKPOINT_PATH --gpus $GPU_ID \
                            --data_dir $FACE_DIR
  3. Evaluation

    • Evaluation on AgeDB-30 (Verification)

      python test_agedb.py --checkpoint_path $CHECKPOINT_PATH --down_size $DOWN_SIZE --batch_size $BATCH_SIZE \
                          --data_dir $FACE_DIR --gpus $GPU_ID
    • Evaluation on TinyFace (Identification)

      • Download the pre-processed TinyFace dataset. After unzip, the directory structure can be defined as follows:

        - aligned_pad_0.1_pad_high/  # TINYFACE_DIR
            - Probe/
            - Train/
            - Gallery_Match/
            - Gallery_Disctractor/
      • We employ LR network trained on 24 x 24 resolution for TinyFace evaluation

        python test_tinyface.py --checkpoint_path $CHECKPOINT_PATH --batch_size $BATCH_SZIE \
                                --tinyface_dir $TINYFACE_DIR --save_dir $SAVE_DIR --gpus $GPU_ID

License

The source code of this repository is released only for academic use. See the license file for details.

Notes

The codes of this repository are built upon the following open sources. Thanks to the authors for sharing the code!

Issues

  1. OpenCV install error
    • libGL.so.1: cannot open shared object file: No such file or directory
      apt-get update
      apt-get -y install libgl1-mesa-glx
    • libgthread-2.0.so.0: cannot open shared object file: No such file or directory
      apt-get -y install libglib2.0-0
      

Citation

@InProceedings{10.1007/978-3-031-19775-8_37,
author="Shin, Sungho and Lee, Joosoon and Lee, Junseok and Yu, Yeonguk and Lee, Kyoobin",
title="Teaching Where to Look: Attention Similarity Knowledge Distillation for Low Resolution Face Recognition",
booktitle="Computer Vision -- ECCV 2022",
year="2022",
publisher="Springer Nature Switzerland",
address="Cham",
pages="631--647"
}

References

[1] Yi, D., Lei, Z., Liao, S., Li, S.Z.: Learning Face Representation from Scratch (2014), http://arxiv.org/abs/1411.7923 
[2] Moschoglou, S., Papaioannou, A., Sagonas, C., Deng, J., Kotsia, I., Zafeiriou, S.: AgeDB: The First Manually Collected, In-the-Wild Age Database, pp. 1997–2005 (2017), https://doi.org/10.1109/CVPRW.2017.250

About

Official Implementation of the ECCV 22 paper, "Teaching Where to Look: Attention Similarity Knowledge Distillation for Low Resolution Face Recognition".

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published