A real-time monitoring and early warning system and method for detention based on video algorithm

Through the indwelling real-time monitoring and early warning system based on video algorithms, using the Dlib library and dense optical flow algorithm, the problem of poor accuracy of emotional analysis in uncontrolled environments is solved, real-time monitoring and early warning of emotional states are realized, and the reliability of the system is improved. sex.

CN118470781BActive Publication Date: 2024-09-13金纪科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410925819.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-09-13
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

In uncontrolled natural environments, existing emotion analysis algorithms affect the accuracy of expression recognition due to factors such as facial differences and head posture changes, and reduce the reliability of real-time monitoring and early warning systems.

Method used

An indwelling real-time monitoring and early warning system based on video algorithms is used. Through the facial feature point detection of the Dlib library, the facial feature point displacement state coefficients are calculated, and a collection of emotion fluctuation frames is constructed. Combined with the dense optical flow algorithm, the emotion fluctuation state value is calculated to realize the emotional state. Real-time monitoring and early warning.

Benefits of technology

It improves the accuracy of facial expression changes, enhances the reliability of real-time monitoring and early warning, and can accurately judge emotional changes in images under emotional fluctuations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118470781B
    Figure CN118470781B
Patent Text Reader

Abstract

The present application relates to the field of video image processing technology, and specifically to a real-time monitoring and early warning system and method for detention based on video algorithms, the method comprising: collecting facial expression video data, obtaining each frame of image; calculating the displacement state coefficient of facial feature points of each frame of image; constructing an emotion fluctuation frame set; calculating the local micro-expression change index of each feature point of each frame of image in the emotion fluctuation frame set; calculating the emotion fluctuation significance index of each frame of image in the emotion fluctuation frame set; obtaining the image pyramid layer number of the dense optical flow algorithm, calculating the emotion fluctuation state value of the person to be tested, and real-time monitoring and early warning of the emotional state of the person to be tested. The present application can improve the accuracy of capturing facial expression changes and increase the reliability of real-time monitoring and early warning based on expression changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of video image processing, and in particular to a real-time monitoring and early warning system and method for detention based on video algorithms. Background Art

[0002] Facial expression and emotion analysis based on video analysis is of great significance in many fields. It can help understand human behavior, improve human-computer interaction, enhance customer service experience, and play an increasingly important role in healthcare, security monitoring, entertainment industry, and social media analysis. For example, in the field of customer service, by analyzing the expressions and emotions of customers, companies can adjust service strategies in a timely manner and improve customer satisfaction. In the medical field, emotion analysis can assist in diagnosing certain psychological states and provide patients with more personalized treatment plans.

[0003] However, existing emotion analysis algorithms have some defects. In uncontrolled natural environments, factors such as individual facial differences and changes in head posture may interfere with the recognition of key facial features, thereby affecting the accuracy of expression recognition. This impact may further reduce the reliability of real-time monitoring and early warning systems. Summary of the invention

[0004] In order to solve the above technical problems, a real-time monitoring and early warning system and method for detention based on video algorithm are provided to solve the existing problems.

[0005] The solution to the technical problem of this application is to provide a real-time monitoring and early warning system and method for detention based on a video algorithm, including the following steps:

[0006] In a first aspect, an embodiment of the present application provides a method for real-time monitoring and early warning of detention based on a video algorithm, the method comprising the following steps:

[0007] Collect the facial expression video data of the person to be tested and obtain each frame of image;

[0008] Based on the facial feature point detection method of the Dlib library, the feature points of each frame of the image are obtained; according to the difference in the change trend between the coordinate position and displacement distance of each feature point in different frames of the image, as well as the local discreteness of the feature points, the displacement state coefficient of the facial feature points of each frame of the image is calculated;

[0009] Based on the displacement state coefficients of facial feature points in each frame, a set of emotion fluctuation frames is constructed;

[0010] According to the local feature changes of each feature point in each frame image in the emotion fluctuation frame set and the local similarity of the feature points in adjacent frame images, the local micro-expression change index of each feature point in each frame image in the emotion fluctuation frame set is calculated;

[0011] Calculating the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set according to the local micro-expression change index of each feature point and the discrete degree of the corresponding feature point;

[0012] According to the emotion fluctuation significance index of each frame in the emotion fluctuation frame set and combined with the dense optical flow algorithm, the emotion fluctuation state value of the person to be tested is calculated, and the emotional state of the person to be tested is monitored and warned in real time.

[0013] Preferably, the calculation of the displacement state coefficients of the facial feature points of each frame of image includes:

[0014] Based on the coordinate position and displacement distance of the same feature point in two adjacent frames of images, the position state sequence and local fluctuation sequence of each feature point in each frame of image are constructed;

[0015] Calculate the difference between the position state sequence and the local fluctuation sequence of each feature point in each frame image, and record it as the feature difference degree;

