当我们在使用MTK平台的相机时,如果默认使用MTK自带的人脸算法,可能会出现人脸识别不准确或者误识别等情况,这个问题MTK也提供了部分参数可供修改,我们接下来看一下应该如何修改。
(1)Log查看
先打开如下宏开关:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13adb root adb shell setenforce 0 adb shell setprop persist.vendor.mtk.camera.log_level 3 adb shell setprop vendor.debug.camera.log.FDNode 1 adb shell setprop vendor.debug.camera.fd.config.enable 1 adb shell setprop vendor.debug.camera.fd.enable 1 adb shell setprop vendor.debug.camera.fd.detail.log 1 adb shell setprop debug.cam.drawid 1 adb shell setprop vendor.debug.camera.log.ZoomRatioConverter 1 adb shell setprop vendor.debug.hal3av3.log 1 adb shell pkill camera* adb logcat -G 20M
当算法识别到人脸数后Log中会有提示NumFace = x,如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
1411-21 04:33:53.864 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] status : 1, after calculateRotateDegree : 90 11-21 04:33:53.864 16160 16328 I MtkCam/fdNodeImp: [RunFaceDetection] rotatetion : 90, sensor facing : 1 11-21 04:33:53.864 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] after calculate rot : 90 11-21 04:33:53.864 16160 16328 I MtkCam/fdNodeImp: [RunFaceDetection] FD frame timestamp : 267939140741000 11-21 04:33:53.864 16160 16328 I MtkCam/fdNodeImp: [RunFaceDetection] FD count : 199, duration : 199 11-21 04:33:53.864 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] halFDDo In. 11-21 04:33:53.886 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] halFDDo Out. 11-21 04:33:53.887 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] NumFace = 2, 11-21 04:33:53.887 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] faceArea = 762625, mFaceRatio = 0.190656 11-21 04:33:53.887 16160 16328 I MtkCam/fdNodeImp: [RunFaceDetection] 3A NumFace = 2, 11-21 04:33:53.887 16160 16328 D MtkCam/fdNodeImp: [RunFaceDetection] [Before 3A] magicNo: 105 11-21 04:33:53.887 16160 16328 I MtkCam/fdNodeImp: [convertResult] set 3A fd info
(2)算法参数配置(以前)
复制代码
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//这里以6765平台作为示例 //vendor/mediatek/proprietary/custom/mt6765/hal/camera/camera_custom_fd.cpp void get_fd_CustomizeData(FD_Customize_PARA *FDDataOut) { FDDataOut->FDThreadNum = 1; FDDataOut->FDThreshold = 256; FDDataOut->MajorFaceDecision = 1; FDDataOut->OTRatio = 1088; FDDataOut->SmoothLevel = 8; FDDataOut->Momentum = 0; FDDataOut->MaxTrackCount = 10; FDDataOut->FDSkipStep = 2; FDDataOut->FDRectify = 10; FDDataOut->FDRefresh = 3; FDDataOut->SDThreshold = 69; FDDataOut->SDMainFaceMust = 1; FDDataOut->SDMaxSmileNum = 3; FDDataOut->GSensor = 1; FDDataOut->FDModel = 1; FDDataOut->OTFlow = 1; //0:Original Flow (FDRefresh:60) , 1:New Flow (FDRefresh:3) FDDataOut->UseCustomScale = 1; FDDataOut->FDSizeRatio = 0.0; // float:0~1 FDDataOut->SkipPartialFD = 0; FDDataOut->SkipAllFD = 0; }
如上为相关参数配置,可参考如下解释:
复制代码
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
29
30
31
32
33
34
35
36
37//fd相关的参数的说明 void get_fd_CustomizeData(FD_Customize_PARA *FDDataOut) { FDDataOut->FDThreadNum = 1; //默认为1,不建议设的很大,此值越大,耗电越高,功耗越大,因为FD本身计算量较大,如果多开几条thread,那功耗就更多了。 FDDataOut->FDThreshold = 88; //代表人脸检测的一个阈值,用来判断是否为人脸区域。 //此值越低,表示认为人脸的标准越宽松,识别率会提高,同时误检率也会增加,反之,识别率降低,误检率降低。 FDDataOut->MajorFaceDecision = 1; //因为FD的结果会用来调整AE、AF的设定,所以当画面有多人脸的时候,需要决定一个重要的脸来做3A设定,这个值用来决定要以哪个脸优先,设定如下: // 0: 人脸大小优先,即最大的那张人脸是要送到AE/AF那边去的 // 1: 画面中心优先,最中间的那种人脸是要送到AE/AF那边的 FDDataOut->OTRatio = 1088; // 画面中人在移动的情况下,人脸追踪的准确度和速度就需要调整此值,默认值为1024。 // 此值越大,表示越能够抗人脸的移动、转动和光线的变化,不会掉框,框会一直跟着人脸,不会lose tracing,但是框虽然跟上去了,但不一定能追到脸上去,有可能追到脖子或者脸部以外的区域,建议值:800~1280。 // 若认为tracing偏移的状况严重,可以降低此值,以losing tracing来换取校正位置。 //此值增加 ==》较不会losing tracing,易追到人脸区域以外。 //此值减小 ==》较易losing tracing,但易追到人脸区域。 FDDataOut->SmoothLevel = 8; FDDataOut->FDSkipStep = 3; FDDataOut->FDRectify = 10; //希望人脸框追人脸追的更准确一些,默认值为10,建议值5~15,此值越大,人脸框追踪人脸越不准确。 FDDataOut->FDRefresh = 3; FDDataOut->SDThreshold = 69; FDDataOut->SDMainFaceMust = 1; FDDataOut->SDMaxSmileNum = 3; FDDataOut->GSensor = 1; //默认值1,预设FD需要G-sensor的辅助来加速FD的搜寻时间 // 0: 不使用G-sensor // 1:使用G-sensor // 一般有Gsensor时,建议打开 FDDataOut->FDModel = 1; FDDataOut->OTFlow = 1; //0:Original Flow (FDRefresh:60) , 1:New Flow (FDRefresh:3) FDDataOut->SkipAllFD = 0; }
以上介绍的参数是允许调整的,其它参数一般不建议去调整。
(3)算法参数配置(现在)
复制代码
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79//vendor/mediatek/proprietary/hardware/mtkcam3/feature/common/faceeffect/FaceDetection/FD_Tuning/TuningPara.h struct tuning_para { MUINT32 FDThreshold; // default 256, suggest range: 100~400 bigger is harder MUINT32 DisLimit; // default 4, suggest range: 1 ~ 4 MUINT32 DecreaseStep; // default 48, suggest range: 0 ~ 384 MUINT32 FDMINSZ; MUINT32 DelayThreshold; // default 20, under this goes to median reliability, above goes high MUINT32 DelayCount; // default 2, for median reliability face, should have deteced in continous frame MUINT32 MajorFaceDecision; // default 1, 0: Size fist. 1: Center first. 2: Size first perframe. 3: Center first per frame MUINT8 OTBndOverlap; // default 8, suggest range: 6 ~ 9 MUINT32 OTRatio; // default 960, suggest range: 400~1200 MUINT32 OTds; // default 2, suggest range: 1~2 MUINT32 OTtype; // default 1, suggest range: 0~1 MUINT32 SmoothLevel; // default 8, suggest range: 0~16 MUINT32 Momentum; // default 2819, MUINT32 SmoothLevelUI; // default 8, suggest range: 0~16 MUINT32 MomentumUI; // default 2818 MUINT32 MaxTrackCount; // default 10, suggest range: 0~120 MUINT8 SilentModeFDSkipNum; // default 0, suggest range: 0~2 MUINT8 HistUpdateSkipNum; // default 1, suggest range: 0~5 MUINT32 FDSkipStep; // default 2, suggest range: 2~6 MUINT32 FDRectify; // default 10000000 means disable and 0 means disable as well. suggest range: 5~10 MUINT32 FDRefresh; // default 3, suggest range: 30~120 }; static struct tuning_para tuning_35 = { 100, //FDThreshold; 4, //DisLimit; 384, //DecreaseStep; 0, //FDMINSZ; 127, //DelayThreshold; 3, //DelayCount; 1, //MajorFaceDecision; 8, //OTBndOverlap; 1088,//OTRatio; 2, //OTds; 1, //OTtype; 8, //SmoothLevel; 0, //Momentum; 0, //SmoothLevelUI; 0, //MomentumUI; 10, //MaxTrackCount; 6, //SilentModeFDSkipNum; 1, //HistUpdateSkipNum; 2, //FDSkipStep; 10, //FDRectify; 3 //FDRefresh; }; static struct tuning_para tuning_40 = { 200, //FDThreshold; 4, //DisLimit; 192, //DecreaseStep; 0, //FDMINSZ; 50, //DelayThreshold; 2, //DelayCount; 14, //MajorFaceDecision; 8, //OTBndOverlap; 1088,//OTRatio; 2, //OTds; 1, //OTtype; 8, //SmoothLevel; 0, //Momentum; 0, //SmoothLevelUI; 0, //MomentumUI; 10, //MaxTrackCount; 0, //SilentModeFDSkipNum; 1, //HistUpdateSkipNum; 2, //FDSkipStep; 10, //FDRectify; 3 //FDRefresh; }; //...
Code中还有Dump相关信息。
复制代码
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59//vendor/mediatek/proprietary/hardware/mtkcam3/feature/common/faceeffect/FaceDetection/FD4.0/fdvt_hal.cpp // Dump FD information void halFDVT::dumpFDParam(MTKFDFTInitInfo &FDFTInitInfo) { MY_LOGD("WorkingBufAddr = %p", FDFTInitInfo.WorkingBufAddr); MY_LOGD("WorkingBufSize = %d", FDFTInitInfo.WorkingBufSize); MY_LOGD("FDThreadNum = %d", FDFTInitInfo.FDThreadNum); MY_LOGD("FDThreshold = %d", FDFTInitInfo.FDThreshold); MY_LOGD("DelayThreshold = %d", FDFTInitInfo.DelayThreshold); MY_LOGD("MajorFaceDecision = %d", FDFTInitInfo.MajorFaceDecision); MY_LOGD("OTRatio = %d", FDFTInitInfo.OTRatio); MY_LOGD("SmoothLevel = %d", FDFTInitInfo.SmoothLevel); MY_LOGD("FDSkipStep = %d", FDFTInitInfo.FDSkipStep); MY_LOGD("FDRectify = %d", FDFTInitInfo.FDRectify); MY_LOGD("FDRefresh = %d", FDFTInitInfo.FDRefresh); MY_LOGD("FDBufWidth = %d", FDFTInitInfo.FDBufWidth); MY_LOGD("FDBufHeight = %d", FDFTInitInfo.FDBufHeight); MY_LOGD("FDTBufWidth = %d", FDFTInitInfo.FDTBufWidth); MY_LOGD("FDTBufHeight = %d", FDFTInitInfo.FDTBufHeight); MY_LOGD("FDImageArrayNum = %d", FDFTInitInfo.FDImageArrayNum); MY_LOGD("FDImageWidthArray = "); for (int i = 0; i < FD_SCALES; i++) { MY_LOGD("%d, ",FDFTInitInfo.FDImageWidthArray[i]); } MY_LOGD("n"); MY_LOGD("FDImageHeightArray = "); for (int i = 0; i < FD_SCALES; i++) { MY_LOGD("%d, ",FDFTInitInfo.FDImageHeightArray[i]); } MY_LOGD("n"); MY_LOGD("FDMinFaceLevel = %d", FDFTInitInfo.FDMinFaceLevel); MY_LOGD("FDMaxFaceLevel = %d", FDFTInitInfo.FDMaxFaceLevel); MY_LOGD("FDImgFmtCH1 = %d", FDFTInitInfo.FDImgFmtCH1); MY_LOGD("FDImgFmtCH2 = %d", FDFTInitInfo.FDImgFmtCH2); MY_LOGD("SDImgFmtCH1 = %d", FDFTInitInfo.SDImgFmtCH1); MY_LOGD("SDImgFmtCH2 = %d", FDFTInitInfo.SDImgFmtCH2); MY_LOGD("SDThreshold = %d", FDFTInitInfo.SDThreshold); MY_LOGD("SDMainFaceMust = %d", FDFTInitInfo.SDMainFaceMust); MY_LOGD("GSensor = %d", FDFTInitInfo.GSensor); MY_LOGD("GenScaleImageBySw = %d", FDFTInitInfo.GenScaleImageBySw); MY_LOGD("FDManualMode = %d", FDFTInitInfo.FDManualMode); MY_LOGD("mUserScaleNum = %d", mUserScaleNum); #if MTK_ALGO_PSD_MODE MY_LOGD("FDVersion = %d", FDFTInitInfo.FDVersion); #endif #if (USE_HW_FD)&&(HW_FD_SUBVERSION >= 2) MY_LOGD("FDMINSZ = %d", FDFTInitInfo.FDMINSZ); #endif MY_LOGD("Version = %d", halFDGetVersion()); MY_LOGD("DisLimit = %d", FDFTInitInfo.DisLimit); MY_LOGD("DecreaseStep = %d", FDFTInitInfo.DecreaseStep); MY_LOGD("DelayThreshold = %d", FDFTInitInfo.DelayThreshold); MY_LOGD("DelayCount = %d", FDFTInitInfo.DelayCount); MY_LOGD("LandmarkEnableCnt = %d", FDFTInitInfo.LandmarkEnableCnt); }
Log信息如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1703-06 02:33:54.763350 953 9336 D mHalFDVT: (9336)[dumpFDParam] mtkcam3 FDThreshold = 230 03-06 02:33:54.763359 953 9336 D mHalFDVT: (9336)[dumpFDParam] DelayThreshold = 50 03-06 02:33:54.763367 953 9336 D mHalFDVT: (9336)[dumpFDParam] MajorFaceDecision = 14 03-06 02:33:54.763375 953 9336 D mHalFDVT: (9336)[dumpFDParam] OTRatio = 1088 03-06 02:33:54.763384 953 9336 D mHalFDVT: (9336)[dumpFDParam] SmoothLevel = 8 03-06 02:33:54.763392 953 9336 D mHalFDVT: (9336)[dumpFDParam] FDSkipStep = 2 03-06 02:33:54.763401 953 9336 D mHalFDVT: (9336)[dumpFDParam] FDRectify = 10 03-06 02:33:54.763409 953 9336 D mHalFDVT: (9336)[dumpFDParam] FDRefresh = 3 03-06 02:33:54.763417 953 9336 D mHalFDVT: (9336)[dumpFDParam] FDBufWidth = 400 03-06 02:33:54.763840 953 9336 D mHalFDVT: (9336)[dumpFDParam] FDMINSZ = 0 03-06 02:33:54.763848 953 9336 D mHalFDVT: (9336)[dumpFDParam] Version = 7 03-06 02:33:54.763856 953 9336 D mHalFDVT: (9336)[dumpFDParam] DisLimit = 4 03-06 02:33:54.763864 953 9336 D mHalFDVT: (9336)[dumpFDParam] DecreaseStep = 100 03-06 02:33:54.763872 953 9336 D mHalFDVT: (9336)[dumpFDParam] DelayThreshold = 50 03-06 02:33:54.763881 953 9336 D mHalFDVT: (9336)[dumpFDParam] mtkcam3 DelayCount = 3 03-06 02:33:54.763890 953 9336 D mHalFDVT: (9336)[dumpFDParam] LandmarkEnableCnt = 5
关闭FD相关逻辑:
复制代码
1
2
3adb root adb shell setprop vendor.debug.camera.fd.disable 1
最后
以上就是活力橘子最近收集整理的关于MTK平台Camera人脸识别算法灵敏度参数的全部内容,更多相关MTK平台Camera人脸识别算法灵敏度参数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复