In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
The latest version of python interface full version
The current open source face detection model recognizes a lot, and many small partners have stepped on a lot of pits. It is believed that many friends who have used dlib and facenet Face Recognition have such doubts. Why is the accuracy rate as high as 99.8 in the paper, but the accuracy rate actually used by themselves is not good? Even the Face Recognition used to implement within 100 people often has misrecognition phenomenon. The main reason for this phenomenon comes from the training of Face Recognition model. There is a gap between the samples and domestic faces. Therefore, these seemingly high accuracy models cannot be used directly for project use. To test the performance of the two models on attendance pictures of hundreds of people, the accuracy of dlib and facenet is not ideal.
Comprehensive comparison shows that the Face Recognition interface using Rainbow is currently open source and the best choice in terms of accuracy of Face Recognition in China.
Unfortunately, the current ArcSoft does not provide python interface code for the time being. At present, there are also some cases on the Internet that use python to call ArcSoft interfaces. However, similar articles are the same, basically the same code, repeated reprints, and there is no python interface that can completely call all the functions of ArcSoft. The function name is also arbitrarily defined and difficult to remember. There is no class function member code writing prompt using pycharm development. Some unreasonable parts of the code also appear repeatedly... I really can't stand the phenomenon that the current Python API interface has been released is uneven. For this reason, I specially spent a few days to write a complete Python API interface with all the functions of the current version of Rainbow.
starting point
In essence, python interface is to use ctypes to call ArcSoft's dynamic link library. You need to go to ArcSoft's official website to select C/C++ version SDK to download dependent files. In order to use the code basically consistent with the C/C++ version of the demo code provided by ArcSoft, the function name of this python interface is the same as the function name of ArcSoft, and the structure of demo.py is basically the python translation version of the C/C++ version of the demo code.
Code address: ArcFace-python If the code is helpful to you, give it a star!
Optimization point 1. Rewrote all the structure object class print attributes and member variables, convenient python can directly print the object to view the results returned by Rainbow information, and pycharm code can provide prompt information. 2. Python interfaces in other blogs have used this approach when passing images to the ArcSoft engine:
frame_byte=bytes(frame.data)
frame_byte_p=cast(framebyte,c_ubyte_p)
But the above could be changed to:
frame.ctypes.data_as(POINTER(c_ubyte))
This reduces the cost of converting numpy images to byte streams
note
1. The current interface requires downloading the latest (2.2) C/C++ SDK version of ArcSoft.
2. ArcSoft's C/C++ interface supports many image formats, but python uses opencv for image processing in ASVL_PAF_RGB24_B8G8R8 format (that is, numpy images obtained by cv2.imread()), and this image format is used by default when using this interface. Therefore this interface depends on opencv, which can be pip installed directly if not available.
3. ArcSoft with a function will return a box of status code, to do a good job of judging the status code, to ensure that the use of correct, if the status code return value is not MOK(value is 0), indicating that the function execution error, you can compare the doc document error code explanation.
4. The first time you run the code, you need to connect to the network, because you will activate it. After you run the activation successfully for the first time, you will get an ArcFace64.dat file. After you have this file, you can not execute the activation code.
5. Function operations involving incoming images, to ensure that the width of the incoming image is an integer multiple of 4, if not, to do crop in advance, or to do resize operations.
6. The current default is image detection mode, and the faceID in the face attribute value is always empty. If it is necessary to run video face detection, you can change ASF_DETECT_MODE_IMAGE in the initialization engine function to ASF_DETECT_MODE_VIDEO, that is, it represents tracking mode, so as to reduce the consumption of face detection, and the faceID in the returned face information will have a value, which is very useful in video Face Recognition, and can reduce repeated face extraction and recognition.
7. Feature value and face attribute detection may fail. When Rainbow performs feature extraction and attribute extraction, it will have a judgment operation on the face area. If the face is blurred or the provided face coordinate position is not correct, it will return 81925(low confidence of face feature detection result) error code. So be sure to pay attention to the return status code.
8. Rainbow has two objects ASF_SingleFaceInfo (single face information) ASF_MultiFaceInfo (multiple face information) describing the position and angle information of face detection. The flow of Face Recognition is to detect the face first, then extract the feature value information of the face, and then compare the similarity with the feature value information. ASF_MultiFaceInfo object returned when ArcSoft face detection (Even if only one person is detected), the function for extracting face feature information needs to input ASF_SingleFaceInfo object, so when extracting feature information, ASF_SingleFaceInfo object needs to be constructed according to the information in ASF_MultiFaceInfo to extract feature values. In addition to extracting feature value function, Rainbow extracts other face attributes, such as: Age/gender recognition, living body detection, face 3D angle and other functions are to be sent to ASF_MultiFaceInfo object, but the living body detection also requires that only one living body can be detected in a single large image, beyond the return unknown, while 3D angle detection of a single large image can return at most 4 face 3D angle values, these places may not be well controlled, need to pay attention.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.