当前位置:网站首页>The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience
The ability to detect movement in vivo and build a safe and reliable payment level "face brushing" experience
2022-07-21 19:40:00 【Huawei mobile services】
Face recognition At present, it has been widely used in mobile phone unlocking 、 Brush your face to pay 、 Life scenes such as gate authentication , However , Although the ability of face recognition brings great convenience , But can't identify whether the face is real , For example, use high simulation pictures 、 Precision gypsum or 3D Modeling mask , You can easily break through the face recognition algorithm , Using this capability alone has great potential safety hazards .
Huawei Machine learning services The ability to detect movement in vivo , Live body detection is carried out by means of command action coordination , Blinking 、 open one 's mouth 、 Shake your head left 、 Shake your head right 、 gaze 、 Randomly choose three of the six actions of nodding , Let the user complete the action according to the instructions , Use face key points and face tracking technology , Through continuous pictures , Calculate the ratio of changing distance to constant distance , Compare the image of the previous frame with the image of the next frame , So as to verify whether the user is a real living person , To the photo 、 Video and mask attacks have a good defense effect , It is a prerequisite for the effective application of face recognition .
besides , In the use of Motion vivisection detection ability In the process , Detect scenes such as occlusion and poor light , Support boot detection , Such as timely display “ Dark light hint ”、“ The portrait is blurred ”“ sunglasses 、 Mask blocking ”、“ Face too close 、 Too far ” Etc , Achieve a more friendly interactive experience , Create a safe and reliable payment level living detection capability .
Compared with silent vivisection, which does not require the user to make cooperative actions , The interactive motion detection capability is more suitable for banking and finance 、 Medical and other scenes requiring human-computer interaction . such as , Use this technology in the financial field , Users do not have to go to the bank site in person , You can open a financial account remotely 、 Insurance financing and other operations ; In self-service payment scenarios such as offline supermarkets , The user needs to complete the payment through action vivisection , Ensure the security of personal funds ; In social security 、 Health care 、 In the individual income tax and other handling operation scenarios , It is also necessary to accurately verify whether the operator is a living person through action living body detection , In order to improve operational safety .
So how to integrate motion detection capabilities ? Steps are as follows .
1 Development steps
Before development , You need to complete the necessary development preparations , At the same time, please make sure that your project has been configured with HMS Core SDK Of Maven Warehouse address , And completed the service of SDK Integrate .
Mode one :fullSDK Way integration
dependencies{
// Introduce the action vivisection collection package .
implementation 'com.huawei.hms:ml-computer-vision-interactive-livenessdetection
: 3.2.0.122'
}
Mode two : Basics SDK Way integration
dependencies{
// Introduce in vivo detection plugin package .
implementation 'com.huawei.hms:ml-computer-vision-interactive-livenessdetection-plugin:3.2.0.122'
}
Motion vivisection provides two call modes , You can choose the corresponding calling method to build the living body detection service according to your needs .
1.1 Default scanning interface
1. Create a live test result callback , Used to obtain test results .
private MLInteractiveLivenessCapture.Callback callback = new MLInteractiveLivenessCapture.Callback() {
@Override
public void onSuccess(MLInteractiveLivenessCaptureResult result) {
// Detect successful processing logic , The test results may be living or non living .
swich(result.getStateCode()) {
case InteractiveLivenessStateCode.ALL_ACTION_CORRECT:
// After the verification is passed, the corresponding specific operations
case InteractiveLivenessStateCode.IN_PROGRESS:
// Corresponding specific operation when detecting
…
}
@Override
public void onFailure(int errorCode) {
// The test is not complete , If the camera is abnormal CAMERA_ERROR, Add failed processing logic .
}
};
2. Create an in vivo detection instance , Start detection .
MLInteractiveLivenessConfig interactiveLivenessConfig = new MLInteractiveLivenessConfig.Builder().build();
MLInteractiveLivenessCaptureConfig captureConfig = new MLInteractiveLivenessCaptureConfig.Builder()
.setOptions(MLInteractiveLivenessCaptureConfig.DETECT_MASK)
.setActionConfig(interactiveLivenessConfig)
.setDetectionTimeOut(TIME_OUT_THRESHOLD)
.build();
MLInteractiveLivenessCapture capture = MLInteractiveLivenessCapture.getInstance();
capture.startDetect(activity, callback);
1.2 Customize the scanning interface
1. establish MLInteractiveLivenessDetectView, And load to Activity Layout .
/**
* I. Bind camera preview interface , Set the living body recognition area .
* In the camera preview stream , In vivo detection will judge whether the face is in the face frame of the preview video stream , In order to improve living * Body passing rate , It is recommended that the face frame be placed in the middle of the screen , And the living body recognition area is slightly larger than the drawn face frame .
* II. Set whether to detect mask .
* III. Set the result callback .
* IV. take MLInteractiveLivenessDetectView Load into Activity.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_liveness_custom_detection);
mPreviewContainer = findViewById(R.id.surface_layout);
MLInteractiveLivenessConfig interactiveLivenessConfig = new MLInteractiveLivenessConfig.Builder().build();
mlInteractiveLivenessDetectView = new MLInteractiveLivenessDetectView.Builder()
.setContext(this)
// Set whether to detect mask
.setOptions(MLInteractiveLivenessCaptureConfig.DETECT_MASK)
// Set the detection action , Silence is 0, Action for 1.
.setType(1)
// Set the preview position of camera video stream ( The upper left and lower right pixel values are based on the preview view)
.setFrameRect(new Rect(0, 0, 1080, 1440))
// Set the live action call
.setActionConfig(interactiveLivenessConfig)
// Set the face frame relative to the preview view The location of ( Top left and bottom right are based on 640*480 Image coordinates , It is suggested that the aspect ratio should conform to the actual face proportion ), The function of the face frame is to detect the distance and offset of the face
.setFaceRect(new Rect(84, 122, 396, 518))
// Set detection timeout , Suggest 10000 Millisecond or so .
.setDetectionTimeOut(10000)
// Set the result callback
.setDetectCallback(new OnMLInteractiveLivenessDetectCallback() {
@Override
public void onCompleted(MLInteractiveLivenessCaptureResult result) {
// The result callback when the vivisection is completed
swich(result.getStateCode()) {
case InteractiveLivenessStateCode.ALL_ACTION_CORRECT:
// After the verification is passed, the corresponding specific operations
case InteractiveLivenessStateCode.IN_PROGRESS:
// Corresponding specific operation when detecting
…
}
}
@Override
public void onError(int error) {
// Error code callback when an error occurs in vivo detection
}
}).build();
mPreviewContainer.addView(mlInteractiveLivenessDetectView);
mlInteractiveLivenessDetectView.onCreate(savedInstanceState);
}
2. Yes MLInteractiveLivenessDetectView Set the life process monitor .
@Override
protected void onDestroy() {
super.onDestroy();
MLInteractiveLivenessDetectView.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
MLInteractiveLivenessDetectView.onPause();
}
@Override
protected void onResume() {
super.onResume();
MLInteractiveLivenessDetectView.onResume();
}
@Override
protected void onStart() {
super.onStart();
MLInteractiveLivenessDetectView.onStart();
}
@Override
protected void onStop() {
super.onStop();
MLInteractiveLivenessDetectView.onStop();
}
Learn more >>
visit The official website of machine learning service
visit Official website of Huawei developer Alliance
obtain Development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
边栏推荐
- 常用功能测试的检查点与用例设计思路
- dc-dc开关电源的纹波测试
- JS异步发展史和async await原理初探
- armv8 DVFS
- LeetCode:1260. Two dimensional mesh migration [one dimensional expansion + splicing]
- Lombok简化开发
- 动作活体检测能力,构建安全可靠的支付级“刷脸”体验
- Preparation of paclitaxel combined with 2-methoxyestradiol albumin nanoparticles / Piper longum amide albumin nanoparticles
- C language file operation
- OKR case of personnel department: create the best office environment for colleagues
猜你喜欢
【C 练习】宏实现交换数字二进制奇偶位
无线定位技术实验二 TDOA最小二乘定位法
解决報錯:Uncaught TypeError: Cannot read properties of undefined (reading ‘install‘)
MySQL optimization summary I
ASTM F 814 test method for specific optical density of smoke produced by solid materials for aerospace equipment
Fcrp-d --- simulation questions on the official website of sail software, kettle module
JWT (JSON web token) authentication: the most popular cross domain authentication solution at present
MySQL advanced (b)
Redis+caffeine two-level cache enables smooth access speed
Lombok简化开发
随机推荐
OSPF Foundation
Click the model mode box and the other areas will not disappear except the mode box
Harbor scanner from principle to construction
"PHP implementation of Domain Driven Design" - integration context [reprint]
Day009 circular structure (exercise)
解决報錯:Uncaught TypeError: Cannot read properties of undefined (reading ‘install‘)
MySQL advanced (b)
hot wire! The PMP project management certificate is listed in the urgently needed professional personnel
FTXUI基础笔记(checkbox复选框组件)
无线定位技术实验二 TDOA最小二乘定位法
蚓激酶白蛋白纳米粒/红细胞膜定向包裹血红蛋白-白蛋白纳米粒的研究制备
DOM 事件流(事件捕获和事件冒泡)
Ripple test of DC DC switching power supply
深度学习——(4)VGG16 图像分类
Tencent im practice: low code and ultra fast instant address book
Software testing interview question: what is the difference between quotation and pointer?
Liunx kills processes with the same name in batches
支持向量机(理解、推导、matlab例子)
信号处理系统综合设计-最小阶数的IIR数字高通滤波器
动作活体检测能力,构建安全可靠的支付级“刷脸”体验