Python programming example - using the Dragonboard 410c development board to achieve face recognition (2)

In the previous issue of face recognition based on the DragonBoard 410c development board, I have already taught you how to use Python to implement the first part of face recognition - face detection function. Today, based on the front face detection, further teach How do you use createFisherFaceRecognizer to perform face recognition on the dragonbaord 410c development board? Today, we will focus on the principle and calling method of this method. The processing is only to identify the face detected by the front face detection method and the face stored in the database. Matches and finally identifies the face object.

First, we need to prepare face data. Here I used the method of obtaining the face in the previous article, and wrote the getFace.py file. By executing the file, I collected the faces of three people on the Dragonboard 410c. Each person's face collects 5 different angle data and saves them in the 001, 002, and 003 folders under the usrImg folder. The corresponding names are 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5 .jpg, these data are used as training data, and then based on the data, the method provided by FaceRecognizer is used to predict the test face.

Once the data is ready, you can use this data for simple face recognition. Based on the above data, use Python to write the program, import the data into the system, and then construct the corresponding training data set and label, where the same picture corresponds to the same The label data, the specific corresponding method is as follows:

Face image label

./usrImg/001/1.jpg 0

./usrImg/001/2.jpg 0

./usrImg/001/3.jpg 0

./usrImg/001/4.jpg 0

./usrImg/001/5.jpg 0

./usrImg/002/1.jpg 1

./usrImg/002/2.jpg 1

./usrImg/002/3.jpg 1

./usrImg/002/4.jpg 1

./usrImg/002/5.jpg 1

./usrImg/003/1.jpg 2

./usrImg/003/2.jpg 2

./usrImg/003/3.jpg 2

./usrImg/003/4.jpg 2

./usrImg/003/5.jpg 2

In the reading, read the list of limg and lables by the following code:

Dir = ['./usrImg/001/','./usrImg/002/','./usrImg/003/']
Name = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg']
Lables = []
Limg = []
n = 0
For x in dir:
For y in name:
Obj = cv2.imread(x+y,0)
Obj2=cv2.resize(obj,(400,500))
Limg.append(obj2)
Lables.append(n)
n = n+1

Then you can call the methods provided in FaceRecognizer for face training, the specific code is as follows:

Model = cv2.createFisherFaceRecognizer();

Model.train(limg,np.array(lables))

After the training is completed, the test face is read. Here, the code in the previous face recognition article can be used to read the face, and then the face test can be performed. The specific code is as follows:

Img1 = cv2.imread('test.jpg',0)

Test=cv2.resize(img1,(400,500))

Result = model.predict(test)

Print result

After the completion, save the code and run the script to get the face detection result, which will output the label and similarity of the detected face. The result is as follows:

The above is the process of the entire face recognition implementation, and the subsequent blog will further improve how to use the camera to directly detect the face and identify the corresponding person, and display the name.

USB 2.0 Hubs

USB 2.0 is a USB interface standard released in 2000 with a theoretical maximum transmission speed of 480Mbps (about 60MB/s). The port has four cables (five cables for MicroUSB and MiniUSB), and the maximum output current is 0.5A. USB 2.0 is currently the most common version of USB port, almost all computers have USB 2.0 port, most USB devices also support USB 2.0. USB 2.0 hub. The device can provide USB high speed or full speed connection on the uplink port. The device also provides USB high-speed, full-speed, or low-speed connections on the downlink port. When the uplink port is connected to an electrical environment that supports only high-speed, full-speed, and low-speed connections, the high-speed, full-speed, and low-speed USB connections on the downlink port are enabled. When the uplink port is connected to an electrical environment that supports only full or low speed connections, the USB high-speed connection on the downlink port is disabled. USB 3.0 Hubs is higher than usb 2.0 in terms of transmitting data.



04

Usb 2.0 Hubs,7 Port Usb 2.0 Hub,Wireless Usb 2.0 Hub,Usb C To Usb 2.0 Hub

Henan Yijiao Trading Co., Ltd , https://www.yijiaousb.com