[0016] Calculate the coefficient of variation of the local fluctuation sequence of each feature point of each frame image, and record it as the local dispersion of each feature point of each frame image;

[0017] The position offset of each feature point of each frame image is positively correlated with the feature difference and the local discreteness respectively;

[0018] The displacement state coefficient of the facial feature points in each frame of image is positively correlated with the position offset of all feature points in each frame of image.

[0019] Preferably, the method for constructing the position state sequence of each feature point of each frame of image is:

[0020] Combining multiple image frames in the neighborhood of each image frame into a neighboring image frame sequence of each image frame;

[0021] A rectangular coordinate system with pixels as the unit is established for each frame of image to obtain the pixel coordinates of each feature point;

[0022] The pixel coordinates of the same feature point of all images in the neighboring image frame sequence of each frame of the image are formed into a sequence, which is recorded as the position state sequence of each feature point of each frame of the image.

[0023] Preferably, the method for constructing the local fluctuation sequence of each feature point of each frame of image is:

[0024] Calculate the distance between the pixel coordinates of two adjacent feature points in each frame image in the neighboring image frame sequence of each frame image, and record it as the fluctuation change of each feature point in each frame image;

[0025] A sequence formed by the fluctuation changes of the same feature point of all images in the neighboring image frame sequence of each frame of image is recorded as a local fluctuation sequence of each feature point of each frame of image.

[0026] Preferably, the method for constructing the emotion fluctuation frame set is:

[0027] A clustering algorithm is used to cluster the displacement state coefficients of facial feature points of all images to obtain multiple clusters;

[0028] The set consisting of all images corresponding to the cluster with the largest center value is taken as the emotion fluctuation frame set.

[0029] Preferably, the calculation of the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set includes:

[0030] Taking each feature point of each frame image in the emotion fluctuation frame set as the center, a local window of each feature point is constructed;

[0031] Using a feature extraction algorithm, obtain the feature vector of the local window corresponding to each feature point of each frame image in the emotion fluctuation frame set, and record it as the local image feature vector of each feature point;

[0032] Calculate the similarity between the local image feature vectors of the same feature point in two adjacent frames of the emotion fluctuation frame set, and record it as the vector similarity of each feature point;

[0033] Different weight coefficients are preset for feature points of different facial parts as weight coefficients of each feature point of each frame image in the emotion fluctuation frame set, wherein the preset weight coefficients of feature points on eyebrows, lips and eyes are greater than the preset weight coefficients of feature points on facial contour and nose;

[0034] The local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is positively correlated with the vector similarity and the weight coefficient.

[0035] Preferably, the calculating of the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set comprises:

[0036] The fluctuation coefficient of each feature point in each frame of the emotional fluctuation frame set is positively correlated with the local micro-expression change index of each feature point and the local dispersion of the corresponding feature point;

[0037] The emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is positively correlated with the fluctuation coefficients of all feature points.

[0038] Preferably, the step of calculating the emotional fluctuation state value of the person to be tested to realize real-time monitoring and early warning of the emotional state includes:

[0039] Based on the emotional fluctuation saliency index of each frame in the emotional fluctuation frame set, the number of image pyramid layers of the dense optical flow algorithm is obtained;

[0040] Based on the same pixel point in two adjacent frames of images, the dense optical flow algorithm is used to calculate the motion vector of the same pixel point in two adjacent frames of images;

[0041] The positions of the same pixel points in all images are recorded as each element, and the sequence formed by the modules of the motion vectors of the same pixel points in two adjacent frames of images is recorded as the pixel operation sequence of each element;

[0042] The discrete degree of the pixel operation sequence is used as the emotional feature value of each element;

[0043] Normalize the emotional characteristic values ​​of all elements, and use the mean of the normalized results as the emotional fluctuation state value of the person to be tested;

[0044] Different ranges of emotional fluctuation states are divided into multiple intervals, and the emotional state of the person to be tested is monitored according to the interval range of the emotional fluctuation state value of the person to be tested.

[0045] Preferably, the method for obtaining the number of image pyramid layers of the dense optical flow algorithm is:

[0046] Normalizing the emotion fluctuation significance index of each frame in the emotion fluctuation frame set, and recording the normalized result as the first eigenvalue;

[0047] The second eigenvalue of each frame image in the emotion fluctuation frame set is negatively correlated with the first eigenvalue;

[0048] A pyramid level number is preset as a preset level value, and a result of rounding up the product of the preset level value and the second eigenvalue is used as the image pyramid level number of the dense optical flow algorithm.

[0049] In a second aspect, the embodiment of the present application further provides a real-time monitoring and early warning system for detention based on a video algorithm, including:

[0050] Video acquisition module: collects the facial expression video data of the person to be tested and obtains each frame of image;

