Computer vision-based spatial behavior intelligence analysis method and system
By using computer vision technology, YOLOv5-ArcFace and YOLOv5-DeppSort-SlowFast models are used to detect faces and behaviors in the monitoring environment. Combined with a softmax classifier to assess risks, this solves the problem of low accuracy in predicting clustering and potential risks in the monitoring environment, and achieves efficient risk warning and resource optimization.
Patent Information
- Application Number
- CN202211120406.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-09-15
AI Technical Summary
Existing technologies are unable to effectively monitor crowds and potential behavioral risks in surveillance environments, have low prediction accuracy, rely on human observation leading to waste and misjudgment, cannot cope with environmental changes, and are prone to serious consequences.
A computer vision-based spatial behavior intelligent analysis method is adopted, using the YOLOv5-ArcFace model and the YOLOv5-DeppSort-SlowFast model to detect faces, expressions and human behavior, combined with a softmax classifier for risk assessment, and potential risks are judged by Euclidean distance and spatial threshold, and real-time tracking and early warning are provided.
It improves the accuracy of predicting potential risks in the monitoring environment, can issue timely warnings, reduce the waste of human resources, reduce hardware requirements, and is suitable for detection in complex backgrounds.
Smart Images

Figure CN115512293B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, in particular to a spatial behavior intelligent analysis method and system based on computer vision. BACKGROUND
[0002] With the progress of science and technology, informatization is developing more and more rapidly, and management in different environments has also changed, for example, in prisons, video monitoring also plays a positive role. At present, the work of pedestrian anomaly analysis is carried out by the manager through naked eye investigation or supervision. In actual operation, the naked eye observation method has great defects, and the prediction accuracy and timely discovery rate are also low.
[0003] The method used now has many defects, mainly including: the monitoring of potential risk of personnel gathering, single or multiple behavior, etc. is through observation by relying on manpower, which cannot be observed and analyzed at all times. When the prediction ability of the observer is wrong, it will cause great waste of manpower and material resources, and also cause irreversible serious consequences; at the same time, there is no potential risk standard in the existing method, which cannot take corresponding measures according to the specific risk; and some situations are influenced by external environment, such as weather, light, etc., which will affect the judgment ability of the observer. Because the use environment of most video monitoring is rarely in such special circumstances, it leads to great difficulty in obtaining and less data, and the existing method cannot be applied to construct an accurate spatial behavior intelligent analysis scheme with less data. SUMMARY
[0004] In view of the defects of the prior art, the present application discloses a spatial behavior intelligent analysis method and system based on computer vision. It can effectively monitor the occurrence of personnel gathering, potential behavior risk, etc. in the application environment, improve the prediction accuracy of potential risks in the application environment and issue early warning.
[0005] To solve the above technical problems, the present application provides a spatial behavior intelligent analysis method based on computer vision, comprising the following steps:
[0006] S1: training YOLOv5-ArcFace model for face recognition and YOLOv5-DeppSort-SlowFast model for human behavior detection and tracking based on data set;
[0007] S2: establishing a database of corresponding relationship between face feature vector and expression feature vector of pedestrians and their belonging categories, and a database of corresponding relationship between human behavior action feature vector and its belonging category;
[0008] S3: For the current monitoring video containing pedestrians, the trained YOLOv5-ArcFace model and YOLOv5-DeppSort-SlowFast model are used to identify the feature vectors of the three of the pedestrians' faces, expressions, and body behaviors from the video frames and their respective corresponding categories, and the DeepSort tracking module of the YOLOv5-DeppSort-SlowFast model is used to automatically assign IDs to the pedestrians for real-time tracking;
[0009] S4: The identified facial feature vectors, expression feature vectors, and body behavior feature vectors of the pedestrians are compared with the feature vectors of the same categories recorded in the database. If the Euclidean distance between them is less than the set threshold, it means that the recognition result is correct, and the next step is entered;
[0010] S5: The respective categories of the pedestrians' facial feature vectors, expression feature vectors, and body behavior feature vectors are input into the softmax classifier for potential risk classification;
[0011] S6: The current monitoring video is divided into multiple subspaces, and the pedestrians in the picture are detected, tracked, and identified. According to the unknown spatial relationship between the pedestrians and the subspaces, it is determined whether there is a group behavior. If there is, a group warning is issued. According to the behavior, expression, and spatial information of the pedestrians in the picture, it is comprehensively determined whether there is other behavior with potential risk. If there is, a corresponding potential risk behavior warning is issued, and the potential risk type is marked.
[0012] Further, the step S1 further includes:
[0013] Obtaining historical monitoring videos of pedestrians, which contain the faces, expressions, and body behaviors of the pedestrians;
[0014] A training set is prepared based on the video frames of the historical monitoring videos.
[0015] Further, the step S2 includes:
[0016] S2-1: Obtain the past monitoring videos of each pedestrian from the historical monitoring videos, which should contain the faces, expressions, and body behaviors of the pedestrians;
[0017] S2-2: Extract the facial feature vectors and expression feature vectors of the pedestrians from the past monitoring videos through the YOLOv5-ArcFace model, and label their respective corresponding categories, and then save the database;
[0018] S2-3: Detect and track the pedestrians in the video frames of the past monitoring video through the YOLOv5-DeepSort module in the YOLOv5-DeepSort-SlowFast model, and input the obtained results into the SlowFast behavior recognition module in the YOLOv5-DeepSort-SlowFast model for human body behavior action recognition, obtain the human body behavior action feature vector and label the belonging action category, and then save the obtained database.
[0019] Further, the step S3 comprises:
[0020] S3-1: Obtain the pixel matrix of the current video frame, detect the human body region and the face region by using the YOLOv5 network, and obtain the position coordinates of the human body region and the face region;
[0021] S3-2: Perform face recognition on the detected face region by using the trained YOLOv5-ArcFace model, and obtain the face feature vector and the belonging category, the expression feature vector and the belonging category;
[0022] S3-3: Track the pedestrians detected by the YOLOv5 network by using the trained YOLOv5-DeppSort-SlowFast model, and automatically assign an ID to the tracked pedestrians; perform human body action recognition on the frame sequence composed of each frame of human body region, and obtain the human body action feature vector and the belonging category.
[0023] Further, the step S4 comprises:
[0024] Compare the face feature vector of the pedestrian with the recorded face feature vector in the corresponding database, if the Euclidean distance between the two is less than the set face threshold, it is judged that the identity matching is successful; otherwise, save the face feature vector of the pedestrian in the corresponding database;
[0025] Compare the expression feature vector of the pedestrian with the recorded expression feature vector in the corresponding database, if the Euclidean distance between the two is less than the set expression threshold, it is judged that the recognition result is correct;
[0026] Compare the human body behavior action feature vector of the pedestrian with the recorded human body behavior action feature vector in the corresponding database, if the Euclidean distance between the two is less than the set action threshold, it is judged that the recognition result is correct.
[0027] Further, the step S5 comprises:
[0028]
[0029] The calculation expression of the softmax classifier is as follows:
[0030] Wherein, L1 represents the score value of each category, N represents the number of training samples, W represents the weight vector of each category, b represents the bias term, x represents the feature vector, and y represents the category;
[0031] For the classification of the face feature vector and the expression feature vector of the pedestrian, an improved classifier based on a softmax classifier is used, and the expression is as follows:
[0032]
[0033] Wherein, L represents the score value of each category, N represents the number of training samples, θ represents the included angle between W and x, and m represents the additive angle margin.
[0034] Further, the step S6 comprises:
[0035] The picture of the current monitoring video is divided into a plurality of equal subspaces, and the maximum number of people allowed to be accommodated in each subspace region is set as a space threshold value, the number of people in each subspace is counted by detecting and tracking pedestrians in the detection and tracking module in the YOLOv5-DeepSort-SlowFast model, and compared with the space threshold value, if the space threshold value is exceeded, an abnormal early warning is issued;
[0036] The results of the potential risk classification are combined with the fact that a plurality of people gather in the same subspace region and exceed the maximum number of people allowed to be accommodated in the subspace, and the determination result is divided into two categories of normal and abnormal, and the abnormal is divided into two categories of low-level abnormal and high-level abnormal;
[0037] For the display of the early warning, the low-level abnormal is marked and displayed in the picture by a yellow warning, and the high-level abnormal is marked and displayed in the picture by a red alarm.
[0038] The application further discloses a space behavior intelligent analysis system based on computer vision, comprising:
[0039] The recognition model training module is used for training a YOLOv5-ArcFace model for face recognition and a YOLOv5-DeppSort-SlowFast model for human behavior detection and tracking based on a data set;
[0040] The database module is used for establishing a database for the corresponding relationship between the face feature vector and the expression feature vector of the pedestrian and the category to which the pedestrian belongs, and a database for the corresponding relationship between the human behavior action feature vector and the category to which the human behavior action feature vector belongs;
[0041] The detection module is used for identifying the feature vectors of the face, expression and body behavior of the pedestrians in the current monitoring video and the corresponding categories thereof from the video frames by using the trained YOLOv5-ArcFace model and YOLOv5-DeppSort-SlowFast model, and automatically assigning IDs to the pedestrians by the DeepSort tracking module of the YOLOv5-DeppSort-SlowFast model for real-time tracking;
[0042] The recognition module is used for comparing the face feature vector, expression feature vector and body behavior feature vector of the recognized pedestrian with the feature vectors of the same category recorded in the database, and if the Euclidean distance between the two is less than a set threshold, it is considered that the recognition result is correct.
[0043] The classifier module is used for inputting the categories to which the face feature vector, expression feature vector and body behavior feature vector of the pedestrian belong into a softmax classifier for potential risk classification.
[0044] The risk warning module divides the picture of the current monitoring video into multiple subspaces, detects and tracks the pedestrians in the picture, judges whether there is a crowd behavior according to the unknown spatial relationship between the pedestrians and the subspaces, and if there is, issues a crowd warning; and according to the behavior, expression and spatial information of the pedestrians in the picture, comprehensively judges whether there is other behavior with potential risk, and if there is, issues a corresponding potential risk behavior warning and labels the potential risk type.
[0045] Further, the system further comprises:
[0046] The information confirmation module is used for logging in the information of the personnel and judging whether the user has the use right.
[0047] Further, the system further comprises:
[0048] The storage module is used for saving the current monitoring video content and automatically saving the current monitoring video to the local according to the pre-set time and period
[0049] Compared with the prior art, the present application has the following advantages:
[0050] The SE attention mechanism is added in the present application, the problem of false detection of the concentration of the target in the original YOLOv5 detection module is solved, the SE attention mechanism is added, the model can effectively avoid the false detection and missing detection when detecting the complex background with many items and animals in the environment, the network can pay more attention to the detection target, and the detection effect is improved.
[0051] The YOLOv5 backbone feature extraction network adopts a C3 structure, which brings a large parameter quantity and a large amount of calculation, so that the application is limited, and in actual application scenarios such as mobile or embedded devices, it is difficult to be applied in deployment, especially in the application environment requiring low delay or fast response, in order to solve the problem of slow detection speed caused by too large model parameter quantity, the YOLOv5 backbone feature extraction network is replaced by a lighter MobileNetv3 network, the number of model parameters is reduced, the amount of operation is greatly reduced, the detection speed is improved under the condition of unchanged precision. At the same time, the running speed of the model on the CPU is greatly improved, thereby reducing the demand for hardware in the model configuration process.
[0052] The application can effectively monitor potential risks existing in the application environment and timely warn, and improve the accuracy of the potential risk prediction of the pedestrians. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 A method flowchart of the spatial behavior intelligent analysis method based on computer vision disclosed by the application is shown.
[0054] Figure 2 An implementation flowchart disclosed by the preferred embodiment of the application is shown. IMPLEMENTATION METHOD
[0055] The application will be further described below in combination with the drawings, and the following implementation is only used to more clearly illustrate the technical solutions of the application, and cannot limit the protection scope of the application.
[0056] As shown in Figure 1 and Figure 2 A spatial behavior intelligent analysis method based on computer vision disclosed by the application can be applied to various monitoring environments including prisons, which includes the following processes:
[0057] S1: training a YOLOv5-ArcFace model for face recognition and a YOLOv5-DeppSort-SlowFast model for human behavior detection and tracking based on a data set.
[0058] Specifically, a historical monitoring video of pedestrians is obtained, the video image contains the behavior action, face and facial expression of the pedestrians. The video frame is used as a data set to train a convolutional neural network model, the YOLOv5-ArcFace model is used for face and facial expression recognition, and the YOLOv5-DeppSort-SlowFast model is used for human behavior action recognition.
[0059] The video acquisition standard and the classification of human faces, facial expressions, and human body behavior actions are as follows: 5000 segments of various human face, facial expression, and human body action video clips, each segment being 2-5 seconds, and each second having 25 frames, to construct a basic human face, facial expression, and human body behavior action training data set. The facial expressions include 6 basic expressions: happiness, anger, sadness, fear, surprise, and normal; the human body actions are divided into two categories, namely, single-person behavior action category and double-person behavior action category, each category including multiple sub-categories, wherein the single-person behavior actions include 8 actions: sitting down, standing up, squatting down, jumping, climbing, falling down, walking back and forth, and swinging fists left and right; the double-person behavior actions include 4 actions: fighting, kicking, pointing at each other, and pushing.
[0060] S2: Establish a database of the corresponding relationship between the facial feature vector and the expression feature vector of each pedestrian and the category to which the pedestrian belongs, and a database of the corresponding relationship between the human body behavior action feature vector and the category to which the human body behavior action belongs.
[0061] Specifically, a database of the corresponding relationship between the facial feature vector and the expression feature vector of each pedestrian and the category to which the pedestrian belongs is established. Meanwhile, a database of the corresponding relationship between the human body behavior action feature vector of the prisoner and the category to which the human body behavior action belongs is established; the specific process of establishing the human face, facial expression, and human body behavior action database for each pedestrian in the prison is as follows:
[0062] S2-1: Obtain the past monitoring video of each pedestrian, which should contain the human face, facial expression, and human body behavior action of the pedestrian;
[0063] S2-2: Extract the facial feature vector and the expression feature vector from the video through the YOLOv5-ArcFace model, obtain the facial feature vector and the expression feature vector, and store the corresponding feature vectors and mark the category to which the feature vectors belong;
[0064] S2-3: Detect and track the pedestrians in the video frames through the YOLOv5-DeepSort module in the YOLOv5-DeepSort-SlowFast model, and input the obtained results into the SlowFast module for behavior action recognition, to obtain the behavior action feature vector, store the human body behavior action feature vector, and mark the action category to which the human body behavior action feature vector belongs.
[0065] S3: For the current monitoring video containing pedestrians, the facial feature vector, expression feature vector, and human body behavior action feature vector of the pedestrians and the respective categories to which the feature vectors belong are recognized from the video frames by using the trained YOLOv5-ArcFace model and YOLOv5-DeppSort-SlowFast model, and the pedestrians are automatically assigned with IDs by the DeepSort tracking module of the YOLOv5-DeppSort-SlowFast model for real-time tracking. The process includes:
[0066] The current video stream is defined as:
[0067] V = {v1, v2, …, v n}
[0068] Wherein, V is a video stream set, v i is a video frame at time i, v i is represented by a matrix of l*w. Wherein, l is the row number of the pixel matrix of the video frame, w is the column number of the pixel matrix of the video frame; The video stream here is the real-time data collected by the monitoring camera in the actual application scene, which takes one minute as a segment and outputs 30 frames per second.
[0069] The pixel matrix of the current video frame is obtained, the YOLOv5 network is used to detect the human body region and the face region, and the position coordinates of the left upper corner and the right lower corner of the human body region detection frame and the face region detection frame are obtained; Then Kalman filtering, Hungarian matching and IOU matching are performed on the RGB three-color space to realize tracking of the moving object, and an ID is automatically assigned to the tracked object to prevent the tracked object from being lost in the picture.
[0070] The trained YOLOv5-ArcFace model is used for face recognition of the detected face region, and the face and expression feature vectors and their attribute categories are obtained.
[0071] The trained YOLOv5-DeepSort-SlowFast model is used for human behavior action recognition of the frame sequence composed of each frame of the detected human body region, and the video frame sequence is respectively transmitted into Slowpath and Fastpath, and feature extraction is respectively performed. Then, the features extracted in Fastpath and the features extracted in Slowpath are fused to obtain the human behavior action feature vector and its category.
[0072] S4: Compare the face feature vector, expression feature vector and human behavior action feature vector of the recognized pedestrian with the same category of feature vectors recorded in the database. If the Euclidean distance between the two is less than the set threshold, it means that the recognition result is correct, and the next step is entered.
[0073] Specifically, the classification result feature vector and the historical data feature vector of the pedestrian are calculated for the Euclidean distance between the vectors, and the distance threshold is set to 0.1. If the calculated Euclidean distance is less than 0.1, it is considered that the recognition is correct, otherwise it is incorrect, and it is determined that this recognition is invalid. If the judgment is correct, the category corresponding to the feature vector in the database is taken as the category corresponding to the recognition result.
[0074] S5: input the respective categories to which the pedestrian's face feature vector, expression feature vector, and human body behavior action feature vector belong into a softmax classifier, to perform potential risk classification.
[0075] Specifically, softmax is used to perform potential risk classification, and the calculation formula (1) of the softmax classifier is as follows:
[0076]
[0077] wherein N represents the number of training samples, W represents the weight vector of each category, b represents the bias term, x represents the feature vector, and y represents the category. The principle is to input the output of the previous layer as input into the softmax classifier, and obtain the probability value of each category through the classifier, wherein the probability value with the maximum value is the category to which the detected person currently belongs.
[0078] The face and face expression use a classifier improved on the basis of the softmax classifier:
[0079]
[0080] wherein L represents the score value of each category, N represents the number of training samples, θ represents the included angle between W and x, and m represents the additive angle margin.
[0081] The main working principle is to first map the features into an angle feature space, then increase the inter-class distance, and at the same time set the bias term b = 0, so as to achieve a higher recognition effect.
[0082] S6: divide the screen of the current monitoring video into multiple subspaces, detect and track and recognize the pedestrians in the screen, judge whether there is a crowd behavior according to the unknown spatial relationship between the pedestrians and the subspaces, and if there is, issue a crowd warning; according to the behavior action, face expression, and spatial information of the pedestrians in the screen, comprehensively determine whether there is other behavior with potential risk, and if there is, issue a corresponding potential risk behavior warning and mark the potential risk type.
[0083] Specifically, the current monitoring video picture is divided into multiple subspaces using OpenCV, the number of detected personnel existing in each subspace in the current monitoring video is counted according to the detection and tracking results of the YOLOv5-DeepSort model (if a pedestrian appears in multiple adjacent subspaces at the same time, the subspace to which the pedestrian belongs is determined by calculating the area value of the pedestrian entering each subspace, so as to count), whether there is a crowd behavior is judged according to the current position information and space information of the detected personnel, and whether there is a behavior with potential risk is comprehensively judged according to the behavior action, facial expression and space information of the detected personnel, if there is, a corresponding potential risk behavior warning is issued, and the type of potential risk is marked.
[0084] After a series of comprehensive information analysis, the analysis result can be divided into two categories: normal and abnormal, and the abnormal is further divided into two categories: low-level abnormal and high-level abnormal.
[0085] Among them, the judgment basis of crowd abnormality is to divide the monitoring video into multiple equal subspaces, and set the maximum number of people allowed to be accommodated in each subspace area in the prison as the space threshold value, count the number of people in each subspace through the detection and tracking module in the YOLOv5-DeepSort-SlowFast model, and compare it with the set space threshold value, if it exceeds the space threshold value, an abnormal warning is issued.
[0086] In the display process, the low-level abnormality such as individual abnormality is marked and displayed in the picture through a yellow warning, and the crowd and mutual beating, which are high-level abnormalities, need to be marked and displayed in the picture through a conspicuous red alarm.
[0087] The method disclosed by the application can effectively improve the prediction accuracy of monitoring the crowd of prisoners and other abnormal risk situations and issue early warnings.
[0088] Based on the same inventive concept as the above method, the embodiment of the application is a spatial behavior intelligent analysis system based on computer vision, which comprises:
[0089] The recognition model training module is used for training the YOLOv5-ArcFace model for face recognition and the YOLOv5-DeppSort-SlowFast model for human behavior detection and tracking based on a data set;
[0090] The database module is a database for establishing the corresponding relationship between the face feature vector and expression feature vector of a pedestrian and the category to which the pedestrian belongs, and a database for establishing the corresponding relationship between the human behavior action feature vector and the category to which the human behavior action belongs;
[0091] The detection module is configured to, for the current monitoring video containing pedestrians, identify feature vectors of faces, expressions, and body behaviors of the pedestrians and respective corresponding categories from video frames by using a trained YOLOv5-ArcFace model and a YOLOv5-DeppSort-SlowFast model, automatically assign IDs to the pedestrians by a DeepSort tracking module of the YOLOv5-DeppSort-SlowFast model, and perform real-time tracking;
[0092] The recognition module is configured to compare the identified face feature vectors, expression feature vectors, and body behavior feature vectors of the pedestrians with feature vectors of the same categories recorded in a database, and if a Euclidean distance between the two is less than a set threshold, it is determined that the recognition result is correct.
[0093] The classifier module is configured to input respective categories of the face feature vectors, expression feature vectors, and body behavior feature vectors of the pedestrians into a softmax classifier to perform potential risk classification.
[0094] The risk warning module is configured to divide a picture of the current monitoring video into a plurality of subspaces, detect and track the pedestrians in the picture, and identify the pedestrians according to unknown spatial relationships between the pedestrians and the subspaces, determine whether there is a crowd behavior, and if there is, issue a crowd warning; according to behavior actions, facial expressions, and spatial information of the pedestrians in the picture, comprehensively determine whether there is other behavior with potential risk, and if there is, issue a corresponding potential risk behavior warning and mark a potential risk type.
[0095] Preferably, the system further comprises:
[0096] The information confirmation module is configured to log in information of a user to determine whether the user has a use right.
[0097] The storage module is configured to save a current monitoring video content and automatically save the current monitoring video to a local according to a pre-set time and period.
[0098] Those skilled in the art should understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product including one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer usable program code.
[0099] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.
[0100] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.
[0101] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.
[0102] The above only is the preferred embodiment of the present application, it should be pointed out that, for those skilled in the technology in the art, without departing from the technical principles of the present application, can also make a number of improvements and variations, these improvements and variations should also be regarded as the protection scope of the present application.
Claims
1.A computer vision-based intelligent analysis method for spatial behavior, characterized by, The method comprises the following steps: S1: training a YOLOv5-ArcFace model for face recognition and a YOLOv5-DeepSort-SlowFast model for human behavior detection and tracking based on a data set; S2: establishing a database of the corresponding relationship between the face feature vector and the expression feature vector of a pedestrian and the category to which the pedestrian belongs, and a database of the corresponding relationship between the human behavior action feature vector and the category to which the human behavior action belongs; S3: for a current monitoring video containing a pedestrian, the trained YOLOv5-ArcFace model and YOLOv5-DeepSort-SlowFast model are used to identify the feature vectors of the face, expression and human behavior action of the pedestrian from the video frames and the respective corresponding categories, and the DeepSort tracking module in the YOLOv5-DeepSort-SlowFast model is used to automatically assign an ID to the pedestrian for real-time tracking; S4: comparing the face feature vector, expression feature vector and human behavior action feature vector of the identified pedestrian with the feature vectors of the same category recorded in the database, if the Euclidean distance between the two is less than a set threshold, it means that the identification result is correct, and the next step is entered; S5: inputting the respective categories of the face feature vector, expression feature vector and human behavior action feature vector of the pedestrian into a softmax classifier for potential risk classification; S6: dividing the picture of the current monitoring video into multiple subspaces, judging whether there is a group gathering behavior according to the spatial position relationship between the pedestrian and the subspaces, if there is, issuing a group gathering warning; according to the behavior action, facial expression and spatial information of the pedestrian in the picture, comprehensively judging whether there is other behavior with potential risk, if there is, issuing a corresponding potential risk behavior warning and marking the potential risk type. 2.The computer vision based spatial behavior intelligent analysis method according to claim 1, wherein, The step S1 further comprises the following steps: obtaining historical monitoring videos of pedestrians, which contain the face, expression and human behavior action of the pedestrians; obtaining a training set based on the video frames of the historical monitoring videos. 3.The computer vision based spatial behavior intelligence analysis method of claim 1, wherein, The step S2 comprises the following steps: S2-1: obtaining the past monitoring videos of each pedestrian from the historical monitoring videos, which should contain the face, expression and human behavior action of the pedestrian; S2-2: obtaining the face feature vector and expression feature vector of the pedestrian from the past monitoring videos by the YOLOv5-ArcFace model, and labeling the respective corresponding categories, and then saving the obtained database; S2-3: detecting and tracking the pedestrians in the video frames of the past monitoring videos by the YOLOv5-DeepSort module in the YOLOv5-DeepSort-SlowFast model, and inputting the obtained results into the SlowFast behavior recognition module in the YOLOv5-DeepSort-SlowFast model for human behavior action recognition, obtaining the human behavior action feature vector and labeling the action category, and then saving the obtained database. 4.The computer vision based spatial behavior intelligent analysis method of claim 1, wherein, The step S3 comprises the following steps: S3-1: Obtain the pixel matrix of the current video frame, detect the human body region and the face region by using the YOLOv5 network, and obtain the position coordinates of the human body region and the face region; S3-2: The YOLOv5-ArcFace model trained is used for face recognition on the detected face region, and the face feature vector and the category to which it belongs, the expression feature vector and the category to which it belongs are obtained; S3-3: The YOLOv5-DeppSort-SlowFast model trained is used for tracking the pedestrians detected by the YOLOv5 network, and an ID is automatically assigned to the tracked pedestrians, and the frame sequence composed of each frame of the detected human body region is subjected to human action recognition to obtain the human action feature vector and the category to which it belongs. 5.The computer vision based spatial behavioral intelligence analysis method of claim 1, wherein, The step S4 comprises: The face feature vector of the pedestrian is compared with the face feature vector recorded in the corresponding database, and if the Euclidean distance between the two is less than a set face threshold, it is judged that the identity matching is successful; otherwise, the face feature vector of the pedestrian is saved in the corresponding database; The expression feature vector of the pedestrian is compared with the expression feature vector recorded in the corresponding database, and if the Euclidean distance between the two is less than a set expression threshold, it is judged that the recognition result is correct; The human behavior action feature vector of the pedestrian is compared with the human behavior action feature vector recorded in the corresponding database, and if the Euclidean distance between the two is less than a set action threshold, it is judged that the recognition result is correct. 6.The computer vision based spatial behavioral intelligence analysis method of claim 1, wherein, The step S5 comprises: The calculation expression of the softmax classifier is as follows: Wherein, L1 represents the score value of each category, N represents the number of training samples, W represents the weight vector of each category, b represents the bias term, x represents the feature vector, and y represents the category; For the classification of the face feature vector and the expression feature vector of the pedestrian, an improved classifier based on the softmax classifier is used, and the expression thereof is as follows: Wherein, L represents the score value of each category, N represents the number of training samples, θ represents the included angle between W and x, and m represents the additive angle margin. 7.The computer vision based spatial behavioral intelligence analysis method of claim 1, wherein, The step S6 comprises: The screen of the current monitoring video is divided into a plurality of equal subspaces, and the maximum number of people allowed to be accommodated in each subspace region is set as a space threshold, the detection and tracking module in the YOLOv5-DeepSort-SlowFast model is used for pedestrian detection and tracking, the number of people in each subspace is counted, and compared with the space threshold, if it exceeds the space threshold, an abnormal early warning is issued; The results of the potential risk classification are combined with the fact that multiple people gather in the same subspace region and exceed the maximum number of people allowed to be accommodated in the subspace, and the judgment result is divided into two categories: normal and abnormal, and the abnormal is further divided into two categories: low-level abnormal and high-level abnormal; For the display of the early warning, the low-level abnormal is marked and displayed in the screen by a yellow warning, and the high-level abnormal is marked and displayed in the screen by a red alarm. 8.A computer vision-based intelligent analysis system for spatial behavior, characterized by, Comprise: The recognition model training module is configured to train a YOLOv5-ArcFace model for face recognition and a YOLOv5-DeepSort-SlowFast model for human behavior detection and tracking based on the data set; The database module is configured to establish a database of corresponding relationships between face feature vectors and expression feature vectors of pedestrians and categories to which the pedestrians belong, and a database of corresponding relationships between human behavior action feature vectors and categories to which the human behavior action feature vectors belong; The detection module is configured to, for a current monitoring video containing pedestrians, identify feature vectors of faces, expressions, and human behavior actions of the pedestrians and respective categories to which the feature vectors belong from video frames by using the trained YOLOv5-ArcFace model and the YOLOv5-DeepSort-SlowFast model, automatically assign IDs to the pedestrians by using a DeepSort tracking module of the YOLOv5-DeepSort-SlowFast model, and perform real-time tracking; The recognition module is configured to compare the identified face feature vectors, expression feature vectors, and human behavior action feature vectors of the pedestrians with feature vectors of the same categories recorded in the database, and determine that the recognition result is correct if a Euclidean distance between the feature vectors is less than a set threshold. The classifier module is configured to input respective categories to which the face feature vectors, expression feature vectors, and human behavior action feature vectors of the pedestrians belong into a softmax classifier, and perform potential risk classification. The risk early warning module is configured to divide a picture of the current monitoring video into a plurality of subspaces, detect and track pedestrians in the picture, and determine whether there is a group gathering behavior according to unknown spatial relationships between the pedestrians and the subspaces, and if there is the group gathering behavior, issue a group gathering early warning; and determine whether there is another potential risk behavior according to behavior actions, facial expressions, and spatial information of the pedestrians in the picture, and if there is the potential risk behavior, issue a corresponding potential risk behavior early warning and mark a potential risk type. 9.The computer vision-based spatial behavior intelligent analysis system of claim 8, wherein, The system further includes: The information confirmation module is configured to log in information of a user and determine whether the user has a use permission. 10.The computer vision-based spatial behavior intelligent analysis system of claim 8, wherein, The system further includes: The storage module is configured to save a current monitoring video content and automatically save the current monitoring video to a local device according to a preset time and period.
Citation Information
Patent Citations
Method and system for monitoring potential risk of prisoner based on expression and movement
CN109165685A
Dangerous area personnel monitoring method based on YOLOV5
CN113642474A