## 2 Materials and Methods
### Technique for Detecting a Sudden Change in the Emotional State of a Crowd
#### 2.4.2 Primary Steps of the Technique  
The generalized scheme of the proposed technique with its primary steps is shown in Figure 9.  
Figure 9: The scheme of the proposed technique for detecting a sudden change in the emotional states in a crowd. Arrows here represent consistent transition from one technique block to another.  
The technique's input is a video stream from a surveillance camera at a location containing a crowd of people. Also, the input information is pre-trained classifiers for identifying negative emotional states (Fear, Anger, etc.).  
The frames of the video stream are sequentially processed. It is possible to consider not the entire sequence of frames but specific time intervals. In step 1, we select a frame with an image. In step 2, we select frames with faces on the frame (well-known approaches can be used for this). We obtain a set of faces for analysis. Next, in step 3, we initialize the changes required for work (counter faces, etc.).  
In the logical block, we determine whether the frames with faces in the frame have not ended. If finished--go to step 1--obtain the next frame of the image; otherwise--go to the steps to determine the emotional state of the \(i\)-th face (steps 4-6).  
In step 4, we define landmarks in the image. For this, a mechanism for determining specific points of the face using MediaPipe Face Mesh [42] was used. According to this method, the face is described by points in the amount of 468, which is the basis for the so-called geometric shapes of the method of geometric interpretation.  
In step 5, using the proposed method of geometric interpretation, we obtain a vector of features for classification (\(P_{u}\rightarrow\mathbf{X}^{\prime}\)). The elements of the feature vector are the quantitative characteristics of the seven parts of the face. After that, the resulting vector is normalized to bring the feature values to the range \([0;1]\). That is, the data formed by the normalized vector of facial features \(\mathbf{X}^{\prime}=(x_{1}{}^{\prime},x_{2}{}^{\prime},\ldots,x_{7}{}^{\prime})\) are presented in the form of the above-considered model for recognizing facial expressions of emotions. The result of this mapping determines the normalized feature vector \(\mathbf{X}^{\prime}\), which, together with the vector of weights \(\mathbf{W}\), forms the input data for the next step.  
Next, in step 6, we identify the emotional state using the proposed hyperplane classification method. That is, the result of this step is the belonging of the input data to one of two classes, \(d\left(\mathbf{X}^{\prime}\right)\in\left\{-1,1\right\}\), where 1 corresponds, for example, to the emotional state \"Target Class\" and 0 to the emotional state \"Not Target Class\" (all other emotions).  
When changes in the emotional state to the opposite are detected, data are generated for further analysis, and a corresponding message is issued to the services responsible for law and order. Therefore, the use of the above-proposed models and methods for identifying mimic expressions of emotions in the proposed technique makes it possible, based on the input data in the form of a video recording of a crowd of people, to obtain the resulting data in the form of emotional state assessments for the identification of abnormal emotional manifestations in a crowd of people.  
It is worth noting that the results obtained with the help of the proposed technique are transparent and interpretable, which meets the criterion of confidence in the decisions obtained with their help.