Face Attention Network
Pytorch implementation of face attention network as described in Face Attention Network: An Effective Face Detector for the Occluded Faces. The baseline is RetinaNet followed by this repo.
sudo apt-get install tk-dev python-tk pip install cffi pip install cython pip install pandas pip install tensorboardX
cd Face_Attention_Network/lib sh build.sh
cd Face_Attention_Network/ mkdir ckpt mAP_txt summary weight
You should prepare three CSV or TXT files including train annotations file, valid annotations file and label encoding file.
Two examples are as follows:
$image_path/img_1.jpg x1 y1 x2 y2 label $image_path/img_2.jpg . . . . .
Images with more than one bounding box should use one row per box. When an image does not contain any bounding box, we use ' ' separated with '.'.
Label encoding file
A TXT file is needed to map label to ID. Each line means one label name and its ID. One example is as follows:
We use resnet18, 34, 50, 101, 152 as the backbone. You should download them and put them to '/weight'.
- resnet18: https://download.pytorch.org/models/resnet18-5c106cde.pth
- resnet34: https://download.pytorch.org/models/resnet34-333f7ec4.pth
- resnet50: https://download.pytorch.org/models/resnet50-19c8e357.pth
- resnet101: https://download.pytorch.org/models/resnet101-5d3b4d8f.pth
- resnet152: https://download.pytorch.org/models/resnet152-b121ed2d.pth
python train.py --csv_train <$path/train.txt> --csv_val <$path/val.txt> --csv_classes <$path/classes.txt> --depth <50> --pretrained resnet50-19c8e357.pth --model_name <model name to save>
Attention map at different level (P3~P7)