In the process of sports, athletes often have aggressive behaviors because of their emotional fluctuations. This violent sports behavior has caused many serious bad effects. In order to reduce and solve this kind of public emergencies, this paper aims to create a swarm intelligence model for predicting people's sports attack behavior, takes the swarm intelligence algorithm as the core technology optimization model, and uses the Internet of Things and other technologies to recognize emotions on physiological signals, predict, and intervene sports attack behavior. The results show the following: (1) After the 50-fold cross-validation method, the results of emotion recognition are good, and the accuracy is high. Compared with other physiological electrical signals, EDA has the worst classification performance. (2) The recognition accuracy of the two methods using multimodal fusion is improved greatly, and the result after comparison is obviously better than that of single mode. (3) Anxiety, anger, surprise, and sadness are the most detected emotions in the model, and the recognition accuracy is higher than 80%. Sports intervention should be carried out in time to calm athletes' emotions. After the experiment, our model runs successfully and performs well, which can be optimized and tested in the next step.

1. Introduction

Sports widely exist in people's daily life, most people are very fond of watching sports events, and sports exercise is a good way to relax and entertain. However, when carrying out sports activities, whether it is spectators or athletes, sometimes, due to the change of the psychological and emotional state, various sports attacks that are difficult to estimate and predict occur, and these unexpected events can easily evolve into violent conflicts, resulting in the bad influence of public order-disorder, which not only affects the normal conduct of the competition but also brings negative sports impression to the audience, especially teenagers. Based on the above background analysis, we can use the swarm intelligence model to standardize, restrain, predict, and intervene in related sports attacks and strive to minimize the bad influence. So far, there have been a lot of information about swarm intelligence optimization in practical work and life and related references. Chantal et al. [1] explored the relationship between athletes' orientation and aggressive behavior. Hu and Yin conducted research on optimal synchronous network search data extraction based on the swarm intelligence algorithm [2]. Lafuente et al. [3] studied the effects of martial arts and fighting on violent aggression and emotional self-control. Yaa et al. [4] explored the role of self-regulating mechanisms for personal values and unauthorized aggressive intrinsic exposure to sports. Dickmeis and Roe [5] used video games as predictors to predict attack behavior. Difabio et al. [6] studied the relationship between aggressive behavior and head impact kinematics in ice hockey. Fizster et al. [7] proved the challenges and opportunities of natural heuristic algorithms in sports field. Fister et al. [8] used the bat algorithm to plan sports-related training courses. Fister and Fister [9] used the swamp intelligence model to generate sports training plan through scientific and technological modeling and optimizing natural heuristic calculation. Kivi and Majidnezhad [10] introduced a novel sheep swarm intelligence algorithm. Petipas et al. [11] defined athletes' aggressive behavior and introduced measurement methods and influencing factors. Mountjoy and Engebretsen linked sports and sports medicine to reduce the risk of injury caused by unethical player behavior in sports [12]. Azimi and Tamminen [13] carried out the practice of teenagers' communication and reflection with their parents in sports. Sun et al. [14] reviewed the application of the swamp intelligent algorithm in the Internet of Things, analyzed the wireless sensor network (WSN) application supporting SI, and discussed related problems in WSN. Ghosh et al. [15] discussed the combination of artificial intelligence, Internet of Things, and data science to realize the interconnection of everything in the physical earth of intelligent network. In sports, athletes' mood fluctuates, and past techniques and models are difficult to predict specific behaviors and injury assessment. These data are easily controlled by people subjectively, and their credibility is low. We build a good prediction and evaluation model through the swarm intelligence algorithm and other algorithms and identify athletes' situation more accurately through emotional detection of physiological electrical signals.

2. Theoretical Basis

2.1. Emotion and Sports Attack

Violent emotional fluctuations will be accompanied by physical changes. With the intense emotional fluctuations, the emotions in human hearts will burst into great power. Over the years, scholars from all walks of life have studied many contents about emotions. In order to better analyze the influence of emotions and strive to accurately and comprehensively show the complex and difficult-to-capture emotions of human beings, we need to focus on the definition of emotions. Because human emotions are complex and changeable, it is difficult to express them with simple basic emotional definitions. Here, we tend to combine a more comprehensive and complex two-dimensional emotion description model with a simple emotion definition. Two-dimensional emotion description model [16] is shown in Figure 1.

