Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the offline version of face recognition by Qt

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to realize the offline version of face recognition by Qt". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve face recognition offline version of Qt"!

I. Preface

This article uses Baidu offline SDK as the solution. You can apply on the official website. By default, there are 6 free keys to use for three months, which need to match the fingerprint information of the local device. Interested students can go to the official website to download SDK. Baidu offline face recognition SDK file is relatively large, light model file on 645MB, it is estimated that this may be a reason for the high recognition rate, continuous training of the model base, this article only released part of the Qt package source code. The corresponding instructions on the official website are still very detailed, as long as people who have learned programming can understand it.

Processing flow:

Instantiate the BaiduFaceApi class and call sdk_init initialization.

Call is_auth to determine whether the authorization is successful or not, and proceed only if it is successful.

Set the minimum face ratio (set_min_face_size), illumination threshold (set_illum_thr) and other parameters.

Call the track_max_face function to get the face region.

Call the rgb_liveness_check function for in vivo detection.

Call the get_face_feature function to extract the eigenvalues.

Call the compare_feature function for face comparison.

Encapsulation of Baidu face recognition online and offline SDK:

The offline version requires a compiler that supports Category 11 and must be MSVC. The mingw compiler is not supported.

The key and other information in the online version, be sure to replace it with your own application.

The offline version can only be used on windows.

The offline version needs to apply for a key on its own. Find the LicenseTool.exe under the facebaidusdk folder, fill in the serial number applied for in the offline SDK management in the background, and click the activate button.

The dynamic libraries and model files corresponding to the offline version are downloaded from the official website.

If there is a facebaidusdk+face-resource folder in the source package, you only need to copy all the files under the facebaidusdk folder to the same executable directory, and the face-resource folder to the executable folder directory with the same level directory. The directory location is shown in the sample diagram under the snap folder.

TestFaceApi.exe under the facebaidusdk directory provides a test program for Baidu, which first plugs the USB camera into the computer and looks for a face frame in real time.

II. Functional features

The supported functions include face recognition, face comparison, face search, live detection and so on.

The online version also supports ID card, driver's license, driving license, bank card and other identification.

The online version of the protocol supports Baidu, absenteeism, and the offline version supports Baidu, which can be customized.

In addition to supporting X86 architecture, it also supports embedded linux such as contex-A9, raspberry pie and so on.

The execution of each function returns not only the result but also the execution time.

Multithreading, which controls the current processing type through type.

Support a single image to retrieve the most similar images.

Support to specify directory images to generate facial feature value files.

You can set the number of pictures waiting to be processed in the queue.

A success or failure signal is returned for each execution.

The return results of face search include the original image + maximum similarity map + similarity and so on.

Face comparison supports two pictures and two eigenvalues at the same time.

Related functions customize a set of protocols for client and server, which can interact through TCP communication.

The custom face recognition protocol is very suitable for the scene where several devices are requested by a server in the center.

Each module is a separate class with neat code and perfect comments.

Third, effect picture

4. Core code void FaceLocalBaiDu::init () {/ / if normal, there is no need to initialize if (isOk) {return;} int res = api- > sdk_init (); res = api- > is_auth (); if (res! = 1) {qDebug () set_illum_thr (20) / / set angle threshold. Default is 15 / / api- > set_eulur_angle_thr (30,30,30); isOk = true; qDebug ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report