A face recognition and temperature compensation system based on Raspberry Pi

In the post-epidemic era, for quickly and accurately screening people with abnormal body temperature in small crowds and providing efficient methods for epidemic control, a multi-functional identification thermometer was designed and produced. The device uses the Raspberry PI GIS camera to accurately locate the face and identify the identity information of the measured person. The device uses the AMG8833 infrared array thermal sensor for infrared temperature measurement and the HC-SR04 ultrasonic ranging module for temperature compensation. Through multiple temperature compensation experiments, the measurement error is maintained between ±0.2°C. Based on the mathematical model of temperature compensation, the device can match the identity of people with abnormal body temperature through the database. The research results show that the device is of great significance for improving the efficiency of epidemic prevention and management cost control.


Introduction
In the context of the current global novel coronavirus epidemic, the temperature measurement face recognition system has become a common security equipment [1].These systems combine face recognition and temperature measurement technology to quickly and accurately detect human body temperature and identify people [2,3].At present, the research and application of such a system has been more extensive, whose core technology is infrared thermal imaging technology, namely, measuring the infrared radiation on the surface of human skin to obtain body temperature information [4].At the same time, this kind of system will also combine the face recognition algorithm, through the face image analysis and comparison, to achieve the function of face recognition [5].The current temperature measurement face recognition system has a high accuracy in temperature measurement, under the premise of using high-performance infrared sensors, the temperature measurement error can be controlled within ±0.3°C.In terms of real-time performance, some temperature measurement face recognition systems can simultaneously complete the temperature measurement and recognition of m ul ti ple pe o ple wi th in te n s of m ill i se cond s to m e et th e appl i c ation ne e d s o f l arge -sc ale c rowd scenarios [6].
In summary, the temperature measurement face recognition system has played an important role in the prevention and control of the novel coronavirus and influenza virus.With the continuous progress IOP Publishing doi:10.1088/1742-6596/2770/1/012021 2 of technology and in-depth research, the performance and application scenarios of this system will be further expanded and improved.
B e c a u se o f t h e p r o b l e m s i n t h e c u r r e n t t e m pe r a t u r e m e a s u r i n g f a c e r e c o g n i ti o n s y s te m , t he temperature measurement results are easily affected by the measuring distance.The temperature measurement accuracy is not high enough, and the screening of a low-fever population is not ideal.Therefore, this paper studies the temperature measurement method based on distance compensation and develops a multifunctional face recognition thermometer based on Raspberry PI.The system has the advantages of being non-contact, accurate, fast, convenient, and safe, and solves the problem that the traditional thermometer is sensitive to the measurement distance and the measurement result is not reliable.The device can be widely used in all kinds of public places, such as airports, stations, shopping malls, schools, etc., to carry out rapid temperature monitoring and identification of people entering and leaving, then realize the initial investigation of diseases and ensure public safety.

System integral design
The system is composed of two modules, namely, the face recognition module and temperature detection module, and the system structure diagram is shown in Figure 1.The temperature detection module is based on the principle of infrared temperature measurement, designed with AMG8833 infrared array, which may compensate for the temperature error caused by the distance between the face and the module, thus enabling the high precision non-contact temperature measurement function.The face recognition process includes face tracking, feature extraction, and face recognition.Face recognition and temperature compensation system.The thermometer designed in this paper uses Raspberry PI as the main control component [7].It mainly integrates high-performance 64-bit quad-core processors, with 40 GPIOs, which can be reused as I 2 C, SPI, UART, PWM, etc. AMG8833 Infrared Array is a small 8×8 infrared heat sensor array.The AMG8833 infrared Array is a small 8×8 infrared thermal sensor array that measures temperatures from 0°C to 80°C (32°F to 176°F) with a resolution of 0.25 °C and a maximum frame rate of 10 Hz.The HC-SR04 ultrasonic ranging module provides a measuring range of 2 cm-400 cm with a range accuracy of 3 mm when providing non-contact distance sensing.

Temperature compensation design
In nature, the electromagnetic wave in the wavelength range of 0.76 μm~1000 μm is called infrared radiation, which has a strong thermal effect [8,9].Infrared temperature measurement technology is to receive the thermal radiation emitted from targets and calculate the infrared radiation energy in the field of view (FOV) [10].However, in theory, the infrared radiation transmission process in the atmosphere will be attenuation due to atmospheric gas absorption, aerosol scattering, background radiation, and other environmental factors.As a result, the transmission rate of infrared radiation in the atmosphere will decrease with the increase of the measurement distance.Additionally, the spatial resolution will also have a certain impact on the infrared temperature measurement.With the increasing distance, the infrared radiation energy detected by the infrared measurement module will be reduced, resulting in the reduction of the measurement accuracy.The application of the HC-SR04 ultrasonic ranging module is to compensate the measured temperature data, namely, to determine the temperature error by determining the measured distance, then carry out the distance-temperature table operation, and compensate the error to the temperature value measured by the AMG8833 sensor, to achieve accurate measurement.The design flow chart of the infrared temperature measurement system is shown in Figure 2.

Face recognition algorithm
The face re cognition process is shown in Figure 3. First of all, the came ra equipped with the Raspberry PI system collects images of face information.Then, we grayscale the image and capture the area of the face.Next, we perform HOG conversion on this area and use the trained model to locate the face from the HOG image.Under the premise of locking the specific position of the facial features, the facial feature estimation algorithm is run to complete the normalization of the face data.The core step of this algorithm is to train the deep convolutional neural network to extract the facial features in the database that are closest and similar to the measured value of the test image, to distinguish different people by calculating Euclide distance [11,12].

