当前位置:网站首页>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-23 07:08:00 【nginx】

Huawei's machine learning service has 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 process of using motion vivisection detection ability , 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
Mode two : Basics SDK Way integration
dependencies{// Introduce the action vivisection collection package .implementation 'com.huawei.hms:ml-computer-vision-interactive-livenessdetection: 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 .
dependencies{// Introduce in vivo detection plugin package .implementation 'com.huawei.hms:ml-computer-vision-interactive-livenessdetection-plugin:3.2.0.122'}

Learn more >>
1.1 Default scanning interface1. Create a live test result callback , Used to obtain test results .private MLInteractiveLivenessCapture.Callback callback = new MLInteractiveLivenessCapture.Callback() {@Overridepublic 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 operationscase InteractiveLivenessStateCode.IN_PROGRESS:// Corresponding specific operation when detecting…}@Overridepublic 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 interface1. 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.*/@Overrideprotected 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() {@Overridepublic void onCompleted(MLInteractiveLivenessCaptureResult result) {// The result callback when the vivisection is completedswich(result.getStateCode()) {case InteractiveLivenessStateCode.ALL_ACTION_CORRECT:// After the verification is passed, the corresponding specific operationscase InteractiveLivenessStateCode.IN_PROGRESS:// Corresponding specific operation when detecting…}}@Overridepublic 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 .@Overrideprotected void onDestroy() {super.onDestroy();MLInteractiveLivenessDetectView.onDestroy();}@Overrideprotected void onPause() {super.onPause();MLInteractiveLivenessDetectView.onPause();}@Overrideprotected void onResume() {super.onResume();MLInteractiveLivenessDetectView.onResume();}@Overrideprotected void onStart() {super.onStart();MLInteractiveLivenessDetectView.onStart();}@Overrideprotected void onStop() {super.onStop();MLInteractiveLivenessDetectView.onStop();}
Visit the official website of machine learning service
Visit the official website of Huawei developer alliance
Get 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 ~
边栏推荐
- 数据库系统设计:分区
- Sharepreference principle + practical analysis
- thinkphp URL_MODE =0 普通模式 的具体用法
- 如何让屏幕上的字显示更大(让大屏幕看文字更舒服的设置方法)
- [matlab project practice] sine sweep (sine sweep signal)
- BGP基本配置和路由聚合
- An in-depth explanation of CAS is necessary for interview practice
- 电脑分区时出现'磁盘上没有足够的空间完成此操作'的解决办法
- Combing the docking process between the integration base and the business system
- Huawei shengteng competition materials
猜你喜欢

华为昇腾比赛资料

事件抽取文献整理(2020-2021)

Livegbs camera web page low delay plug-in free live broadcast implementation

Stability control and Simulation of double inverted pendulum system (matlab/simulink)

引擎提示Alias HeroDB跟游戏引擎启动异常怎么解决?

电磁场与电磁波实验四 熟悉CST Studio软件在电磁领域的应用

什么程序员在35岁依然被公司抢着要?打破程序员“中年危机”

Stack et file d'attente de l'adaptateur STL

实现OPC UA publish/subscribe单次发送

Mycms we media mall v3.5 release, new free plug-ins
随机推荐
常见的跨域问题
Flink数据源拆解分析(WikipediaEditsSource)
Uric acid detection and precautions
华为昇腾比赛资料
BGP Confederacy experiment
Huawei shengteng competition materials
js中的迭代器与生成器(详解)
什么程序员在35岁依然被公司抢着要?打破程序员“中年危机”
2021-03-01
电脑分区时出现'磁盘上没有足够的空间完成此操作'的解决办法
如何将监控画面嵌入微信公众号进行直播
HCDE城市闭门会南京站成功举办
ABAP ALV summary
常见运算符
STL container - vector simulation implementation
无法打开代理服务器提示代理服务器没有设置为完全访问该怎么办?
微软测双胞胎工具twinsornot怎么玩?测双胞胎工具twinsornot玩法介绍
IO flow principle and flow classification
工行网银助手无法安装怎么办?工行网银助手安装失败问题解决方法
(ros_melody) using rviz for boundingbox visualization