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 face recognition by developing Picture recognition with message Interface on Wechat Public platform

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the Wechat public platform message interface development picture recognition how to achieve face recognition, the article is very detailed, has a certain reference value, interested friends must finish reading!

I. Preface

The first few mini applications seem to be lacklustre, the response is lukewarm, and everyone seems not interested. Today, I would like to introduce a brighter one: face recognition on Wechat public platform.

Some time ago, I saw a report on the Internet that Wei Xiaoyong, head of the Department of computer Science and Associate Professor of Sichuan University, developed an image-based classroom attendance system. Class attendance is called 'face scanning' with face recognition. See the picture below.

In the roll call, you only need to take pictures of the students in the classroom from multiple angles, and then upload the photos to the server and automatically splice them into a whole picture. The system automatically numbers and identifies the students' avatars in the photos, and finally appears the students' personal information, with two options of "It'sme" and "notme" next to them. So we can know who is in class and who is skipping class right away.

What's more, the statistical significance of this thing is that it can even analyze students' interpersonal relationships and even personality interests. for example, it draws raw data based on where students like to sit and whose side they like to sit in class. after a period of time, and then analyze, we can see who is in love with whom and who is with whom after breaking up with whom. Who always likes to sit alone in the corner (autism), and some boy and some boy sit together every time for half a year (gay friends?) In an instant, I feel that this thing gives people unlimited room for imagination.

Let's get down to business:

First of all, let's take a look at what face recognition is, and take a look at the definition of Baidu Encyclopedia: face recognition refers to the computer technology that uses the analysis and comparison of facial visual feature information for identity identification. Face recognition is a hot research field of computer technology, which can detect face light and shade, automatically adjust dynamic exposure compensation, face tracking detection, and automatically adjust image magnification; it belongs to biometric recognition technology. it is to distinguish the biological individual according to the biological characteristics of the organism (generally refers to the human).

The technical process of face recognition (from Baidu encyclopedia)

Generally speaking, there are three steps:

The main contents are as follows: (1) firstly, the face file of human face is established. That is, the camera is used to collect the facial image files of the faces of the unit personnel or take their photos to form the facial image files, and these face files are generated into facial patterns (Faceprint) coding and stored.

(2) to obtain the decent image of the current person. That is, the face of the current entry and exit person captured by the camera, or take the photo input, and the current face file to generate facial pattern coding.

(3) compare the current facial pattern coding with the file inventory. The facial pattern code of the current face image is retrieved and compared with the facial pattern code in the file inventory. The above "facial pattern coding" method works according to the essential features and beginning of the face. This facial pattern coding can resist changes in light, skin tone, facial hair, hair, glasses, expression and posture, and is so reliable that it can accurately identify a person from millions of people. The process of face recognition can be completed automatically, continuously and in real time by using ordinary image processing equipment.

Second, face recognition on Wechat public platform 1. Picture acquisition

The first thing is to get the pictures sent by the user. The Wechat public platform supports receiving pictures.

A picture sent by the user is as follows:

The format of the picture message is as follows:

1357543196 5830603629728080261

The WeChat account of the recipient of ToUserName message, which is usually the Wechat account of the public platform.

Wechat account of the sender of the FromUserName message

CreateTime message creation time

MsgType message type; picture message is image

PicUrl Picture Link address

MsgId message ID number

two。 Interface

Face++ provides a face recognition interface.

The locations of all faces (Face) in a given image (Image) and the corresponding facial attribute API addresses are as follows:

Http://apicn.faceplusplus.com/v2/detection/detect

Parameters.

Is it necessary

Meaning

Api_key

Must

Face++ API Key of App

Api_secret

Must

Face++ API Secret of APP

Url or img [POST]

Must

The URL of the image to be tested or the binary data uploaded through the POST method. The size of the original image needs to be less than 3m.

Mode

Optional

The detection mode can be normal (default) or oneface. In oneface mode, the detector finds only the largest face in the picture.

Attribute

Optional

It can be a none or a list of attributes separated by commas. The default is gender, age, race, smiling. Currently supported attributes include: gender, age, race, smiling, glass, pose

Tag

Optional

You can specify a string for each Face detected in the picture that does not contain illegal characters such as ^ @, & = *'"and no more than 255bytes as tag,tag information can be queried through / info/get_face

Async

Optional

If set to true, the API will be called asynchronously; that is, an session id will be returned immediately, and the results can be queried later through / info/get_session. The default is false.

Return as follows

{"face": [{"attribute": {"age": {"range": 5, "value": 17}, "gender": {"confidence": 99.9781 "value": "Female"}, "glass": {"confidence": 99.9815, "value": "None"} "pose": {"pitch_angle": {"value": 0.000019753399999999996}, "roll_angle": {"value": 1.75177} "yaw_angle": {"value": 4}}, "race": {"confidence": 99.471, "value": "Asian"} "smiling": {"value": 87.1365}, "face_id": "c772b4b66c00d46b15344eff74b56e48"}], "img_height": 293, "img_id": "3005132383841edd08c9b500fb1fe2c4", "img_width": 440, "session_id": "4e64c73fec19442cbefde3cf9bd6b53d", "url": ""}

Parameters:

Gender

Object

Contains the results of gender analysis. The value of value is Male/Female, and confidence indicates confidence.

Age

Object

Including the results of age analysis, the value of value is a non-negative integer indicating the estimated age, and range represents the positive and negative interval of the estimated age.

Race

Object

Contains the results of ethnic analysis. The value of value is Asian/White/Black, and confidence indicates confidence.

Smiling

Object

Including the results of smile degree analysis, the value of value is a real number of 0mur100, and the higher the smile, the higher the smile.

Realization method

Take the gender,age,race,smiling and other parameters in the result parameters, such as

"attribute": {"age": {"range": 5, "value": 17}, "gender": {"confidence": 99.9781, "value": "Female"} "glass": {"confidence": 99.9815, "value": "None"}, "pose": {"pitch_angle": {"value": 0.000019753399999999996} "roll_angle": {"value": 1.75177}, "yaw_angle": {"value": 4}} "race": {"confidence": 99.471, "value": "Asian"}, "smiling": {"value": 87.1365}

In the above results

The age age is 17, the error is 5 years old, the gender is female, it is female, the confidence is 99%, the race is Asian Asian, and the smile is 87%.

Compared with the picture, it is more consistent.

3. Program realization

SDK is as follows:

"attribute": {"age": {"range": 5, "value": 17}, "gender": {"confidence": 99.9781, "value": "Female"} "glass": {"confidence": 99.9815, "value": "None"}, "pose": {"pitch_angle": {"value": 0.000019753399999999996} "roll_angle": {"value": 1.75177}, "yaw_angle": {"value": 4}} "race": {"confidence": 99.471, "value": "Asian"}, "smiling": {"value": 87.1365}

The calling method is as follows:

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

Development

Wechat

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

12
Report