[0051] Video image analysis module: Based on the facial feature point detection method of the Dlib library, the feature points of each frame are obtained; according to the difference in the change trend between the coordinate position and displacement distance of each feature point of different frame images, and the local discreteness of the feature points, the displacement state coefficient of the facial feature points of each frame image is calculated; based on the displacement state coefficient of the facial feature points of each frame image, an emotion fluctuation frame set is constructed; according to the local feature changes of each feature point of each frame image in the emotion fluctuation frame set, and the local similarity of the feature points in adjacent frame images, the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is calculated; according to the local micro-expression change index of each feature point and the discreteness of the corresponding feature point, the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is calculated; according to the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set, combined with the dense optical flow algorithm, the emotion fluctuation state value of the person to be tested is calculated;

[0052] Monitoring and early warning module: responsible for judging the emotional fluctuation status of the tested personnel, increasing attention to those with large emotional fluctuations, and real-time monitoring and early warning of the emotional status of the tested personnel.

[0053] This application has at least the following beneficial effects:

[0054] The present application extracts facial feature points of each frame image in a video, calculates the displacement state coefficient of the facial feature points of each frame image based on the position change of each feature point of the frame image and the change difference of adjacent feature points, and has the beneficial effect of taking into account the displacement state of the feature points caused by facial expressions in the face; constructs an emotion fluctuation frame set, calculates the local micro-expression change index according to the local feature change of each feature point of each frame image in the emotion fluctuation frame set, and determines the emotion fluctuation significance index of each frame image, and has the beneficial effect of analyzing the local expression change of each feature point under the emotion fluctuation state, so as to judge the possibility of emotion fluctuation in the image; obtains the image pyramid layer number of the dense optical flow algorithm, uses the dense optical flow algorithm to obtain the motion vector of the same pixel point in adjacent images, calculates the emotion fluctuation state value of the person to be tested, judges the emotion fluctuation state value, and realizes real-time monitoring and early warning of the emotion state, and has the beneficial effect of determining the pyramid layer number in the dense optical flow algorithm according to the change state of the facial feature points under micro-expressions, thereby improving the accuracy of capturing facial expression changes and increasing the reliability of real-time monitoring and early warning based on expression changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The following is a further detailed description of a real-time monitoring and early warning method for detention based on a video algorithm of the present application in conjunction with the accompanying drawings.

[0056] Figure 1 A flowchart of the steps of a method for real-time monitoring and early warning of detention based on a video algorithm provided in this application;

[0057] Figure 2 A flowchart of the steps of the method for obtaining the displacement state coefficients of facial feature points of each frame of image provided by the present application;

[0058] Figure 3 A flowchart of the steps of a method for obtaining a local micro-expression change index of each feature point of each frame image in an emotion fluctuation frame set provided by the present application;

[0059] Figure 4 Figure 5 A schematic diagram of facial feature points of two groups of adjacent frames of images provided in this application;

[0060] Figure 6 and Figure 7 A schematic diagram for comparing the estimation accuracy of motion vectors of pixels of two adjacent frames of images with different numbers of image pyramid layers provided by the present application;

[0061] Figure 8 A flowchart of the steps of a real-time monitoring and early warning system for detention based on a video algorithm provided in this application. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of this application more clear, the following is a further detailed description of a video algorithm-based detention real-time monitoring and early warning system and method proposed in this application in conjunction with the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.

[0063] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0064] See also Figure 1 , which shows a flowchart of a method for real-time monitoring and early warning of detention based on a video algorithm provided by an embodiment of the present application, the method comprising the following steps:

[0065] Step 1: Collect the facial expression video data of the person to be tested and obtain each frame of image.

[0066] The facial video data is collected by high-resolution cameras. The video is a sequence of multiple continuous images. When collecting video data, some videos may be adversely affected by external environmental factors such as camera hardware factors and light intensity, which will lead to poor results in the collected image sequence and interfere with subsequent facial feature extraction and recognition. Therefore, it is necessary to preprocess all images in the video to obtain each frame.

[0067] Preferably, as an embodiment of the present application, the color image in the video is converted into a single-channel grayscale image, the histogram equalization technology is used to enhance the contrast of the image, and then the image is smoothed using a Gaussian filter to effectively remove the noise in the image. Among them, the histogram equalization and Gaussian filtering methods are well-known technologies, and the specific process will not be repeated. As other implementation methods, the implementer can use other methods to pre-process the video image, and this embodiment does not impose any special restrictions on this.

[0068] Step 2: Based on the facial feature point detection method of the Dlib library, obtain the feature points of each frame image; calculate the facial feature point displacement state coefficient of each frame image according to the difference in the change trend between the coordinate position and displacement distance of each feature point in different frame images, as well as the local discreteness of the feature points.

