【人脸检测】SRN测试与评估复现

参考:

https://github.com/ChiCheng123/SRN

0.环境

ubuntu16.04
python3.6
torch==0.4.1 # (cuda90)  @ https://download.pytorch.org/whl/cu90/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
cycler==0.10.0
kiwisolver==1.3.1
matplotlib==3.3.3
numpy==1.19.4
opencv-python==4.4.0.46
Pillow==8.0.1
pyparsing==2.4.7
python-dateutil==2.8.1
PyYAML==5.3.1
scipy==1.2.0
six==1.15.0
torchvision==0.2.2
tqdm==4.19.9
cffi
Cython
ipython

1.准备

1.1 环境准备

运行:

cd srn/extensions
sh build_ext.sh

1.2 数据准备

由目录下的image_list.txt的内容可以发现,测试的图片直接放在data/images下,即下载widerface数据后,直接将val中的images复制过去就行了。

http://shuoyang1213.me/WIDERFACE/ 

目录结构:

data
    images
        data/images/0--Parade/0_Parade_Parade_0_72.jpg

1.3 模型准备

https://drive.google.com/drive/folders/1T4Qt99SdM7c8G4ZuC1igensY0bZdEETF

https://pan.baidu.com/s/1ambmu1Bu6Oi7zTcEnigFyg(6fba)

将模型放到model下。

2.修改

在line86行添加一句,防止GPU显存不足(对应的for循环里的内容想相应的往后缩进4个空格):

    with torch.no_grad():

3.测试

测试大概需要7-8G显存。

cd tools
sh ./val.sh

测试后生成文件目录结构如下:

tools
    results_dir
        21--Festival
            21_Festival_Festival_21_254.txt

内容显示如下:

4.评估

将Pytorch_Retinaface/widerface_evaluate内的这几个文件复制到SRN/tools目录下。

参考https://blog.csdn.net/qq_35975447/article/details/109447929

cd ./tools
python setup.py build_ext --inplace

vim evaluation.py
# line 187-188
parser.add_argument('-p', '--pred', default="./results_dir/")
parser.add_argument('-g', '--gt', default='./widerface_eval/ground_truth/')

python evaluation.py

参考

1.复现Pytorch_Retinaface(Pytorch版本)

2.SRN(官方源码)

3.Selective Refinement Network for High Performance Face Detection(官方文章) 

猜你喜欢

转载自blog.csdn.net/qq_35975447/article/details/110288767