Aliyun Face Recognition — face attribute recognition experience — FearLazy

Ali Cloud face attribute recognition function needs some preparation work, preparation work reference article “[Details] Ali Cloud face recognition – Face detection experience (based on Python)”

Start writing code when the preparation is complete:

Face recognition imports the class RecognizeFaceRequest.

RecognizeFaceRequest creates a request to RecognizeFaceRequest to set up the IMAGE’S URL (the image’s address for the OSS Shanghai region).

Finally, AcsClient is used to send the request and get the result.

The return of the face attribute Data in the return result of the Data object.

GenderList is the gender of a person’s face, with 0 indicating female and 1 indicating male. If there are multiple faces, return in turn.

Expressions are Expressions, 0 means neutral and 1 means smile. If there are multiple faces return in turn.

FaceCount is the number of faces detected.

BeautyList is a beautylevel score, ranging from 0 to 100, that returns multiple faces in sequence.

Glasses indicates whether to wear Glasses. 0 does not wear Glasses, 1 wears Glasses, and 2 wears sunglasses. Multiple faces are returned in turn.

AgeList indicates the age. The value ranges from 0 to 100. Multiple faces are returned in turn.

Masks indicate whether to wear a mask. 0 does not wear a mask, 1 does wear a mask, and 2 does not wear a mask correctly.

HatList indicates whether to wear a hat. 0 has no hat and 1 has a hat.

Since it is clear beforehand that there is only one face, the test example directly obtains the first value of the list, such as genderList [0].

Test results:

The level of appearance and age feel judged ok. Interested can upload their own photos to try.

–> This is from my personal blog fearlazy –> Programming is something you can never learn, but it’s nice to enjoy the learning process.