The main basis is the definition of basic emotion by the researchers of the emotion model. For example, Pultchick defines emotions as acceptance, anger, expectation, disgust, joy, fear, sadness, and surprise; Tomkins defines emotions as anger, interest, contempt, disgust, pain, fear, happiness, shame, and surprise. The model we constructed is based on the judgment of evaluation degree (+) (−) and activation degree (+) (−).

Aggressive behavior is very common, and both humans and animals will have survival skills and stress performance [17]. When something happens, an individual will consciously cause harm to others or things directly or indirectly. In sports arenas, there are a large number of violent attacks, including physical conflicts, verbal abuse, and other sports attacks, which do not exist alone in individual countries but frequently appear all over the world.

Due to the limitation of research, considering multiple factors such as funds and time, the main research object of this paper only chooses sports athletes (those who have violent records and have carried out sports aggression), in order to study and identify individual emotions of athletes in the process of sports. Generally speaking, sports aggression is related to athletes' setbacks in the process of sports, which promotes personal emotional changes, such as irritability, impulsiveness, difficulty in controlling themselves, and so on. (for instinct theory, refer [18]). Athletes' personal nature is also a cause of sports aggression. As shown in Figure 2, there is a general model about attack behavior.

2.2. Internet of Things

There are various barriers between data and data and between people and data. In order to promote the interconnection of all things, the original barriers are broken, so that the originally unrelated people and data can realize the function of information exchange through the network, and the information collected by sensors and other devices is closely connected. Internet of Things (IoT) [19] is a new technology in the 21st century. Its function is the effective crossing and integration of the virtual world and real world. So far, this new technology has a good development prospect and is widely used in all walks of life in China. With the passage of time, it is gradually becoming an important symbol of China's comprehensive entry into the information age, as shown in Figure 3.

2.3. Physiological Signals

This paper will use related instruments to record the athletes' ECG, skin electrical signal, respiratory electrical signal, a total of three kinds of psychological signals, and all kinds of data into the computer using Internet of Things technology, preprocessing, and analysis. When athletes' emotional changes are stable, ECG signals have little change. If athletes' mood is under the control of high pressure, tension, irritability, and other emotions, the heart rate will accelerate greatly according to the corresponding situation, and then ECG signals can well reflect athletes' conditions. The activity of sweat glands will change with people's emotional fluctuations. If the emotional fluctuations are fierce, sweat glands will continuously increase the amount of sweat. At this time, the data obtained by testing skin electrical signals can well reflect athletes' emotions. Respiratory frequency is a way to reflect people's emotions. Studying respiratory electrical signal indicators can help to study people's current emotions. When people's emotions are unstable (such as tension, anger, and other emotions), human metabolism will increase, and the exhaled and inhaled gas content will change.

2.4. Swarm Intelligence

With the help of a series of computer operations, we can learn a huge set of data without supervision, which can facilitate us to use these data efficiently. Swarm intelligence [20] is a relatively new research. It originated from the activities and habits of various biological populations in nature, but it is not deeply studied at present and has a wide prospect. People are inspired to innovate and explore and get evolved algorithms, which prompt people to build better models and solve problems. Swarm intelligence has been developed for a long time, and many scholars have put forward the algorithm model shown in Figure 4.

2.5. Traditional Machine Learning
2.5.1. Decision Tree Algorithm

Choose C4.5 algorithm with great advantages. Construct the stochastic forest model [21].(1)Calculate the information entropy of the dataset:(2)Calculate the conditional entropy:(3)Calculate the information gain of feature A:(4)Calculate the gain ratio:Prediction of random forest:

2.5.2. Support Vector Machines

Support vector machine [22] can solve the problem of multiclassification.Under constraints:Solve the maximum value:Solving dual problems:Expression:Support vector machine discriminant function:

2.6. Deep Learning

Deep learning [23] is in the category of machine learning. This method is very mature in the field of human emotion recognition, so we can use it to recognize athletes' emotions during sports. As shown in Figure 5, it is about the abstract processing of raw data by deep learning.

2.6.1. Artificial Neural Network

Artificial neural network [24] is a mathematical model. It can simulate the information between neurons. We set the input information to x1, x2,…, xn and the weighted sum of the input signals to z.