[0069] In a face image, the position of each person's facial feature points is different. For example, the key points of eyebrows, eyes, lips and other parts are different. However, when the same emotion appears, the change state of some facial feature points will be similar. For example, the eye contour will become narrower when happy, and the eye contour and lip contour will be wider when surprised. Therefore, by analyzing the changes of feature points in key facial areas in real time, it is possible to accurately monitor the dynamics of individual expressions and capture subtle fluctuations in emotions in a timely manner.

[0070] The facial feature point detection method based on the Dlib library obtains the feature points of each frame image and outputs the position of each feature point in the face in each frame image;

[0071] It should be noted that these feature points are distributed on the eyes, eyebrows, nose, mouth and facial contours, and each feature point corresponds to a specific part of the face.

[0072] Furthermore, when the head posture changes, such as turning the head left and right or nodding, the facial feature points will change accordingly. Specifically, the position changes of these feature points are consistent between consecutive images. In this state, the change of the feature point position cannot explain the change of facial expression or emotional fluctuation. When emotional fluctuations occur, the position of some facial feature points usually changes significantly. Therefore, we first analyze the displacement relationship between all facial feature points in all images and calculate the displacement state coefficient of facial feature points. The specific method is:

[0073] Combining multiple image frames in the neighborhood of each image frame into a neighboring image frame sequence of each image frame;

[0074] Preferably, as an embodiment of the present application, 20 frames of images within the neighborhood of each frame of image are combined into a neighboring image frame sequence of each frame of image, wherein the first 10 frames and the last 10 frames of images in the video are not calculated.

[0075] A rectangular coordinate system with pixels as the unit is established with the upper left corner of the image as the origin. The horizontal and vertical coordinates of a pixel are the column and row numbers in the image array, respectively, so each feature point has a corresponding pixel coordinate;

[0076] The pixel coordinates of the same feature point of all images in the neighboring image frame sequence of each frame of the image are formed into a sequence, which is recorded as the position state sequence of each feature point of each frame of the image;

[0077] Calculate the distance between the pixel coordinates of two adjacent feature points in each frame image in the neighboring image frame sequence of each frame image, and record it as the fluctuation change of each feature point in each frame image;

[0078] Preferably, as an embodiment of the present application, the fluctuation change of each feature point is obtained by calculating the Manhattan distance between the pixel coordinates of the previous feature point and the next feature point in each frame image in the neighboring image frame sequence.

[0079] Record the sequence consisting of the fluctuation changes of the same feature point of all images in the neighboring image frame sequence of each frame of image as the local fluctuation sequence of each feature point of each frame of image;

[0080] Calculate the difference between the position state sequence and the local fluctuation sequence of each feature point in each frame image, and record it as the feature difference degree;

[0081] Preferably, as an embodiment of the present application, the DTW distance between the position state sequence and the local fluctuation sequence of each feature point is calculated, wherein the DTW distance is a well-known technology and the specific process will not be repeated.

[0082] It should be understood that this embodiment only provides a measurement method for calculating the difference between two sequences, namely, the DTW distance. As other implementation methods, implementers may use other methods in the prior art to calculate the difference between two sequences, and this embodiment does not impose any special limitation on this.

[0083] Calculate the coefficient of variation of the local fluctuation sequence of each feature point of each frame image, and record it as the local dispersion of each feature point of each frame image;

[0084] The position offset of each feature point of each frame image is positively correlated with the feature difference and the local discreteness respectively;

[0085] The displacement state coefficient of the facial feature points in each frame of image is positively correlated with the position offset of all feature points in each frame of image.

[0086] It should be understood that a positive correlation means that the dependent variable increases as the independent variable increases, and decreases as the independent variable decreases. The specific relationship may be a multiplication relationship, an addition relationship, or the idempotence of an exponential function, which is determined by actual application, and this application does not impose any special restrictions on this.

[0087] Preferably, as an embodiment of the present application, the product of the feature difference and the local discreteness is used as the position offset of each feature point in each frame image; the displacement state coefficient of the facial feature point in each frame image is the sum of the position offsets of all feature points in each frame image.

[0088] It should be noted that the smaller the feature difference, the closer the changes of the feature points on the face between adjacent frame images; if the local discreteness is smaller, it means that there is no obvious change in the distance of the facial features between adjacent frame images, which means that the local fluctuation of the facial feature points is small; if the displacement state coefficient of the facial feature point is smaller, it means that the change of the feature point may be caused by the change of head posture, and the local change caused by facial expression is smaller.

[0089] Furthermore, the present application provides a flowchart of the steps of the method for obtaining the displacement state coefficients of the facial feature points of each frame image. Figure 2 shown.

[0090] At this point, the displacement state coefficients of the facial feature points of each frame image are obtained.

