• Figure 4.
  • Figure 5.
  • OpenCV Face Recognition Classifier




    Download 0.51 Mb.
    Pdf ko'rish
    bet5/9
    Sana10.03.2024
    Hajmi0.51 Mb.
    #169713
    1   2   3   4   5   6   7   8   9
    Bog'liq
    Integration Of Face Recognition Model to a Biometr
    ALFIYAAAAAAAA, Taqdimot 91-21 7.8.9, Abdulhamid Cho\'lpon, МАЖМУА ЧКБТ 3-КУРС, Презентация, Asliddin, KOVALENT BoG, 11 sonf yakuniy nazoratlari, Amaliy Mashg\'ulot, Контроль качества пищевых продуктов, maruza2, maruza1, 1.0-Zamonaviy kompyuterlarning arxi(6-22), btl 5 lab, Korxona slayd
    OpenCV Face Recognition Classifier 
    Before the model is able to differentiate between individual faces, it must first be able to recognize a face, what features 
    faces have, and features in which faces do not have. For this research we will use a pre-trained classifier provided by 
    OpenCV called the haarcascade_frontalface.xml. The classifier will be called upon in the program with the help of the 
    cv2.CascadeClassifier as shown on Figure 4. 
    Figure 4. Part of the program that shows the algorithm to call and look for the pre-trained classifier. 
    Creating Datasets for Enhanced Training 
    The model can recognize faces after the training in the previous section [8]. However, it is still unable to differentiate between one 
    face and another. We need to create a dataset filled with a minimum of 100 gray scaled pictures of the individual we want the machine 
    to recognize. The first step is to create the program to take and store the pictures. The face_id function stores the id in the format of 
    numbers, inputted manually by the user. The id later on will be associated with the face that will captured by the camera. After we 
    input the id number, the camera will be turned on and it will take 100 photos of the person in front of the camera. The photos will then 
    be stored in the folder dataset. Each of the photos will be 
    named in the format “User.” + face_id + the number of photos, for example 


    146 | 
    P a g e
    User.1.2 is the second photo taken of the 100 total photos of the user with the id number 1. Figure 5 shows part of the program for 
    creating the datasets for the enhanced training. 
    Figure 5. Part of the program that shows the algorithm to create datasets with face ids. 
    Initiating the Enhanced Training 
    After the datasets have been created, we now have 100 grayscale pictures of 
    someone’s face which we will use for the enhanced 
    training. There are 3 unique faces used in the Enhanced training, so each of the 3 faces will have 100 grayscale images. Figure 6 
    shows the dataset created from running the program in Figure 5. 
    Figure 6. The dataset created from the program shown in Figure 5. 
    After the datasets have been made, we will then put the datasets to the training algorithm to initiate the enhanced training. Firstly, 
    we must declare in the training program, the path to reach the datasets we made by filling the name of the folder in which the 
    datasets are stored in the variable path. Secondly, we will then create the variable recognizer and fill the function 
    cv2.face.LBPHFaceRecognizer_create() so that we can 
    store and train the samples after we retrieve the datasets and its’ ids. 
    Thirdly, we will call the pre-trained classifier again to help the training algorithm to recognize the faces in the datasets as seen on 
    Figure 7. Finally, we will call the getImagesAndLabels class to get the face samples with their ids accordingly in which we will finally 
    be able to train and finally save the enhanced training in the trainer file with name and format of trainer.yml as seen on Figure 8. 
    Figure 7. Part of the training program that shows the path as well as declaring the recognizer and detector variable. 


    147 | 
    P a g e

    Download 0.51 Mb.
    1   2   3   4   5   6   7   8   9




    Download 0.51 Mb.
    Pdf ko'rish