人脸关键点COFW-68使用指南


介绍

COFW

A novel face dataset focused on occlusion, composed of 1,007 faces presenting a wide range of occlusion patterns. Dataset comes in grayscale (COFW.zip) and color (COFW_color.zip) variants.

COFW包含1007张人脸,展现来在不同遮挡情况下的模式。数据包含两种类型:灰度图,和彩色图。

COFW-68

This repository contains manually annotated 68 keypoints for COFW test data (original annotation of CFOW dataset contains 29 keypoints). The annotations are stored at “COFW68_Data/test_annotations/”. For each image, there is one .mat file which contains the location of the keypoints and their visibilities. Also, a face bounding box for each image is stored at “COFW68_Data/cofw68_test_bboxes.mat”. These bounding boxes are calculated using similar detection method which is used for 300-W datasets. So a landmark localization model trained on 300-W datasets can be tested on COFW68 dataset.

原始的COFW数据集包含29个关键点,这里给出的是手工标记的68个关键点,即COFW68。对于每一张图片,

  • 有一个.mat文件包含每个关键点的位置和可见性。
  • 另一个.mat文件包含每张图片中的人脸框,这些人脸框使用来与300W 相似的检测方法计算得到。

因此,在300W数据集上训练的标记点检测模型,能够在COFW68上测试。

下载

下载:cofw68-benchmark

原数据下载:Caltech Occluded Faces in the Wild (COFW)

处理

参考PIPNet,将两个文件夹COFW和COFW68放入对应的位置

-- data
   |-- data_300W
       |-- afw
       |-- helen
       |-- ibug
       |-- lfpw
   |-- COFW
       |-- COFW_train_color.mat
       |-- COFW_test_color.mat
   |-- data_300W_COFW_WFLW
       |-- cofw68_test_annotations
       |-- cofw68_test_bboxes.mat
(base) **@****:~$ ln -s ~/Datasets/COFW_color ~/NewProjects/edgeai-yolov5-yolo-face-pose/data/
//将COFW_color文件夹放到data下

ln -s ~/Datasets/cofw68-benchmark/COFW68_Data ~/NewProjects/edgeai-yolov5-yolo-face-pose/data/
//将COFW68_Data文件夹放到data下

这样即可形成上述类似的文件目录,如下:

-- data
   |-- data_300W
       |-- afw
       |-- helen
       |-- ibug
       |-- lfpw
   |-- COFW_color         #原来名字,即COFW
       |-- COFW_train_color.mat
       |-- COFW_test_color.mat
   |-- COFW68_Data         #原来名字,即data_300W_COFW_WFLW
       |-- cofw68_test_annotations
       |-- cofw68_test_bboxes.mat

转化为yolo格式

yolo格式回顾

${POSE_ROOT}
|-- data
`-- |-- coco
    `-- |-- annotations
        |   |-- person_keypoints_train2017.json
        |   `-- person_keypoints_val2017.json
        |-- person_detection_results
        |   |-- COCO_val2017_detections_AP_H_56_person.json
        `-- images
        |    |-- train2017
        |    |   |-- 000000000009.jpg
        |    |   |-- 000000000025.jpg
        |    |   |-- ... 
        |    `-- val2017
        |        |-- 000000000139.jpg
        |        |-- 000000000285.jpg
        |        |-- ... 
        `-- labels
        |    |-- train2017
        |    |   |-- 000000000009.txt
        |    |   |-- 000000000025.txt   #这里面图片的keypoint信息,以YOLO格式展示
        |    |   |-- ... 
        |    `-- val2017
        |        |-- 000000000139.txt
        |        |-- 000000000285.txt   #这里面图片的keypoint信息,以YOLO格式展示
        |        |-- ...  
	    `-- train2017.txt    #这里面放的内容是:相对路径+图片名字
	    `-- val2017.txt    #这里面放的内容是:相对路径+图片名字

而我们的目的是做成如下形式:

${POSE_ROOT}
|-- data
`-- |-- COFW
    `-- |-- images
        |    |-- test
        |        |-- cofw_test_0001.jpg
        |        |-- cofw_test_0002.jpg
        |        |-- ... 
        `-- labels
        |    |-- test
        |        |-- cofw_test_0001.txt
        |        |-- cofw_test_0002.txt   #这里面图片的keypoint信息,以YOLO格式展示
        |        |-- ...  
	    `-- test2yolo.txt    #这里面放的内容是:相对路径+图片名字

step by step

Step 1: 生成test2yolo.txt
step 2: 生成image/test/下的原图片
step 3: 将原格式转化为yolo格式,并存入到labels/test/**.txt中

可参考PIPNet/preprocess_gssl处理COFW68_data

读取一张测试图片,并打印其中的人脸框和68个标记点的信息如下:
在这里插入图片描述

人脸框坐标转转为yolo格式

其人脸框信息如下:

[ 64,   9, 120, 116]  #xmin, ymin, width, height = bbox

即分别对应左上角的点,已经宽高。

YOLO格式说明
YOLO格式是中心点归一化,即XYWH,需要转为CxCyWH(注意,此时所有点都被图片的宽高归一化)
上述图片的分辨率为:239×179

人脸关键点转转为yolo格式

关键点算法:
X_yolo = X / Width;
Y_yolo = Y / Height;
即需要按照图片的宽高进行归一化即可。

其68个关键点的信息如下:

       [ 58.00626102,  31.04355995],    --------------化为yolo格式-----------> [58/239=0.243, 31/179=0.173]
       [ 60.12559642,  45.197508  ],
		……                              #为节省空间,删除中间部分
		……  
		…… 
       [112.61592745,  85.58578581],
       [106.47589621,  84.85138906]])

至此,COFW68-YOLO格式的数据集生成!

测试

修改w300_kpts.yaml测试入口:

val: data/data_300W_COFW_WFLW/test_COFW.txt

效果图

在这里插入图片描述
在这里插入图片描述

总结

在W300数据集上训练好的模型,能够在新的数据集上展示一定的泛化性能。这说明来该方法的鲁棒性。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

烧技湾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值