[0091] Step 3, constructing an emotion fluctuation frame set based on the displacement state coefficients of the facial feature points of each frame image; calculating the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set according to the local feature change of each feature point of each frame image in the emotion fluctuation frame set and the local similarity of the feature points in adjacent frame images.

[0092] Based on the above analysis, the images with obvious facial expression changes can be extracted through the displacement state coefficients of the facial feature points in each frame.

[0093] A clustering algorithm is used to cluster the displacement state coefficients of facial feature points of all images to obtain multiple clusters;

[0094] The set of all images corresponding to the cluster with the largest center value is taken as the emotion fluctuation frame set;

[0095] Preferably, as an embodiment of the present application, a fuzzy c-means clustering algorithm is used to divide the displacement state coefficients of facial feature points of all images, wherein the number of clusters is set to 2.

[0096] It should be understood that this embodiment only provides one clustering algorithm, namely, the fuzzy c-means clustering algorithm. As other implementation methods, implementers can adopt other methods of the prior art for clustering, such as the K-means clustering algorithm, the hierarchical clustering algorithm, etc. This embodiment does not impose any special restrictions on this.

[0097] Furthermore, in the state of emotional fluctuation, the local feature points of the face will show subtle changes, for example, eyebrows will be raised or tightened, eyes will be widened or wrinkles may appear around the corners of the eyes, and the corners of the mouth will be raised or drooped. Under these micro-expressions, the image texture or other features around each feature point will change. In order to deeply analyze the local area image changes of each feature point in each frame of the emotional fluctuation frame set, the local micro-expression change index is calculated. The specific method is as follows:

[0098] For each frame image in the emotional fluctuation frame set, a local window of each feature point is constructed with each feature point as the center;

[0099] Preferably, as an embodiment of the present application, each feature point is taken as the center and the construction size is The size of the local window.

[0100] Using a feature extraction algorithm, obtain the feature vector of the local window corresponding to each feature point of each frame image in the emotion fluctuation frame set, and record it as the local image feature vector of each feature point;

[0101] Calculate the similarity between the local image feature vectors of the same feature point in two adjacent frames of the emotion fluctuation frame set, and record it as the vector similarity of each feature point;

[0102] Preferably, as an embodiment of the present application, a directional gradient histogram is used to obtain a feature descriptor of the image in each local window, and a feature vector of the local window corresponding to each feature point is obtained; the cosine similarity between the local image feature vectors of the same feature point of the previous frame image and the next frame image in the emotion fluctuation frame set is calculated and recorded as the vector similarity of each feature point; wherein, the directional gradient histogram method is a well-known technology, and the specific process will not be repeated.

[0103] It should be understood that this embodiment uses the directional gradient histogram method to obtain feature vectors and uses cosine similarity to calculate the vector similarity of each feature point. As other implementation methods, implementers can use other methods of the prior art, for example, using gray-level co-occurrence matrix to obtain feature vectors, using Euclidean distance to calculate vector similarity, etc. This embodiment does not impose any special restrictions on this.

[0104] Different weight coefficients are preset for feature points of different facial parts to obtain the weight coefficients of each feature point of each frame image in the emotion fluctuation frame set, wherein the preset weight coefficients of feature points on eyebrows, lips and eyes are greater than the preset weight coefficients of feature points on facial contour and nose;

[0105] The local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is positively correlated with the vector similarity and the weight coefficient.

[0106] Preferably, as an embodiment of the present application, the weight coefficient of the feature points of the eyebrows, lips and eyes is 0.3, and the weight coefficient of the feature points of the facial contour and nose is 0.05; the product of the vector similarity and the weight coefficient is used as the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set.

[0107] It should be noted that, due to the changes in eyebrows, lips and eyes compared to the face and nose under emotional fluctuations, different weights are assigned to the feature points of different parts; secondly, the larger the local micro-expression change index of each feature point, the more significant the change in the micro-expression of the corresponding part of the feature point.

[0108] Furthermore, the present application provides a flowchart of the steps of the method for obtaining the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set. Figure 3 shown.

[0109] At this point, the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is obtained.

[0110] Step 4, calculating the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set according to the local micro-expression change index of each feature point and the discrete degree of the corresponding feature point.

[0111] In a natural state, even if there is no significant emotional change, a small number of feature points may have a relatively large local micro-expression change index. However, in these cases, it is difficult to reflect whether the emotion fluctuates. At this time, only the local dispersion of a small number of feature points increases slightly, but the sum of the local dispersion of all feature points is still small. It can be inferred that the local micro-expression change index of each feature point and the local dispersion of most feature points will increase under the state of emotional fluctuation.

[0112] The fluctuation coefficient of each feature point in each frame of the emotional fluctuation frame set is positively correlated with the local micro-expression change index of each feature point and the local dispersion of the corresponding feature point;

