The latest version of ArcSoft python interface to full version

The latest version of ArcSoft python interface to full version

The current model of open source face detection, identification many, many partners also stepped on a lot of small pits. I believe many have used dlib face recognition and facenet partners have such small wonder why the paper was up to 99.8 accuracy rate, their actual use down the exact rate is not good, and even less to implement to 100 people face recognition, are often misidentified phenomenon, caused by this phenomenon the main reason comes from the training sample model of face recognition and face domestic gap. Therefore, these seemingly high accuracy of the model, used to make direct use project is not enough to test the performance of the two models in the use of hundreds of people in attendance of the picture, the accuracy dlib and facenet are not ideal.

Comprehensive comparison found that the use ArcSoft Face Recognition Interface is an open source, the best choice in the domestic recognition accuracy.

Unfortunately, the current ArcSoft temporarily not provide python interface code, currently the Internet as well as some use python call the case ArcSoft interface, similar articles stereotyped, basically the same code repeatedly reproduced, did not can a complete call ArcSoft python interface function names are also free to define all of the features are not easy to remember, there is no use pycharm development class member function coding tips, code section unreasonable also repeated ... it is intolerable python api interface to stagger currently published misalignment of the end, specially with a few days time the full functionality of the current version of ArcSoft to write a complete python api easy to use interface.

Starting point

python interface to essentially use ctypes to call ArcSoft dynamic link library, go to ArcSoft's official website need to select the C / C ++ version of the SDK to download dependencies. For C on the code provided and ArcSoft / C ++ version of the demo code are basically the same, this python function name and ArcSoft function name of the interface is the same, and demo.py the basic structure is the python C / C ++ version of the demo code translations.

Code Address: ArcFace-Python
If the code help you, give it a star!

Optimization points

1. Rewrite the print properties and structure of all member variables object classes, convenient python print objects can be directly see the results of the information returned by ArcSoft, and pycharm can provide prompt information when writing code.
2. Prior to this other blog in the python interface to ArcSoft engine when the incoming images are used in this way:

frame_byte=bytes(frame.data)

frame_byte_p=cast(framebyte,c_ubyte_p)

But more can be changed to: frame.ctypes.data_as(POINTER(c_ubyte))

This reduces numpy image into a stream of bytes consumed by this step

note

1. The current interface will need to download the latest ArcSoft (2.2) C / C ++ version of the SDK.

2. ArcSoft C / C ++ interface supports many image formats passed, but python opencv use when doing image processing are basically (numpy image is cv2.imread () obtained) ASVL_PAF_RGB24_B8G8R8 this format, and the default when using this interface pictures are using this format. This interface therefore dependent opencv, if not directly mounted pip.

3. ArcSoft functions return a box with a status code, determine to do the work status code to ensure proper use, if the status code returned value is not MOK (value of 0), indicating that the function execution error, you can control the document doc the error control code interpreter.

4. The first time you run the code needs to networking, as it will do the activation, the first run after a successful activation will get a ArcFace64.dat file, when there is this file later, you can not perform an activation code.

5. related to the operation of the incoming picture function, to ensure that the width of the image into an integer multiple of 4, if not cut will have to do in advance, or do the resize operation.

6. The current default picture mode detection, face property values ​​faceID always empty, when you need to run video face detection engine, then you can initialize function ASF_DETECT_MODE_IMAGE changed ASF_DETECT_MODE_VIDEO which represents the tracking mode, thus reducing the face detection consumption, and face information returned in this case will faceID value, which is useful in a video face recognition, can reduce extracted repeatedly face recognition.

7. properties of eigenvalues ​​and face detection may fail. Hong and feature extraction software would do the face region extraction properties of these features when a determination operation, if the face blurred, or provide a coordinate position of the face not biased, returns 81925 (facial feature detection result of low confidence )error code. So be sure to pay attention to the return status code.

8. There are two objects ArcSoft described face detection position and angle information ASF_SingleFaceInfo(single face information) ASF_MultiFaceInfo(multiple face information) of face recognition process is to detect a human face, and then the face feature value extracted information, feature-value information and then comparing the degree of similarity. ArcSoft person returns the face detection ASF_MultiFaceInfoobject (even if only to detect a person), a face feature extraction function information that needs to input  ASF_SingleFaceInfoobjects, so when extracting feature information, as necessary  ASF_MultiFaceInfoinformation is constructed ASF_SingleFaceInfoto extract a feature value of the object, in addition to the feature value extraction function, the other face ArcSoft extraction properties, such as: age / sex identification, in vivo detection, face angle of 3D functions are fed to ASF_MultiFaceInfothe object, but wherein the living body is detected in turn requires a single large picture can only detect a living body, beyond the return is unknown, and return up to 4 3D perspective of the value of human faces when the 3D angle detecting single big picture, these places may not be good control, you need to pay attention.

Source: http://www.1994july.club/seo/?p=2797

Guess you like

Origin www.cnblogs.com/1994july/p/12057037.html