After Z is activated, the OR value of neuron is obtained:

Several commonly used activation functions are as follows:(1)Sigmoid activation function(2)Tanh activation function(3)ReLU activation function

2.6.2. Convolution Neural Network

Convolution neural network is abbreviated as “CNN” [25]. CNN offers supervised and unsupervised learning. This kind of neural network has the function of local connection and sharing weights, and it can usually be used in the process corresponding to natural access and language. Convolution belongs to one dimension, and the formula is as follows:

3. Design of the Model

3.1. Fireworks Algorithm

In this paper, among many swarm intelligence algorithms, the new fireworks algorithm is selected as the main application object of the model, which is simple to operate and easy to use. It was inspired by fireworks that produced Mars, and Mars continued to explode and split. This algorithm has strong search ability, good exploration ability, and greater mining ability in the location range. The flow chart of the fireworks algorithm is shown in Figure 6:

The explosion radius of fireworks is Ai, the number of sparks is Si, and the total number of sparks is M:

The range of fireworks explosion is marked and controlled by two constant terms a and b, and the formula is as follows:

Gaussian mutation operation to increase spark population diversity:

If the new sparks generated during the fireworks explosion exceed the original range, we choose a new position to distribute the sparks generated by these explosions. The mapping formula is as follows:

Choose the roulette strategy for sparks, and the probability formula is as follows:

3.2. Emotional Database
3.2.1. Signal Preprocessing

After collecting the information with professional instruments, preprocessing physiological signals is the first step of all work. We try our best to extract many features of physiological signals, then identify their classifications, and establish models to identify different physiological signals. This is an extremely important step, and all subsequent work is based on this step, which is convenient for managing data and running high-quality work. Because the three physiological signals are weak and easily interfered with the external factors, in order to avoid the error of collecting information, this study needs to preprocess the physiological signals as follows: using Butterworth bandpass filter to reduce the noise of ECG signals and then using Hamilton divider to detect them; using the skin electrical signal analysis algorithm based on convex optimization; and calculating statistical characteristics of respiratory electrical signals.

3.2.2. Physiological Signal Extraction

As shown in Table 1, all features of ECG signals are extracted.

The feature extraction of the skin electrical signal mainly calculates the peak number and the average value of skin SCR; in the respiratory part, the respiratory frequency of the tested person was extracted, and the respiratory difference was compared.

The database feature engineering is shown in Figure 7:

3.3. Model Structure

The model in this paper is based on the multiview structure of deep one-dimensional convolution neural network. As shown in Figure 8:

Adding a global average pooling layer behind the connection layer can realize multiple inputs. Through this step, features extracted from different channels can be connected in series. The prediction results are output through two fully connected layers.

3.4. Evaluation of Relevance

The K-fold cross-validation method adopted in this paper has been applied by scientists and scholars for many years, which fully proves that it is an effective and good evaluation method for emotion recognition. The confusion matrix of emotions is shown in Table 2:

Accuracy, Precision, Recall, and other evaluation indexes:

4. Model Testing

The main task of this model is to collect three kinds of physiological electrical signals of athletes by using professional instruments and equipment and to test the personal emotional changes of athletes during sports by using the model. According to the emotional results of the final test, this paper analyzes the emotional tendency of athletes who want to carry out sports aggression and create violent events at that time, so that we can reverse predict the emotional outbreak point of their aggression according to the sports mood state, thus, preventing and intervening athletes' sports aggression in time and effectively. Collect the real situation and compare the accuracy of our experimental model test results, and evaluate whether the model in this study is available. If the results of comparison between the two are too different, it means that our emotion recognition model is unqualified, and more modifications and adjustments are needed, and technological innovations are carried out.

The model designed and proposed in this paper is mainly written in Python language and by using the TensorFlow 2.0 framework.

In order to eliminate the influence of various unpredictable external interference factors on the experimental results, we choose athletes with the same sports, the same training intensity, the same time, the same occasion, the same diet, and similar physical fitness. Because our model is to predict the situation of sports aggression, athletes must have a history of violence or different levels of sports aggression, so that there will not be too many problems due to the differences of athletes.

4.1. Emotion Recognition Results