[0113] The emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is positively correlated with the fluctuation coefficients of all feature points.

[0114] Preferably, as an embodiment of the present application, the fluctuation coefficient of each feature point of each frame image in the emotion fluctuation frame set is the product of the local micro-expression change index of each feature point and the local discreteness of the corresponding feature point; the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is the sum of the fluctuation significance coefficients of all feature points.

[0115] It should be noted that, if the emotional fluctuation significance index is larger, it means that the possibility of emotional fluctuation detected in the frame image is greater, and more subtle changes occur in the face.

[0116] Step 5, based on the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set, and combined with the dense optical flow algorithm, the emotion fluctuation state value of the person to be tested is calculated, and the emotional state of the person to be tested is monitored and warned in real time.

[0117] Normalizing the emotion fluctuation significance index of each frame in the emotion fluctuation frame set, and recording the normalized result as the first eigenvalue;

[0118] Preferably, as an embodiment of the present application, an exponential normalization method is used for processing, and the calculation result of an exponential function with a natural constant as the base and the negative number of the first eigenvalue as the exponent is used as the second eigenvalue of each frame image in the emotion fluctuation frame set.

[0119] The second eigenvalue of each frame image in the emotion fluctuation frame set is negatively correlated with the first eigenvalue;

[0120] It should be understood that a negative correlation means that the dependent variable decreases as the independent variable increases, and increases as the independent variable decreases. The specific relationship may be a subtraction relationship, a division relationship, a negative exponential power, etc., which is determined by actual application, and this application does not impose any special restrictions on this.

[0121] Preset a pyramid level as a preset level value, and round up a product of the preset level value and the second eigenvalue as the image pyramid level of the dense optical flow algorithm;

[0122] Based on the same pixel point in two adjacent frames of images, the dense optical flow algorithm is used to calculate the motion vector of the same pixel point in two adjacent frames of images;

[0123] Preferably, as an embodiment of the present application, a pyramid layer number is preset, and its preset layer value is 8; secondly, the Farneback optical flow algorithm is used to calculate the motion vector of the same pixel point.

[0124] It should be noted that if the number of image pyramid layers is set too large, the dense optical flow algorithm will be too sensitive to noise and local changes in the image, causing the algorithm to over-refine motion estimates at different scales, resulting in inaccurate motion estimates. As the number of layers increases, the resolution of the image decreases. If the number of image pyramid layers is set too small, the dense optical flow algorithm cannot capture large-scale motion or subtle motion changes in the image, especially for large-scale motion or rapidly changing scenes, which will lead to inaccurate motion vector estimates. Therefore, adaptively setting the number of pyramid layers according to the degree of fluctuation of each frame of the image and calculating the motion vector of the pixel point is beneficial to improving the accuracy of facial expression change analysis.

[0125] Further, the schematic diagram of facial feature points of two groups of adjacent two-frame images provided in the embodiment of the present application is as follows: Figure 4 and Figure 5 , a schematic diagram showing the comparison of the estimation accuracy of the motion vector of pixels of two adjacent frames of images with different numbers of image pyramid layers is shown in Figure 6 and Figure 7 As shown, Figure 6 in the middle Figure 4 When the number of image pyramid layers of the A2 frame image is 6, the estimation accuracy of the motion vector of pixel 13 is higher. Figure 7 in the middle Figure 5 When the number of image pyramid layers of the B2 frame image is 7, the estimation accuracy of the motion vector of pixel 30 is higher because Figure 4 The pixel 13 in the A2 frame image is the feature point of the eye. The change from the open-eye state in the A1 frame image to the closed-eye state in the A2 frame image is not particularly subtle. Figure 5 Pixel 30 in the B2 frame image is a feature point at the eyebrow. The change in the eyebrow raising from the B1 frame image to the B2 frame image is relatively subtle. Therefore, the B2 frame image requires a larger number of image pyramid layers to capture subtle movements. Therefore, the setting value of the image pyramid layer number of the B2 frame image should be greater than the setting value of the image pyramid layer number of the A2 frame image.

[0126] It should be understood that this embodiment only provides a dense optical flow algorithm, namely, the Farneback optical flow algorithm. As other implementation methods, the implementer can use other dense optical flow algorithms in the prior art to calculate the motion vector of the same pixel, such as the Horn-Schunck optical flow algorithm, etc. This embodiment does not impose any special restrictions on this.

[0127] The position of the same pixel point in all images is recorded as each element, and the sequence formed by the module of the motion vector of the same pixel point in all two adjacent frames of images is recorded as the pixel operation sequence of each element;

[0128] The discrete degree of the pixel operation sequence is used as the emotional feature value of each element;

[0129] Preferably, as an embodiment of the present application, the variance of the pixel operation sequence of each element can be calculated as the emotion feature value of each element.

