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

The model is only 7m: lightweight high precision face recognition method DBFace

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

Share

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

2020-04-10 12:47:10

Machine Heart report

Participation: Racoon X

This 7m-sized face recognition model recognizes almost all the portraits in the world's largest selfie!

Project profile

Machine Heart previously reported a cross-platform face recognition project that makes it easy to get out of 1000FPS on CPU. The project introduced this time is also a lightweight face recognition project. The difference is that on the premise of keeping a small number of parameters, the recognition accuracy of the project is much higher, and only OpenCV and PyTorch are needed to run.

DBFace is a lightweight real-time face recognition method, which has faster recognition speed and higher accuracy. The following figure shows the test results of a variety of face detection methods on WiderFace data sets. It can be seen that not only the size of the DBFace model is the smallest, but also the highest recognition accuracy is achieved in the three test tasks of Easy, medium and Hard.

Project address: https://github.com/dlunion/DBFace

WiderFace is a benchmark score dataset for face detection, which contains 32203 images and 393703 violent faces in various aspects. The dataset has different difficult tasks from simple to difficult. The following picture shows some samples in the modified data set, and you can see that it is challenging to accurately identify all the faces in the picture. It is not easy for DBFace to achieve 0.925, 0.920 and 0.847 accuracy in different tasks of the data set, respectively.

For a detailed introduction to WiderFace, please move to its website:

Http://shuoyang1213.me/WIDERFACE/

Effect display

The following figure shows the Pmurr curves of different face recognition methods on WiderFace data sets. The Pmurr curve can directly display the Precision and Recall of the two classifiers. When different algorithms need to be compared, if the Pmurr curve of one two classifier is completely wrapped by the Pmurr curve of another two classifier, it shows that the performance of the latter is better than that of the former. As you can see from the figure, the area surrounded by DBFace is relatively large in all three tasks.

When the threshold is set to 0.2, the recognition effect of DBFace on the world's largest selfie is shown below:

As we can see, the recognition accuracy of DBFace is very high, and many human faces in the picture are difficult to distinguish even by the naked eye after magnification, but DBFace can still recognize them, and the model size is only 7m, which can be run in real time on edge devices. As a result, the heart of the machine also started to test.

Project measurement

The code example provided by the project author includes the recognition of static images, as well as a GUI that calls the computer camera. It's worth noting that the project doesn't need too many dependencies, just PyTorch, Numpy, and OpenCV to run. Since the above dependent environment is a very commonly used extension library, there are a large number of corresponding installation tutorials online, so skip the installation steps here.

In main.py, image_demo () and camera_demo () correspond to static image recognition and call camera recognition respectively. The static image identification code is:

Def image_demo ():

Dbface = DBFace ()

Dbface.eval ()

If HAS_CUDA:

Dbface.cuda ()

Dbface.load ("model/dbface.pth")

Detect_image (dbface, "datas/selfie.jpg")

The above code will read the trained model, identify the image datas/selfie.jpg, and save the results to detect_result/selfie.draw.jpg.

Let's take a look at the recognition effect:

As can be seen from the above picture, even in the environment where the indoor lights vary greatly in color and shade, DBFace recognizes almost everyone in the picture, even the one in the middle who draws a rainbow while pointing at the flashing light ball and wearing a helmet. Of course, due to the low detection threshold set here, there are some misclassification phenomena. In the picture, some people's hands and the light ball in the upper right corner are mistakenly recognized as faces. This phenomenon can be eliminated by properly raising the threshold.

The code for calling the computer camera detection is:

Def camera_demo ():

Dbface = DBFace ()

Dbface.eval ()

If HAS_CUDA:

Dbface.cuda ()

Dbface.load ("model/dbface.pth")

Cap = cv2.VideoCapture (0)

Cap.set (cv2.CAP_PROP_FRAME_WIDTH, 640)

Cap.set (cv2.CAP_PROP_FRAME_HEIGHT, 480)

Ok, frame = cap.read ()

While ok:

Objs = detect (dbface, frame)

For obj in objs:

Common.drawbbox (frame, obj)

Cv2.imshow ("demo DBFace", frame)

Key = cv2.waitKey (1) & 0xFF

If key = = ord ('q'):

Break

Ok, frame = cap.read ()

Running the above code will generate a GUI interface of 640x480, and call the camera for real-time face detection.

If you are interested, please git clone this project and test it locally.

Https://www.toutiao.com/i6813939976317698567/

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