Team: ESD (Face detection/recognition)
Author: Philip O Connor
Initial to start I would like thank Kamil for his excellent work on the thread design which will be used in each of the individual sections of the Lampbotics project and also his work on the workshop tutorial which demonstrated a simple implementation on how to use threads. I would also like to thank both David and Luke for their guidance over the period of this sprint. In this sprint both me and Robert were tasked with designing the face recognition system and also improving the current face detection system. Though group discussion both me and Robert created a task plan to implement these two key design features. And I was assigned the task of working on improving the face detection which mainly consisted of examining the different forms of cascades which can be implemented to improve face detection and Robert was assigned the task of working on designing a functional face recognition system. Results from testing the different forms of cascades demonstrate the following results:
- The first type of face detection cascades which were examined were the Lbp cascades. From initial testing on both my laptop and the raspberry pi results demonstrated that these types of cascades improve the speed of the processing of a detected face when compared with the haar cascades. This can be observed more promptly when tested on raspberry pi due to reduced processing power when compared with a laptops process power. This increase in speed is due to the fact that these types of cascades use integer values in the calculations which are used to detect a person’s face. The cost of this increase in process speed is that the accuracy of detecting a person’s face will be decreased.
- The second type of face detection cascades which were examined were the haar cascades. Although these types of cascades process a detected face slightly slower than the Lbp cascades the accuracy of these cascades is better than the Lbp cascades.
Results from initial testing of these cascades demonstrated that the Lbp cascades would be more ideal for embedded systems if process power becomes an issue however due to the fact for this project accuracy holds a higher priority than processing speed for the moment which means that initially the haar cascades will be used in the design. Additional testing was also performed which implemented two cascades to further improve the detection of a person’s face.
Results from implement different combinations of the haar cascades produced results that showed that the combination of the following haar cascades produced the optimal detection of a person’s face and these were the haar haarcascade_frontalface_default cascade and the haar haarcascade_profileface cascade. Where the haar frontal face cascade as the name states is used to detect a person’s face and results demonstrated the limitations of this cascade which are that this cascade does not detect a person’s face side face. So then to allow for the detection of a person’s front and side face the profile face cascade (used to detect the side of a persions face) was used along with the haar frontal face cascade.
The next step in the design of the face recognition and detection system was to combine both my design and Roberts design. The face recognition system requires a data base for known people which can then be used to determine if a person is recognized. This means that a person must be trained into this data base to allow that person to be recognized. For this sprint this section of the design will be a separate process to the section of the design which attempts to recognize a person which was done to reduce the complexity of the overall design. The following flow diagram demonstrates the simple implementation of the combined face recognition and detection:
Combined face recognition and detection:
Overview of design:
This section of the design was implemented by both me and Robert with the aim of combining the face recognition and detection into a single thread. Where based on the users input which yes or no one of these two tasks will be implemented:
If user enters yes (y) then the following process is executed which implements the combined face recognition and detection:
· Initially the image data base which is used for the face recognition will be loaded. Next using the pi camera the system will attempt to detect a person’s face and once a person’s face has been detected this frame is saved to the detected faces folder to allow this image to be process by the face recognition process. Once a face has been detected the face recognition section of the design processes the detected image and determines if this image matches any of the images which are store in the image data base. And if a match is found an output is generated which consists of two key pieces of information which are the matched subject’s image number and the level of confidence that this match is correct. Once a match has been determined the subject’s number can then be used to determine the name of that person. The last stage in this function outputs the servo values which are dependent on the X and Y positions. These values are based on a person’s face position within the image frame and using these values the servos can be reposition to a specific location.
If user enters no (n) then the following process is executed which implements the improved face detection:
· Using the pi camera the system will attempt to detect a person’s face and once a person’s face has been detected the X and Y positions of the detected face are then used to reposition the servos to a specific location. The repositioning of the servos has been limited to a range from 0 to 90. And the following movements which will be produced from different X and Y positions is shown below:
The link shown below can be used to examine the 3 initial design solutions for both the face recognition and detection code designs:
Example codes can be found from here:
Where the Comb_Face_Det_RecogV3.py file can be used to test both the face detection system and the recognition system and this example code demonstrates the key objects which were to design an improved face detection process and to also implement the face recognition into the design. This design has been split into two key programs which are training the images into the data base and the combined face recognition and detection. For further work these two programs maybe combined.
Also found in the above link is the python code which has been used for the initial testing of the improved version of the face detection which is located in the Face_Det.py file. The video clip in the below link demonstrates the basic operation of this code:
And the current version of the threaded combined face and recognition sections is shown in the Thread_function_for_Det_and_Recog.py file.
In conclusion this sprint involved many different areas of image processing for example using different cascades to detect a person’s face and altering the image captures for use with the face recognition process and provided to be a very interesting and enjoyable. Further work on this design would involve streamlining the training process for optimal efficiency and then import this training process to produce a design which implements the training, detect and recognition of a person.
Philip O Connor entry 5,