Five completely balanced datasets were created randomly. The training set is 80% and the test set is 20%. The 50-fold cross-validation method was used for inspection. Using support vector machine, random forest classifier, and grid search, arousal and valence are used to compare the results. By comparing the experimental data of different emotion recognition algorithms, the accuracy and superiority of the algorithms and models used in this paper are highlighted.

4.1.1. Support Vector Machines

The comparison of several methods under the SVM algorithm is shown in Figures 9 and 10.

For the part of support vector machine, we limit its parameters in a certain range and compare the five sub-datasets of ECG, EDA, RSP, and Fusion one by one to select the optimal parameter combination. It can be seen from Figures 9 and 10 that the data results of the five datasets based on multimodal fusion are significantly better than those of single ECG, EDA, and RSP modalities, regardless of arousal classification or valence classification.

4.1.2. Random Forest Classifier

The comparison of several methods under the random forest classifier algorithm is shown in Figures 11 and 12.

4.1.3. Result Analysis

For this part of support vector machine, we limit its parameters to a certain range and compare the five sub-datasets of ECG, EDA, RSP, and Fusion one by one to choose the best parameter combination. It can be seen from Figures 9 and 10 that the result of multimodal fusion is significantly better than that of single mode.

For the part of random forest classifier, we search its superparameter parameters and compare the five sub-datasets of ECG, EDA, RSP, and Fusion one by one to choose an optimal combination. Compared with the previous support vector machine, the recognition accuracy of each subset is the same as that of the random forest classifier. We can see from Figures 11 and 12 that the result of multimodal fusion is obviously better than that of single mode, so we know that the recognition accuracy using multimodal fusion has been greatly improved.

Generally speaking, the results of emotion recognition by this model are good, and both of them have achieved high accuracy. It is worth noting that EDA has the worst classification performance compared with other physiological electrical signals, whether it is arousal or valence.

4.2. Experimental Prediction and Analysis

This part uses SPSS17.0 tools for analysis and statistics. We selected 29 athletes who had a history of violence or sports aggression for prediction and sports intervention tests.

After the test, we summarized the different emotion recognition situations fed back by athletes, as shown in Figure 13:

We can find from the table that athletes want to attack sports after a period of sports, when anxiety, anger, surprise, and sadness are the most, and the recognition accuracy is higher than 80%. Therefore, when the model monitors the emotional fluctuations of athletes, these four emotions are the most intense and frequent, so sports intervention should be carried out in time.

At this time, it is suggested that athletes should take proper rest, and the staff in the sports producing areas need to help athletes calm down the excessive arousal and activation emotions and fully reduce the level of various indicators according to the physiological conditions of athletes. It is also suggested that athletes be helped in improving negative emotions, reducing the level of attack, and preventing violent incidents caused by personal emotions or dangerous sports attacks on impulse.

5. Conclusion

In this paper, due to frequent sports violence and various out-of-control sports attacks, we use the swarm intelligence optimization algorithm and other emerging Internet technologies (such as Internet of Things) to build an intelligent model that can identify athletes' emotional fluctuations on physiological signals. This model helps to effectively predict and intervene and analyze athletes' status by the venue staff, avoid bad sudden public events, or prevent such events in time, minimize the impact, and ensure the normal income of sports venues. According to the research in this paper, we can draw the following conclusions:(1)The model has been tested by the 50-fold cross-validation method, and the result is good and the accuracy is high. Compared with other physiological electrical signals, EDA has the worst classification performance.(2)The recognition accuracy of the two methods using multimodal fusion is improved greatly, and the result after comparison is obviously better than that of single mode.(3)Anxiety, anger, surprise, and sadness are the most detected emotions in the model, and the recognition accuracy is higher than 80%. Sports intervention should be carried out in time to calm athletes' emotions.

It can be seen from the above that the swarm intelligence model designed in this paper performs well and has positive significance for the next optimization and detection. Because we have only completed the design of this model and the realization of basic functions, in order to make users have a more perfect experience, this model needs further research and optimization work and strives to widely promote the use of this model. In the follow-up work, we need to optimize the user experience of the model, such as appearance, satisfaction, and ease of operation. In addition, we also need to solve the possible code bug and improve the accuracy and other optimization work.

Data Availability

The experimental data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare no conflicts of interest regarding this work.