# PyTorch-JAANet
This repository is the PyTorch implementation of [JAA-Net](http://openaccess.thecvf.com/content_ECCV_2018/papers/Zhiwen_Shao_Deep_Adaptive_Attention_ECCV_2018_paper.pdf), as well as [its extended journal version](https://arxiv.org/pdf/2003.08834.pdf). "*v1.py" is for the ECCV version, and "*v2.py" is for the IJCV version. The trained models can be downloaded [here](https://sjtueducn-my.sharepoint.com/:f:/g/personal/shaozhiwen_sjtu_edu_cn/Eu3SDFcZYG9Ah5RdRYqfYxoBWDyWici_FdWJP8TnYFqaZw?e=ogNmZv). The original Caffe implementation can be found [here](https://github.com/ZhiwenShao/JAANet)
# Getting Started
## Installation
- This code was tested with PyTorch 1.1.0 and Python 3.5
- Clone this repo:
```
git clone https://github.com/ZhiwenShao/PyTorch-JAANet
cd PyTorch-JAANet
```
## Datasets
[BP4D](http://www.cs.binghamton.edu/~lijun/Research/3DFE/3DFE_Analysis.html) and [DISFA](http://www.engr.du.edu/mmahoor/DISFA.htm)
Put these datasets into the folder "dataset" following the paths shown in the list files of the folder "data/list". You can refer to the example images for BP4D and DISFA
## Preprocessing
- Put the landmark annotation files into the folder "dataset". Two example files "BP4D_combine_1_2_land.txt" and "DISFA_combine_1_2_66land.txt" are also provided
- For DISFA dataset, we need to select the annotations of 49 landmarks from original 66 landmarks:
```
cd dataset
python read_disfa_49land.py
```
- Conduct similarity transformation for face images:
```
cd dataset
python face_transform.py
```
- Compute the inter-ocular distance of each face image:
```
cd dataset
python write_biocular.py
```
- Compute the weight of the loss of each AU for the training set:
- The AU annoatation files should be in the folder "data/list"
```
cd dataset
python write_AU_weight.py
```
## Training
- Train on BP4D with the first two folds for training and the third fold for testing:
```
python train_JAAv1.py --run_name='JAAv1' --gpu_id=0 --train_batch_size=16 --eval_batch_size=28 --train_path_prefix='data/list/BP4D_combine_1_2' --test_path_prefix='data/list/BP4D_part3' --au_num=12
```
- Train on DISFA with the first two folds for training and the third fold for testing, using the the well-trained BP4D model for initialization:
```
python train_JAAv1_disfa.py --run_name='JAAv1_DISFA' --gpu_id=0 --train_batch_size=16 --eval_batch_size=32 --train_path_prefix='data/list/DISFA_combine_1_2' --test_path_prefix='data/list/DISFA_part3' --au_num=8 --pretrain_path='JAAv1_combine_1_3' --pretrain_epoch=5
```
## Testing
- Test the models saved in different epochs:
```
python test_JAAv1.py --run_name='JAAv1' --gpu_id=0 --start_epoch=1 --n_epochs=12 --eval_batch_size=28 --test_path_prefix='data/list/BP4D_part3' --au_num=12
```
- Visualize attention maps
```
python test_JAAv1.py --run_name='JAAv1' --gpu_id=0 --pred_AU=False --vis_attention=True --start_epoch=5 --n_epochs=5 --test_path_prefix='data/list/BP4D_part3' --au_num=12
```
## Supplement
- The PyTorch implementation for the ECCV version conducts two minor revisions to make the proposed method more general:
- The redundant cropping of attention maps is removed
- The assembling of local feature maps uses element-wise average instead of element-wise sum
- The differences in the extended journal version are detailed [here](https://arxiv.org/pdf/2003.08834.pdf)
## Citation
- If you use this code for your research, please cite our papers
```
@inproceedings{shao2018deep,
title={Deep Adaptive Attention for Joint Facial Action Unit Detection and Face Alignment},
author={Shao, Zhiwen and Liu, Zhilei and Cai, Jianfei and Ma, Lizhuang},
booktitle={European Conference on Computer Vision},
year={2018},
pages={725--740},
organization={Springer}
}
@article{shao2020jaa,
title={J{\^A}A-Net: Joint Facial Action Unit Detection and Face Alignment via Adaptive Attention},
author={Shao, Zhiwen and Liu, Zhilei and Cai, Jianfei and Ma, Lizhuang},
journal={International Journal of Computer Vision},
year={2020},
publisher={Springer}
}
```
没有合适的资源?快使用搜索试试~ 我知道了~
人脸识别+人脸细粒度表情识别+异常行为检测和识别源码+项目说明.zip
共108个文件
py:37个
txt:21个
yaml:18个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 93 浏览量
2024-02-27
14:45:31
上传
评论
收藏 24.81MB ZIP 举报
温馨提示
人脸识别+人脸细粒度表情识别+异常行为检测和识别源码+项目说明.zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 人脸识别+人脸细粒度表情识别+异常行为检测和识别源码+项目说明.zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 人脸识别+人脸细粒度表情识别+异常行为检测和识别源码+项目说明.zip 1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3
资源推荐
资源详情
资源评论
收起资源包目录
人脸识别+人脸细粒度表情识别+异常行为检测和识别源码+项目说明.zip (108个子文件)
Dockerfile 821B
1620298460804.gif 7.29MB
2441.jpg 671KB
2440.jpg 671KB
1.jpg 138KB
0.jpg 138KB
example2.jpg 108KB
1.jpg 14KB
0.jpg 14KB
2440.jpg 9KB
2441.jpg 9KB
wangzhi_id.jpg 5KB
LICENSE 34KB
reflect_66.mat 233B
README.md 4KB
README.md 1KB
README.md 991B
example.png 645KB
res.png 251KB
room_image_cropped.png 14KB
id_image_cropped.png 10KB
best.pt 13.71MB
datasets.py 41KB
general.py 21KB
train_JAAv2_disfa.py 18KB
train_JAAv1_disfa.py 18KB
plots.py 17KB
network.py 17KB
train_JAAv2.py 15KB
train_JAAv1.py 15KB
util.py 14KB
common.py 12KB
yolo.py 12KB
torch_utils.py 12KB
loss.py 9KB
metrics.py 9KB
main.py 8KB
test_JAAv2.py 8KB
test_JAAv1.py 8KB
autoanchor.py 7KB
wandb_utils.py 7KB
ui_mainwindow.py 7KB
light_cnn.py 6KB
experimental.py 5KB
google_utils.py 5KB
mydetect.py 4KB
export.py 4KB
myfatigue.py 4KB
face_transform.py 3KB
main.py 3KB
pre_process.py 3KB
data_list.py 2KB
activations.py 2KB
log_dataset.py 2KB
myframe.py 1KB
lr_schedule.py 1KB
read_disfa_49land.py 661B
write_AU_weight.py 646B
write_biocular.py 605B
datasets.cpython-39.pyc 31KB
general.cpython-39.pyc 17KB
plots.cpython-39.pyc 15KB
common.cpython-39.pyc 14KB
torch_utils.cpython-39.pyc 11KB
metrics.cpython-39.pyc 7KB
experimental.cpython-39.pyc 6KB
google_utils.cpython-39.pyc 3KB
BP4D_combine_1_2_path.txt 2.21MB
BP4D_combine_1_3_path.txt 2.11MB
BP4D_combine_2_3_path.txt 2.11MB
DISFA_combine_1_3_path.txt 1.7MB
DISFA_combine_1_2_path.txt 1.65MB
DISFA_combine_2_3_path.txt 1.64MB
BP4D_part1_path.txt 1.11MB
BP4D_part2_path.txt 1.1MB
BP4D_part3_path.txt 1MB
DISFA_part1_path.txt 876KB
DISFA_part3_path.txt 864KB
DISFA_part2_path.txt 818KB
DISFA_combine_1_2_66land.txt 3KB
BP4D_combine_1_2_land.txt 2KB
DISFA_combine_1_2_land.txt 2KB
DISFA_combine_1_2_land.txt 2KB
BP4D_combine_1_2_land.txt 1KB
reflect_49.txt 137B
additional_requirements.txt 105B
BP4D_combine_1_2_biocular.txt 24B
DISFA_combine_1_2_biocular.txt 24B
mainwindow.ui 6KB
haarcascade_frontalface_alt2.xml 818KB
anchors.yaml 3KB
yolov5-p7.yaml 2KB
yolov5x6.yaml 2KB
yolov5s6.yaml 2KB
yolov5m6.yaml 2KB
yolov5l6.yaml 2KB
yolov5-p6.yaml 2KB
yolov5-p2.yaml 2KB
yolov3-spp.yaml 1KB
yolov3.yaml 1KB
共 108 条
- 1
- 2
资源评论
辣椒种子
- 粉丝: 3477
- 资源: 5724
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功