[0130] Preferably, as another embodiment of the present application, the standard deviation of the pixel running sequence of each element is calculated as the emotion feature value of each element.

[0131] Normalize the emotional characteristic values ​​of all elements, and use the mean of the normalized results as the emotional fluctuation state value of the person to be tested;

[0132] Different ranges of emotional fluctuation states are divided into multiple intervals. For example, in this embodiment, the emotional fluctuation state is divided into: [0, 0.4) interval is an emotional stable state, [0.4, 0.7) interval is an emotional slight fluctuation state, and [0.7, 1] interval is an emotional large fluctuation state;

[0133] According to the interval range of the emotional fluctuation state value of the person to be tested, if the person to be tested has a large emotional fluctuation, it is necessary to increase the attention to the person and monitor the emotional state of the person to be tested.

[0134] Preferably, as an embodiment of the present application, the Min-Max normalization method is used for normalization processing. As other implementation methods, the implementer can use other normalization methods for processing, and this embodiment does not impose any special restrictions on this.

[0135] Based on the same inventive concept as the above method, the embodiment of the present application also provides a real-time monitoring and early warning system for detention based on a video algorithm, including:

[0136] Video acquisition module: collects the facial expression video data of the person to be tested and obtains each frame of image;

[0137] Video image analysis module: Based on the facial feature point detection method of the Dlib library, the feature points of each frame are obtained; according to the difference in the change trend between the coordinate position and displacement distance of each feature point of different frame images, and the local discreteness of the feature points, the displacement state coefficient of the facial feature points of each frame image is calculated; based on the displacement state coefficient of the facial feature points of each frame image, an emotion fluctuation frame set is constructed; according to the local feature changes of each feature point of each frame image in the emotion fluctuation frame set, and the local similarity of the feature points in adjacent frame images, the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is calculated; according to the local micro-expression change index of each feature point and the discreteness of the corresponding feature point, the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is calculated; according to the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set, combined with the dense optical flow algorithm, the emotion fluctuation state value of the person to be tested is calculated;

[0138] Emotional warning module: responsible for judging the emotional fluctuation status of the person being tested, increasing attention to those with large emotional fluctuations, and real-time monitoring and warning of the emotional status of the person being tested.

[0139] Furthermore, the present application provides a flowchart of a real-time monitoring and early warning system for detention based on a video algorithm as follows: Figure 8 shown.

[0140] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0141] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0142] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the present application. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application without departing from the content of the technical solution of the present application, shall fall within the protection scope of the technical solution of the present application.

Claims

