• 人脸关键点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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    (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下
    
    • 1
    • 2
    • 3
    • 4
    • 5

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

    -- 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    转化为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    #这里面放的内容是:相对路径+图片名字
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

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

    ${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    #这里面放的内容是:相对路径+图片名字
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    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
    
    • 1

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

    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]])
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

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

    测试

    修改w300_kpts.yaml测试入口:

    val: data/data_300W_COFW_WFLW/test_COFW.txt
    
    • 1

    效果图

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

    总结

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

  • 相关阅读:
    oracle提高执行更新或新增的SQL效率
    技术管理之如何协调加班问题
    MySQL8.0创建新用户并授权
    JavaScript和Node.js的关系
    Zookeeper系统模型_客户端命令行
    .NET混合开发解决方案7 WinForm程序中通过NuGet管理器引用集成WebView2控件
    【前端精进之路】JS篇:第2期 数组精讲
    C++标准模板库(STL)-set介绍
    Wsl2 Ubuntu在不安装Docker Desktop情况下使用Docker
    springboot+vue+elementUI 基于Springboot的智慧养老平台#毕业设计
  • 原文地址:https://blog.csdn.net/wqthaha/article/details/128096062