Temperature compensation experiment
Since the AMG8833 infrared array module makes it easy to receive the interference of ambient temperature during operation, resulting in measurement errors, the direct output of the corresponding temperature array without temperature compensation will reduce the measurement accuracy significantly.Thus the following experiment was designed to obtain the data of the infrared temperature measurement module.Firstly, we measure and record the actual temperature of the human body with a mercury thermometer in the indoor environment (set at 25℃).On the premise of keeping the distance between the human body and the instrument unchanged, the AMG8833 infrared array thermal sensor is used for temperature acquisition.Then we calculate the numerical difference between the actual human body temperature and the measured temperature.At the same time, the distance between the human body and the instrument is measured and recorded by using the HC-SR04 ultrasonic ranging module.Finally, the experimental samples were obtained through repeated experiments.To ensure the accuracy of modeling, 24 subjects were selected in this experiment and a total of 240 trials were conducted.Since the experimental results have been well executed and the data distribution is consistent, the data from multiple trials of different subjects are averaged to obtain temperature-distance experimental samples.S i n c e t h e d i s t a n c e b e t w e e n t h e m e a s u r e d t a r g e t a n d t h e t h e r m a l s e n s o r m a y a f f e c t t h e corresponding temperature measurement, to obtain more accurate temperature measurement data, it is necessary to increase the data of measurement error compensation based on the original measurement d a t a .T o v e r i f y t h i s r e l a t i o n s h i p b e t w e e n t h e t e m p e r a t u r e e r r o r v a l u e Δ T ( u n i t : ℃ ) a n d t h e measurement distance x (unit: cm), a polynomial fit is used to obtain a fitted curve, which may express the temperature compensation curve (solid line) shown in Figure 4 with the function:

Temperature compensation model test
According to the relationship between the temperature error and the measuring distance obtained from the temperature compensation experiment, the corresponding algorithm is improved.In the experiment, three representative objects were selected to test the compensation model based on the data of distance x and temperature T. Figure 5 shows the corresponding measurement error ΔT.It can be learned from the line chart that for the first object, the maximum temperature error after compensation is +0.24℃, and the minimum measurement error is -0.19℃ when the distance x < 50 cm.Under the condition of x > 50 cm, the measurement error increases sharply.The second object with an actual temperature of 36.59℃obtained a small temperature data error.The error distribution is mainly concentrated in [-0.04℃, 0.06℃].But when the distance exceeds 50 cm, the compensated curve will gradually deviate f r o m t h e a c t u a l t e m p e r a t u r e .T h e a c t u a l t e m p e r a t u r e o f t h e t h i r d o b j e c t i s 3 6 . 2 5 ℃ , a n d a f t e r compensation, the average error of the temperature measurement is about 0.10℃.As in the previous experiment, the measurement error will increase greatly when the condition x > 50 cm is met.After-temperature-compensated experimental data.From the experimental data mentioned above, it can be intuitively seen that when the distance between the measured target and the temperature measuring device is x ≤ 50 cm, the temperature compensation system has a high accuracy.Considering the application scenario of the system, the measured object usually needs to be close to the temperature measuring device during face detection and temperature measurement.Therefore, the temperature measurement distance of < 50 cm can just achieve the ideal measurement effect.As for the face recognition experiment, it can be concluded that the accuracy of the face recognition module accuracy up to 100%, and this detection effect is not sensitive to factors such as environment and brightness.

Conclusion
Based on the hardware structure of Raspberry PI 4B, infrared array AMG8833, ultrasonic ranging module, and other hardware structures, as well as convolutional neural network face detection algorithm, a system with person identification and infrared temperature compensation functions is designed.Experiment results prove that the device meets the expected design requirements.The specific conclusions are drawn as follows: (1) Based on the convolutional neural network face recognition method, the facial identification module is designed and realized.The facial recognition experiment is set to verify the reliability of the face recognition function and optimize the effect of face recognition.
(2) Based on the infrared array AMG8833 and ultrasonic ranging unit HC-SR04, infrared real-time temperature measurement, and rapid error compensation are designed and realized.Temperature compensation results are accurate and effective within the reasonable working range of the temperature measuring device.
(3) Integrating the identification function and infrared temperature measurement function in the device, we fully equipped with the function of identification and temperature screening of a large number of mobile people in public places.

Figure 1 .
Figure 1.Face recognition and temperature compensation system.The thermometer designed in this paper uses Raspberry PI as the main control component[7].It mainly integrates high-performance 64-bit quad-core processors, with 40 GPIOs, which can be reused as I 2 C, SPI, UART, PWM, etc. AMG8833 Infrared Array is a small 8×8 infrared heat sensor array.The AMG8833 infrared Array is a small 8×8 infrared thermal sensor array that measures temperatures from 0°C to 80°C (32°F to 176°F) with a resolution of 0.25 °C and a maximum frame rate of 10 Hz.The HC-SR04 ultrasonic ranging module provides a measuring range of 2 cm-400 cm with a range accuracy of 3 mm when providing non-contact distance sensing.

Figure 2 .
Figure 2. Flow chart of the infrared temperature measurement system.

Figure 3 .
Figure 3. Flow chart (a) and test (b) of face recognition.

Figure 5 .
Figure 5. After-temperature-compensated experimental data.From the experimental data mentioned above, it can be intuitively seen that when the distance between the measured target and the temperature measuring device is x ≤ 50 cm, the temperature compensation system has a high accuracy.Considering the application scenario of the system, the measured object usually needs to be close to the temperature measuring device during face detection and temperature measurement.Therefore, the temperature measurement distance of < 50 cm can just achieve the ideal measurement effect.As for the face recognition experiment, it can be concluded that the accuracy of the face recognition module accuracy up to 100%, and this detection effect is not sensitive to factors such as environment and brightness.