1. A real-time monitoring and early warning method for detention based on video algorithm, It is characterized in that The method comprises the following steps: Collect the facial expression video data of the person to be tested and obtain each frame of image; Based on the facial feature point detection method of the Dlib library, the feature points of each frame of the image are obtained; according to the difference in the change trend between the coordinate position and displacement distance of each feature point in different frames of the image, as well as the local discreteness of the feature points, the displacement state coefficient of the facial feature points of each frame of the image is calculated; Based on the displacement state coefficients of facial feature points in each frame, an emotion fluctuation frame set is constructed; based on the local feature changes of each feature point in each frame in the emotion fluctuation frame set and the local similarity of feature points in adjacent frames, a local micro-expression change index of each feature point in each frame in the emotion fluctuation frame set is calculated; Calculating the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set according to the local micro-expression change index of each feature point and the discrete degree of the corresponding feature point; According to the emotional fluctuation significance index of each frame in the emotional fluctuation frame set, combined with the dense optical flow algorithm, the emotional fluctuation state value of the person to be tested is calculated, and the emotional state of the person to be tested is monitored and warned in real time; The step of calculating the displacement state coefficients of facial feature points of each frame of image comprises: Based on the coordinate position and distance of the same feature point in two adjacent frames of images, a position state sequence and a local fluctuation sequence of each feature point in each frame of image are constructed; Calculate the difference between the position state sequence and the local fluctuation sequence of each feature point in each frame image, and record it as the feature difference degree; Calculate the coefficient of variation of the local fluctuation sequence of each feature point of each frame image, and record it as the local dispersion of each feature point of each frame image; The position offset of each feature point of each frame image is positively correlated with the feature difference and the local discreteness respectively; The displacement state coefficient of the facial feature points in each frame image is positively correlated with the position offset of all feature points in each frame image; The method for constructing the position state sequence of each feature point of each frame image is as follows: Combining multiple image frames in the neighborhood of each image frame into a neighboring image frame sequence of each image frame; A rectangular coordinate system with pixels as the unit is established for each frame of image to obtain the pixel coordinates of each feature point; The pixel coordinates of the same feature point of all images in the neighboring image frame sequence of each frame of the image are formed into a sequence, which is recorded as the position state sequence of each feature point of each frame of the image; The method for constructing the local fluctuation sequence of each feature point of each frame image is as follows: Calculate the distance between the pixel coordinates of two adjacent feature points in each frame image in the neighboring image frame sequence of each frame image, and record it as the fluctuation change of each feature point in each frame image; Record the sequence consisting of the fluctuation changes of the same feature point of all images in the neighboring image frame sequence of each frame of image as the local fluctuation sequence of each feature point of each frame of image; The method for constructing the emotion fluctuation frame set is: A clustering algorithm is used to cluster the displacement state coefficients of facial feature points of all images to obtain multiple clusters; The set of all images corresponding to the cluster with the largest center value is taken as the emotion fluctuation frame set; The calculating of the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set includes: Taking each feature point of each frame image in the emotion fluctuation frame set as the center, a local window of each feature point is constructed; Using a feature extraction algorithm, obtain the feature vector of the local window corresponding to each feature point of each frame image in the emotion fluctuation frame set, and record it as the local image feature vector of each feature point; Calculate the similarity between the local image feature vectors of the same feature point in two adjacent frames of the emotion fluctuation frame set, and record it as the vector similarity of each feature point; Different weight coefficients are preset for feature points of different facial parts as weight coefficients of each feature point of each frame image in the emotion fluctuation frame set, wherein the preset weight coefficients of feature points on eyebrows, lips and eyes are greater than the preset weight coefficients of feature points on facial contour and nose; The local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is positively correlated with the vector similarity and the weight coefficient respectively; The calculating of the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set comprises: The fluctuation coefficient of each feature point in each frame of the emotional fluctuation frame set is positively correlated with the local micro-expression change index of each feature point and the local dispersion of the corresponding feature point; The emotional fluctuation significance index of each frame image in the emotional fluctuation frame set is positively correlated with the fluctuation coefficients of all feature points; The method of calculating the emotional fluctuation state value of the person to be tested and realizing real-time monitoring and early warning of the emotional state includes: Based on the emotional fluctuation saliency index of each frame in the emotional fluctuation frame set, the number of image pyramid layers of the dense optical flow algorithm is obtained; Based on the same pixel point in two adjacent frames of images, a dense optical flow algorithm is used to calculate the motion vector of the same pixel point in two adjacent frames of images; The positions of the same pixel points in all images are recorded as each element, and the sequence formed by the modules of the motion vectors of the same pixel points in two adjacent frames of images is recorded as the pixel operation sequence of each element; The discrete degree of the pixel operation sequence is used as the emotional feature value of each element; Normalize the emotional characteristic values ​​of all elements, and use the mean of the normalized results as the emotional fluctuation state value of the person to be tested; Different ranges of emotional fluctuation states are divided into multiple intervals, and the emotional state of the person to be tested is monitored according to the interval range of the emotional fluctuation state value of the person to be tested.

2. A method for real-time monitoring and early warning of detention based on video algorithm as claimed in claim 1, It is characterized in that The method for obtaining the number of image pyramid layers of the dense optical flow algorithm is as follows: Normalizing the emotion fluctuation significance index of each frame in the emotion fluctuation frame set, and recording the normalized result as the first eigenvalue; The second eigenvalue of each frame image in the emotion fluctuation frame set is negatively correlated with the first eigenvalue; A pyramid level number is preset as a preset level value, and a result of rounding up the product of the preset level value and the second eigenvalue is used as the image pyramid level number of the dense optical flow algorithm.

3. A real-time monitoring and early warning system for detention based on video algorithm, implementing the method as claimed in claim 1, It is characterized in that The monitoring and early warning system comprises: Video acquisition module: collects the facial expression video data of the person to be tested and obtains each frame of image; Video image analysis module: Based on the facial feature point detection method of the Dlib library, the feature points of each frame are obtained; according to the difference in the change trend between the coordinate position and displacement distance of each feature point of different frame images, and the local discreteness of the feature points, the displacement state coefficient of the facial feature points of each frame image is calculated; based on the displacement state coefficient of the facial feature points of each frame image, an emotion fluctuation frame set is constructed; according to the local feature changes of each feature point of each frame image in the emotion fluctuation frame set, and the local similarity of the feature points in adjacent frame images, the local micro-expression change index of each feature point of each frame image in the emotion fluctuation frame set is calculated; according to the local micro-expression change index of each feature point and the discreteness of the corresponding feature point, the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set is calculated; according to the emotion fluctuation significance index of each frame image in the emotion fluctuation frame set, combined with the dense optical flow algorithm, the emotion fluctuation state value of the person to be tested is calculated; Monitoring and early warning module: responsible for judging the emotional fluctuation status of the tested personnel, increasing attention to those with large emotional fluctuations, and real-time monitoring and early warning of the emotional status of the tested personnel.