# Intelligent Transport Surveillance Memory Enhanced Method for Detection of Abnormal Behavior in Video

Authors: Deng-Hui Zhang
Journal: Journal of Advanced Transportation
 (2022)

---

## Abstract

The purpose is to build a better intelligent transport platform and improve the performance of surveillance video abnormal behavior detection systems under rapid progress of science and technology, to process large-scale traffic surveillance video data. Autoencoder (AE) can detect abnormal behavior by using reconstruction error information. However, it cannot decode some abnormal codes well, so an AE based on memory needs improvement. The objective of this research is to propose a model where abnormal surveillance video can be handled. Therefore, a self-coding method based on memory enhancement is proposed. The steps are as follows: different abnormal behavior detection system algorithms are analyzed at first. The characteristics of three different methods, namely, the original autoencoder (AE), recurrent neural network, and convolutional neural network, are compared. Then, a memory module is proposed to enhance the automatic encoder to reduce the reconstruction error of normal samples and increase the reconstruction error of abnormal samples. The effect image is obtained by Laplace transform and convolution for the image with low definition, and the image with noise is processed by guided filtering. Finally, different methods are used for experimental comparison. Experiments show that, on the dataset Avenue, the frame-level result of the method proposed is about 2% higher than that of the optimal ConvLSTM in the comparison method; on the Ped1 and Ped2 datasets, it is also about 3% higher than ConvLSTM. The comparison of different methods shows that the effect of the method proposed is the best. The self-coding traffic surveillance video abnormal behavior detection system based on memory enhancement is designed with a modular structure and it uses the self-coding method based on memory enhancement. The effectiveness of the proposed method in the real scene is verified by comparing the performance of different methods in the same data set (Xia and Li, 2021).


---

## Body

## 1. Introduction

Intelligent transport was founded on September 2, 2014. It is a transportation-oriented service system that fully combines modern electronic information technologies such as Internet of things, cloud computing, artificial intelligence, automatic control, and mobile Internet in the transportation field [1]. Through various high and new technologies, it controls and supports all aspects of transportation fields such as traffic management, transportation, and public travel, as well as the whole process of traffic construction management. With the increase of monitoring equipment, the detection of abnormal behavior in surveillance video plays a crucial role in the construction of intelligent transport. The increasing number of vehicles on the road leads to more frequent traffic accidents. The intelligent traffic monitoring system can help deal with traffic accidents and improve the processing efficiency of traffic accidents.


## 2. Related Work

For a long time, researchers have done a lot of research in video abnormal behavior detection. Chen proposed a general framework for analyzing people based on extracting set features from surveillance video foreground. This method could flexibly integrate different foreground detection technologies to adapt to different monitoring environments. Moreover, the representative features that could be extracted depended on heterogeneous foreground data. Finally, a classification algorithm was applied to these features to automatically model crowd behavior and distinguish abnormal events from normal patterns [2]. Fan et al. proposed a crowd abnormal behavior detection method based on improved statistical global optical flow entropy. This method could better describe the chaotic degree of the crowd, extract the optical flow field from the video sequence, and obtain the two-dimensional optical flow histogram. Then, combined with information theory and statistical physics, the improved optical flow entropy was calculated from the two-dimensional optical flow histogram [3]. Shen and Wu proposed an abnormal crowd behavior detection algorithm based on image processing, which was mainly to determine the region of interest through the rapid flow of people on the bus; the moving target was extracted by improving the Vi Be algorithm, and the multiscale sliding window algorithm was introduced to determine the recognition area; combined with the continuous multiframe recognition area, the abnormal behavior recognition of the improved convolutional neural network (CNN) algorithm was carried out, and the recognition results were used to judge whether the crowd in the bus was abnormal [4]. Xia and Li proposed an accurate and effective abnormal behavior detection method, introduced a new time attention mechanism to learn the contribution of different historical appearance features at the same location to the current features, so as to solve the representation problem of dynamic motion features. The Long Short-Term Memory (LSTM) network was used to decode the time attention of the historical feature sequence and predict the characteristics of the current time [5]. Zhou et al. proposed a new behavior recognition framework. In this framework, a target depth estimation algorithm was proposed to calculate the three-dimensional spatial position information of the target, and the information was used as the input of the behavior recognition model. Meanwhile, a skeleton behavior recognition model based on spatiotemporal convolution and attention-based LSTM was proposed to obtain more spatiotemporal information and better process long-term video [6]. Harrou et al. proposed an automatic monitoring scheme based on Vision, which was especially used for atypical event detection and location in crowded areas [7].In video abnormal behavior detection, the deep learning method has made a lot of contributions. For example, recurrent neural network (RNN) [8], convolutional neural networks (CNN) [9], and LSTM network [10] are all applied to video abnormal behavior detection. Autoencoder (AE) can detect abnormal behavior by using reconstruction error information. However, it cannot decode some abnormal codes well, so an AE based on memory enhancement is proposed. The memory retrieval step is added in the process of encoding and decoding, and the memory module is updated by the encoder and decoder simultaneously, which expands the abnormal reconstruction error information and improves the detection performance of the system. Several public datasets are used to verify the detection effect of memory enhanced self-coding.


## 3. Methodology

The steps of methodology are from Sections3.1 to 3.6. Figure 1 is framework of an abnormal behavior detection process based on memory enhancement self-coding: Figure 1 is an abnormal behavior detection process based on memory enhancement self-coding: The method flow is as follows. First, the obtained original monitoring image is preprocessed into an image more suitable for analysis. Then, the relevant information is extracted into memory enhancement AE for information reconstruction. The reconstructed image is compared with the original image, and the error obtained is compared with the set threshold to see if there is abnormal behavior. The specific process of feature extraction is standardized space, image gradient, gradient histogram, and feature collection. The specific process of pedestrian behavior detection is training sample set, sample processing, feature extraction, labeling, and training. The trained model can detect pedestrians. Figure 2 reveals that the model can well detect passer-by targets.Figure 1
Flowchart of abnormal behavior detection.Figure 2
Pedestrian detection renderings.


### 3.1. AE Principle

As one of the most crucial methods in deep learning technology, AE is generally used in compressed video, image reconstruction, and video codec. AE consists of two parts, encoding and decoding. The function of AE is to reconstruct the original image data after a series of network layer processing and reconstruct the reconstructed image similar to the original image using the decoded data. The coding process is(1)y=fWx+b.AE also needs to cooperate with the activation function in the coding process to change the simple linear structure of the network, so that it has higher learning ability and learns more feature information. The decoding process is(2)x′=fW′x+b′.AE needs to use loss function to reduce error in the process of encoding and decoding:(3)L=−logPx|x′.To improve the feature expression of the hidden layer and better represent the structural information of the input signal, researchers propose noise reduction AE. The main process is to add noise to the original input information and then input the noise information into the traditional AE to reconstruct the signal. The process is as follows:(4)x^∼qDx^|x,h1=σeW1x+b1,y=σdW2h1+b2.qDx^|x is noise distribution; W1 is coding weight; b1 is coding offset; W2 is decoding weight; b2 is decoding offset; x^ is input of mixed noise information. The loss function is(5)JDAEW=∑E∼x∼qDx˜|x∼Lx,y.Noise reduction AE is the use of artificial noise in the input to obtain better feature expression. The advantage is good robustness, and the disadvantage is that the time for adding noise needs to be increased before training, which increases the training time compared with AE [11]. Variational AE adds a generation part to the coding part and decoding part, and the coding part and decoding part are trained simultaneously [12]. The objective function is(6)Px=∫Px|z;θPzdz.x is input data; z is implicit variable; Px is maximized generation probability; θ is model parameters. For the loss function, the similarity of two variables is evaluated:(7)DQz|xPz|x=Ez∼QlogQz|x−logPz|x.The objective function is obtained by transformation:(8)logPx−DQz|xPPz|x=Ez∼Qlogxz|x−DQz|xPPz.Convolution AE is an optimized multilayer neural network model, which transforms the input expression into a new expression and then decodes it [13]. Training AE equation is(9)minθ,γ∑xLrecx,x^,withx^=decγencθx,where enc θ is the encoder, is the decoder, θ and γ are the parameters, and x is the input. Convolution AE is an improved structure using convolution layer and pooling layer on the original AE:(10)hk=σx∗wk+bk,y=σhk∗w^k+c.hk and bk are convolution kernel parameters; k is number of convolution kernels. The input and output are compared to obtain the complete convolution AE:(11)E=12n∑xi−yi2.Convolution AE has the advantage of better image data processing and a better reconstruction effect.


### 3.2. RNN and LSTM Network

Traditional neural networks are prone to problems when dealing with some sequence data, especially when these sequence data have an up-down relationship, so RNN appears. The advantage of RNN is that it has a memory mechanism, which can fully analyze the relationship among these data when dealing with the problems related to these sequence data with up-down connection, and it is more optimized on the whole [14]. Figure 3 shows the structure of RNN.Figure 3
Structure diagram of RNN.x is input of current time h; s is hide node status at present; o is output (RNN processing). The specific equation reads(12)st=fUxh+Wsh−1+b,ot=softmaxVsh+c.Activate function sigmoid isf; U and W are weight matrix between layers; b and c are offset value. RNN has the advantage of sharing model parameters at different times and can deal with long-term dependence problems. However, its disadvantages are obvious, such as the unstable update of model parameters, the existence of gradient explosion or disappearance, and only short-term memory.LSTM is an improvement of the RNN model. A “gate” structure is added, which can solve the problem caused by too long distance, even when the length of the data sequence is different [15]. The neurons of the LSTM model are composed of unit state, output gate, input gate, and forget gate. The operation mode of the forget gate: sigmoid function allocates the weighted calculation value of input pt at current time t and output nt-1 at time t−1 and uses the above to control the influence of sequence information of past output on input streams. The equation is(13)gt=σWf⋅nt−1,pt+bg.The values of input pt at time t and output nt-1 at time t−1 is weighted by the sigmoid function, expressed as (14). The new state candidate value At˜ of the unit is generated by the nonlinear tanh function. The new unit state At can be obtained only by adding the two and then passing through the forget gate and the input gate.(14)st=σWi⋅nt−1,pt+bs,At˜=tannWc⋅nt−1,pt+bA,At=gt⋅At−1+st⋅At˜.The output gate outputsqt value. The sigmoid function needs to be used to weight the input pt at current time t and output nt-1 at time t−1, expressed as (15). Next, the output of the LSTM unit is calculated and controlled by the nonlinear tanh function, and finally the output value nt is obtained. The advantage of LSTM is to solve the data problem due to long distance.(15)qt=σWq⋅nt−1,pt+bq,nt=qt⋅tannAt.


### 3.3. CNN

CNN is a feedforward neural network, which has excellent performance for large-scale image processing [16]. Figure 4 shows the structure of the CNN model. The picture is convoluted by the convolution layer first and then pooled. After several convolution and pooling operations, the obtained characteristic information is sent to the fully connected layer and finally sent to the output layer, and the size of the output layer is determined by the task of CNN.Figure 4
Curves of sigmoid, tanh, and ReLU activation functions.The detail of Figure5 is here; this figure shows the schematic connection of the CNN model. The size of the feature map after convolution operation is calculated by(16)Sizeout=Sizein−F+1stride.Figure 5
Schematic diagram of CNN model.Through filling, the size of the feature map remains unchanged after convolution. The same filling means that the size of the characteristic image remains unchanged after the convolution operation, and its equation is(17)Sizeout=Sizein+2×padding−F+1stride,padding=F−12.Sizeout is the output size of the feature map; Sizein is the input size of the feature map; F is the size of the convolution kernel; stride is the step size; padding is the number of circles filled around the feature graph. Convolution layer characteristics are local connection and convolution kernel sharing. Local connection is that the nodes of the convolution layer only connect some nodes of the previous layer, so as to reduce the number of parameters, improve the calculation speed, and effectively reduce the overfitting probability. Convolution kernel sharing means that when extracting a feature map, the same convolution kernel is shared between positions to reduce the number of parameters and further improve the calculation speed. The purpose of the pooling layer is to compress data, reduce parameters, and improve calculation speed. Fully connected layer: it is the hidden layer of a traditional neural network. Each neuron in this layer is connected with the previous neuron, so the number is the largest. In CNN, the convolution layer, pooling layer, and fully connected layer need to add activation functions. The common activation functions are sigmoid, tanh, and ReLU. The central value of the output value of the sigmoid function is not 0, and gradient dispersion will occur during the backpropagation of the deep neural network. Figure 4 is a comparison diagram of sigmoid, tanh, and ReLU function curves.tanh function: the output value of the function is centered on 0. Although the convergence speed is faster, there is gradient dispersion. ReLU function: it is the commonly used activation function at present, which solves the gradient dispersion, has fast convergence speed, and can reduce the possibility of overfitting. LeakyReLU activation function is an improved version of the ReLU function. The equation is as follows. Generally, 0.01 is taken as the value ofa, which is a constant with a constant value.(18)fx=x,x≥0,ax,x<0..CNN propagates forward layeri output. Weight is W; offset is b. The input of each layer in the network is the output of the previous layer.(19)xi=fui,ui=Wixi−1+bi.Overall loss function:(20)EN=12∑n=1N∑k=1ctkn−ykn2..N is total number of samples; c is number of sample categories; tkn is k-dimension of the n-th sample label; ykn is the n-th sample output of k-dimension. Each layer of CNN uses the gradient descent method to update the weight. The equations of weight update and offset update are as follows:(21)Wni=Woi−η∂E∂Woi,bni=noi−η∂E∂boi.Woi is weight and offset before updating; Wni and bni are updated weight and offset; η is learning rate in gradient descent method. The convolution layer in CNN is forward propagation. The convolution output characteristic diagram of each i layer is as follows:(22)xji=f∑l∈Mj⋅xli−1⋅klji+bj.Mj is input characteristic graph; klji is convolution kernel; f is activation function. The equations of CNN backpropagation, pooled layer error backpropagation, convolution layer error direction propagation, convolution layer weight update, and offset update are as follows:(23)δi−1=up sampleδi⊙σ′ui−1,δi−1=δi∂δi/∂δi−1=δi∗rot180Wi⊙σ′ui−1,∂E/∂Wi=∂E/∂ui∂ui/∂Wi=xi−1∗δi,∂E/∂bi=∑u,vδiu,v.up sampleδi is sampling operation; is Hadamard product; δ is error; i is layer i; E is loss function.


### 3.4. Memory Enhancement AE

The generalization of AE itself is too high, resulting in the decoder being unable to decode abnormal coding well during reconstruction. The memory module is introduced to enhance AE. When new test information is input, the memory enhancement AE will not directly encode and input to the decoder but find relevant contents in the memory module and send all contents to the decoder. During training, the encoder and decoder update the memory module simultaneously to reduce the reconstruction error of normal samples and increase the reconstruction error of abnormal samples. Figure6 presents a structure diagram of memory enhancement AE.Figure 6
Memory enhancement structure.Figure6 shows the specific process of memory enhancement AE and it is as follows. The encoder first obtains the encoded value of the input information, queries the relevant content according to the encoded value in the memory module, and then sends the content to the decoder for reconstruction. The output of the memory enhancement module is(24)z^=wM=∑i=1Nwimi,w is nonnegative row vector with sum 1; wi is one of w; M is memory storage unit coefficient; z^ is reconstructed input features; N is memory storage unit capacity. Calculation during training and prediction:(25)wi=expdz,mi∑j=1Nexpdz,mi,dz,mi=zmiTzmi.dz,mi is similarity variables of input features and memory storage units; z is input feature. To restrict the reconstruction of abnormal features, the correlation coefficient is constrained, and the small weight coefficient is set to 0 during hard compression.(26)wi=hwi;λ=wi,ifwi>λ0,otherwisewi=maxwi−λ,0⋅wiwi−λ+ε.λ is sparse threshold, value 1/N; ε is very small positive scalar.


### 3.5. Surveillance Video Image Processing

There are multiple problems in traffic monitoring equipment, such as low image resolution, low video definition, and poor lighting conditions, resulting in image blur and so on. Before behavior analysis, image processing and interference elimination must be carried out on the surveillance video screen, that is, preprocessing some images. Image enhancement technology is to highlight crucial information and eliminate miscellaneous information to achieve the effect of image enhancement. Image enhancement includes image sharpening, smoothing, and histogram processing [17]. Image sharpening is to enhance the edge information of the image through operation, improve the clarity of the blurred image, facilitate observation and recognition, and extract the edge information of the target. For an image Fx,y, the gradient vector and gradient amplitude are(27)∇Fx,y=∂F∂x,∂F∂y,∇Fx,y=∂F∂x2+∂F∂y2.The equation of digital images is(28)∇Fx,y=Fx,y−Fx+1,y2+Fx,y−Fx,y+12Gx,y=∇Fx,yGx,y=∇Fx,y,∇Fx,y>T,Fx,y,otherwise,Gx,y=Lα,∇Fx,y>T,Fx,y,otherwise.The above three are methods of outputting sharpening results. Gradient replaces sharpening output, and the overall brightness of the image becomes lower, affecting recognition [18]. Output threshold judgment can be sharpened without affecting the background. Laplace operator is suitable for images with low contrast and brightness. This method is used to enhance video images here. For binary images, the expression is(29)∇2F=∂2F∂x2+∂2F∂y2,∂2F∂x2=Fx+1,y+Fx−1,y−2Fx,y,∂2F∂y2=Fx,y+1+Fx,y−1−2Fx,y,∇2F=Fx+1,y+Fx−1,y+Fx,y+1+Fx,y−1−4Fx,y.The above equations can be understood as follows. The Laplace operator of a point in the image is the difference between the gray value of its surrounding adjacent pixels and its own gray value. If the operator is rotated in a certain direction and added to the original operator, it is an eight-neighborhood operator:(30)gx,y=Fx,y+c∇2Fx,y.gx,y is output image; c is coefficient; Fx,y is original image. The enhanced image can be obtained by convoluting the obtained operator with the original image (Figure 6):In Figure7, the left is the original image of the surveillance video, and the right is the enhanced image. It is obvious that after the convolution operation on the image with low brightness, the image effect is significantly enhanced compared with the original image, which is very beneficial for the next analysis. Image smoothing is to filter out the high-frequency information in the image and retain the effective low-frequency information. Generally, a low-pass filter is used to remove the noise of the image [19]. Gaussian filtering is a common method. The binary Gaussian function and single element are calculated as follows:(31)Gx,y=12πσ2e−x2+y2/2σ2,Hi,j=12πσ2e−i−k−12+j−k−12/2σ2.Figure 7
Effect drawing of Laplace operator.σ is variance; k is matrix dimension. The larger the σ is, the better the smoothing effect is. For the discrete image, discrete points are used as weights to weigh each pixel and the surrounding area to eliminate Gaussian noise. When the amount of calculation is too large, the filtering should be realized by Fourier transform. The advantage of bilateral filtering is that it considers not only the space near the image, but also the pixel similarity. It can eliminate image noise while retaining edge information, and the effect is better than the original denoising method [20]. The definition domain core and value domain core of output pixels are(32)gi,j=∑k,lfk,lwi,j,k,l∑k,lwi,j,k,l,di,j,k,l=expi−k2+j−l2−2σd2,ri,j,k,l=exp−fi,j−fk,l22σr2.The weight function of bilateral filtering can be obtained by multiplying the above two equations:(33)wi,j,k,l=exp−i−k2+j−l22σd2−fi,j−fk,l22σr2.The advantage of bilateral filter is that it can protect the pixel value of the edge, but it is not good enough in color image processing. It can only suppress low-frequency noise and cannot deal with impulse noise well. The guided filter can filter out the noise and protect the edge information as much as possible [21] and it adopts a local linear process. The linear relationship between the filtered output of pixel i and the output image q and the guide image I is as follows:(34)qi=∑jWijIpj,qi=akIi+bk,∀i∈ωk.i and j are pixel subscripts; Wij is filter core; ak,bk is constant coefficient; ωk is filter window with radius r. Least squares optimization and window loss function are as follows:(35)Eak,bk=∑i∈ωkakIi+bk−pi2+ϵak2,ak=∑i∈ωkpiIi−bk∑i∈ωkIi∑i∈ωkII+ϵ,bk=∑i∈ωkpi−ak∑i∈ωkIi,ak=1/ω∑i∈ωkIipi−μkp¯kσk2+ϵ,bk=p¯k−akμk.


### 3.6. The Abnormal Behavior Detection Process

In Figure8, there is a thick fog on the left. After guided filtering, some fog is filtered out, and the image edge remains good. Guided filtering can remove the excess noise of the image while ensuring the original edge information. Therefore, it is used to remove the noise of the image in this experiment and Figure 2 is the Pedestrian detection.Figure 8
Denoising effect.


## 3.1. AE Principle

As one of the most crucial methods in deep learning technology, AE is generally used in compressed video, image reconstruction, and video codec. AE consists of two parts, encoding and decoding. The function of AE is to reconstruct the original image data after a series of network layer processing and reconstruct the reconstructed image similar to the original image using the decoded data. The coding process is(1)y=fWx+b.AE also needs to cooperate with the activation function in the coding process to change the simple linear structure of the network, so that it has higher learning ability and learns more feature information. The decoding process is(2)x′=fW′x+b′.AE needs to use loss function to reduce error in the process of encoding and decoding:(3)L=−logPx|x′.To improve the feature expression of the hidden layer and better represent the structural information of the input signal, researchers propose noise reduction AE. The main process is to add noise to the original input information and then input the noise information into the traditional AE to reconstruct the signal. The process is as follows:(4)x^∼qDx^|x,h1=σeW1x+b1,y=σdW2h1+b2.qDx^|x is noise distribution; W1 is coding weight; b1 is coding offset; W2 is decoding weight; b2 is decoding offset; x^ is input of mixed noise information. The loss function is(5)JDAEW=∑E∼x∼qDx˜|x∼Lx,y.Noise reduction AE is the use of artificial noise in the input to obtain better feature expression. The advantage is good robustness, and the disadvantage is that the time for adding noise needs to be increased before training, which increases the training time compared with AE [11]. Variational AE adds a generation part to the coding part and decoding part, and the coding part and decoding part are trained simultaneously [12]. The objective function is(6)Px=∫Px|z;θPzdz.x is input data; z is implicit variable; Px is maximized generation probability; θ is model parameters. For the loss function, the similarity of two variables is evaluated:(7)DQz|xPz|x=Ez∼QlogQz|x−logPz|x.The objective function is obtained by transformation:(8)logPx−DQz|xPPz|x=Ez∼Qlogxz|x−DQz|xPPz.Convolution AE is an optimized multilayer neural network model, which transforms the input expression into a new expression and then decodes it [13]. Training AE equation is(9)minθ,γ∑xLrecx,x^,withx^=decγencθx,where enc θ is the encoder, is the decoder, θ and γ are the parameters, and x is the input. Convolution AE is an improved structure using convolution layer and pooling layer on the original AE:(10)hk=σx∗wk+bk,y=σhk∗w^k+c.hk and bk are convolution kernel parameters; k is number of convolution kernels. The input and output are compared to obtain the complete convolution AE:(11)E=12n∑xi−yi2.Convolution AE has the advantage of better image data processing and a better reconstruction effect.


## 3.2. RNN and LSTM Network

Traditional neural networks are prone to problems when dealing with some sequence data, especially when these sequence data have an up-down relationship, so RNN appears. The advantage of RNN is that it has a memory mechanism, which can fully analyze the relationship among these data when dealing with the problems related to these sequence data with up-down connection, and it is more optimized on the whole [14]. Figure 3 shows the structure of RNN.Figure 3
Structure diagram of RNN.x is input of current time h; s is hide node status at present; o is output (RNN processing). The specific equation reads(12)st=fUxh+Wsh−1+b,ot=softmaxVsh+c.Activate function sigmoid isf; U and W are weight matrix between layers; b and c are offset value. RNN has the advantage of sharing model parameters at different times and can deal with long-term dependence problems. However, its disadvantages are obvious, such as the unstable update of model parameters, the existence of gradient explosion or disappearance, and only short-term memory.LSTM is an improvement of the RNN model. A “gate” structure is added, which can solve the problem caused by too long distance, even when the length of the data sequence is different [15]. The neurons of the LSTM model are composed of unit state, output gate, input gate, and forget gate. The operation mode of the forget gate: sigmoid function allocates the weighted calculation value of input pt at current time t and output nt-1 at time t−1 and uses the above to control the influence of sequence information of past output on input streams. The equation is(13)gt=σWf⋅nt−1,pt+bg.The values of input pt at time t and output nt-1 at time t−1 is weighted by the sigmoid function, expressed as (14). The new state candidate value At˜ of the unit is generated by the nonlinear tanh function. The new unit state At can be obtained only by adding the two and then passing through the forget gate and the input gate.(14)st=σWi⋅nt−1,pt+bs,At˜=tannWc⋅nt−1,pt+bA,At=gt⋅At−1+st⋅At˜.The output gate outputsqt value. The sigmoid function needs to be used to weight the input pt at current time t and output nt-1 at time t−1, expressed as (15). Next, the output of the LSTM unit is calculated and controlled by the nonlinear tanh function, and finally the output value nt is obtained. The advantage of LSTM is to solve the data problem due to long distance.(15)qt=σWq⋅nt−1,pt+bq,nt=qt⋅tannAt.


## 3.3. CNN

CNN is a feedforward neural network, which has excellent performance for large-scale image processing [16]. Figure 4 shows the structure of the CNN model. The picture is convoluted by the convolution layer first and then pooled. After several convolution and pooling operations, the obtained characteristic information is sent to the fully connected layer and finally sent to the output layer, and the size of the output layer is determined by the task of CNN.Figure 4
Curves of sigmoid, tanh, and ReLU activation functions.The detail of Figure5 is here; this figure shows the schematic connection of the CNN model. The size of the feature map after convolution operation is calculated by(16)Sizeout=Sizein−F+1stride.Figure 5
Schematic diagram of CNN model.Through filling, the size of the feature map remains unchanged after convolution. The same filling means that the size of the characteristic image remains unchanged after the convolution operation, and its equation is(17)Sizeout=Sizein+2×padding−F+1stride,padding=F−12.Sizeout is the output size of the feature map; Sizein is the input size of the feature map; F is the size of the convolution kernel; stride is the step size; padding is the number of circles filled around the feature graph. Convolution layer characteristics are local connection and convolution kernel sharing. Local connection is that the nodes of the convolution layer only connect some nodes of the previous layer, so as to reduce the number of parameters, improve the calculation speed, and effectively reduce the overfitting probability. Convolution kernel sharing means that when extracting a feature map, the same convolution kernel is shared between positions to reduce the number of parameters and further improve the calculation speed. The purpose of the pooling layer is to compress data, reduce parameters, and improve calculation speed. Fully connected layer: it is the hidden layer of a traditional neural network. Each neuron in this layer is connected with the previous neuron, so the number is the largest. In CNN, the convolution layer, pooling layer, and fully connected layer need to add activation functions. The common activation functions are sigmoid, tanh, and ReLU. The central value of the output value of the sigmoid function is not 0, and gradient dispersion will occur during the backpropagation of the deep neural network. Figure 4 is a comparison diagram of sigmoid, tanh, and ReLU function curves.tanh function: the output value of the function is centered on 0. Although the convergence speed is faster, there is gradient dispersion. ReLU function: it is the commonly used activation function at present, which solves the gradient dispersion, has fast convergence speed, and can reduce the possibility of overfitting. LeakyReLU activation function is an improved version of the ReLU function. The equation is as follows. Generally, 0.01 is taken as the value ofa, which is a constant with a constant value.(18)fx=x,x≥0,ax,x<0..CNN propagates forward layeri output. Weight is W; offset is b. The input of each layer in the network is the output of the previous layer.(19)xi=fui,ui=Wixi−1+bi.Overall loss function:(20)EN=12∑n=1N∑k=1ctkn−ykn2..N is total number of samples; c is number of sample categories; tkn is k-dimension of the n-th sample label; ykn is the n-th sample output of k-dimension. Each layer of CNN uses the gradient descent method to update the weight. The equations of weight update and offset update are as follows:(21)Wni=Woi−η∂E∂Woi,bni=noi−η∂E∂boi.Woi is weight and offset before updating; Wni and bni are updated weight and offset; η is learning rate in gradient descent method. The convolution layer in CNN is forward propagation. The convolution output characteristic diagram of each i layer is as follows:(22)xji=f∑l∈Mj⋅xli−1⋅klji+bj.Mj is input characteristic graph; klji is convolution kernel; f is activation function. The equations of CNN backpropagation, pooled layer error backpropagation, convolution layer error direction propagation, convolution layer weight update, and offset update are as follows:(23)δi−1=up sampleδi⊙σ′ui−1,δi−1=δi∂δi/∂δi−1=δi∗rot180Wi⊙σ′ui−1,∂E/∂Wi=∂E/∂ui∂ui/∂Wi=xi−1∗δi,∂E/∂bi=∑u,vδiu,v.up sampleδi is sampling operation; is Hadamard product; δ is error; i is layer i; E is loss function.


## 3.4. Memory Enhancement AE

The generalization of AE itself is too high, resulting in the decoder being unable to decode abnormal coding well during reconstruction. The memory module is introduced to enhance AE. When new test information is input, the memory enhancement AE will not directly encode and input to the decoder but find relevant contents in the memory module and send all contents to the decoder. During training, the encoder and decoder update the memory module simultaneously to reduce the reconstruction error of normal samples and increase the reconstruction error of abnormal samples. Figure6 presents a structure diagram of memory enhancement AE.Figure 6
Memory enhancement structure.Figure6 shows the specific process of memory enhancement AE and it is as follows. The encoder first obtains the encoded value of the input information, queries the relevant content according to the encoded value in the memory module, and then sends the content to the decoder for reconstruction. The output of the memory enhancement module is(24)z^=wM=∑i=1Nwimi,w is nonnegative row vector with sum 1; wi is one of w; M is memory storage unit coefficient; z^ is reconstructed input features; N is memory storage unit capacity. Calculation during training and prediction:(25)wi=expdz,mi∑j=1Nexpdz,mi,dz,mi=zmiTzmi.dz,mi is similarity variables of input features and memory storage units; z is input feature. To restrict the reconstruction of abnormal features, the correlation coefficient is constrained, and the small weight coefficient is set to 0 during hard compression.(26)wi=hwi;λ=wi,ifwi>λ0,otherwisewi=maxwi−λ,0⋅wiwi−λ+ε.λ is sparse threshold, value 1/N; ε is very small positive scalar.


## 3.5. Surveillance Video Image Processing

There are multiple problems in traffic monitoring equipment, such as low image resolution, low video definition, and poor lighting conditions, resulting in image blur and so on. Before behavior analysis, image processing and interference elimination must be carried out on the surveillance video screen, that is, preprocessing some images. Image enhancement technology is to highlight crucial information and eliminate miscellaneous information to achieve the effect of image enhancement. Image enhancement includes image sharpening, smoothing, and histogram processing [17]. Image sharpening is to enhance the edge information of the image through operation, improve the clarity of the blurred image, facilitate observation and recognition, and extract the edge information of the target. For an image Fx,y, the gradient vector and gradient amplitude are(27)∇Fx,y=∂F∂x,∂F∂y,∇Fx,y=∂F∂x2+∂F∂y2.The equation of digital images is(28)∇Fx,y=Fx,y−Fx+1,y2+Fx,y−Fx,y+12Gx,y=∇Fx,yGx,y=∇Fx,y,∇Fx,y>T,Fx,y,otherwise,Gx,y=Lα,∇Fx,y>T,Fx,y,otherwise.The above three are methods of outputting sharpening results. Gradient replaces sharpening output, and the overall brightness of the image becomes lower, affecting recognition [18]. Output threshold judgment can be sharpened without affecting the background. Laplace operator is suitable for images with low contrast and brightness. This method is used to enhance video images here. For binary images, the expression is(29)∇2F=∂2F∂x2+∂2F∂y2,∂2F∂x2=Fx+1,y+Fx−1,y−2Fx,y,∂2F∂y2=Fx,y+1+Fx,y−1−2Fx,y,∇2F=Fx+1,y+Fx−1,y+Fx,y+1+Fx,y−1−4Fx,y.The above equations can be understood as follows. The Laplace operator of a point in the image is the difference between the gray value of its surrounding adjacent pixels and its own gray value. If the operator is rotated in a certain direction and added to the original operator, it is an eight-neighborhood operator:(30)gx,y=Fx,y+c∇2Fx,y.gx,y is output image; c is coefficient; Fx,y is original image. The enhanced image can be obtained by convoluting the obtained operator with the original image (Figure 6):In Figure7, the left is the original image of the surveillance video, and the right is the enhanced image. It is obvious that after the convolution operation on the image with low brightness, the image effect is significantly enhanced compared with the original image, which is very beneficial for the next analysis. Image smoothing is to filter out the high-frequency information in the image and retain the effective low-frequency information. Generally, a low-pass filter is used to remove the noise of the image [19]. Gaussian filtering is a common method. The binary Gaussian function and single element are calculated as follows:(31)Gx,y=12πσ2e−x2+y2/2σ2,Hi,j=12πσ2e−i−k−12+j−k−12/2σ2.Figure 7
Effect drawing of Laplace operator.σ is variance; k is matrix dimension. The larger the σ is, the better the smoothing effect is. For the discrete image, discrete points are used as weights to weigh each pixel and the surrounding area to eliminate Gaussian noise. When the amount of calculation is too large, the filtering should be realized by Fourier transform. The advantage of bilateral filtering is that it considers not only the space near the image, but also the pixel similarity. It can eliminate image noise while retaining edge information, and the effect is better than the original denoising method [20]. The definition domain core and value domain core of output pixels are(32)gi,j=∑k,lfk,lwi,j,k,l∑k,lwi,j,k,l,di,j,k,l=expi−k2+j−l2−2σd2,ri,j,k,l=exp−fi,j−fk,l22σr2.The weight function of bilateral filtering can be obtained by multiplying the above two equations:(33)wi,j,k,l=exp−i−k2+j−l22σd2−fi,j−fk,l22σr2.The advantage of bilateral filter is that it can protect the pixel value of the edge, but it is not good enough in color image processing. It can only suppress low-frequency noise and cannot deal with impulse noise well. The guided filter can filter out the noise and protect the edge information as much as possible [21] and it adopts a local linear process. The linear relationship between the filtered output of pixel i and the output image q and the guide image I is as follows:(34)qi=∑jWijIpj,qi=akIi+bk,∀i∈ωk.i and j are pixel subscripts; Wij is filter core; ak,bk is constant coefficient; ωk is filter window with radius r. Least squares optimization and window loss function are as follows:(35)Eak,bk=∑i∈ωkakIi+bk−pi2+ϵak2,ak=∑i∈ωkpiIi−bk∑i∈ωkIi∑i∈ωkII+ϵ,bk=∑i∈ωkpi−ak∑i∈ωkIi,ak=1/ω∑i∈ωkIipi−μkp¯kσk2+ϵ,bk=p¯k−akμk.


## 3.6. The Abnormal Behavior Detection Process

In Figure8, there is a thick fog on the left. After guided filtering, some fog is filtered out, and the image edge remains good. Guided filtering can remove the excess noise of the image while ensuring the original edge information. Therefore, it is used to remove the noise of the image in this experiment and Figure 2 is the Pedestrian detection.Figure 8
Denoising effect.


## 4. Results and Discussion

Experimental results are explained here and different methods are already mentioned in Methodology section but they are analyzed here. Experimental data and evaluation index can be seen in the following discussion.Memory enhancement AE is used. The network training samples are mainly from the following datasets. Avenue dataset: the videos in the dataset are real videos taken directly. Walking on the sidewalk belongs to normal behavior, while running and walking in the wrong direction and other behaviors are regarded as abnormal behavior. Ped1 and Ped2 datasets in UCSD include normal behavior and abnormal behavior. The main background is the pedestrian road, so the appearance of cars on the sidewalk is abnormal behavior.The evaluation indexes of model performance are Area Under Curve (AUC) and Equal Error Rate (EER). AUC is defined as the area under the ROC curve. Its value is often used as the evaluation standard of the model because the ROC curve cannot clearly explain which classifier is better. However, as a value, the classifier with a larger AUC is better.To prove the effect of the method proposed in traffic surveillance video abnormal behavior detection, memory enhanced self-coding is compared with the other six methods. Figure9 is a diagram of the experimental results of four methods.Figure 9
Comparison of experimental results of different methods. (a) Comparison of experimental results of MPPCA + SF and MDT. (b) Comparison of experimental results of Conv and Conv3D.
(a)(b)Figure9(a) shows the comparison of detection results between MPPCA + SF and MDT. MDT has a better detection effect on the Avenue dataset than MPPCA + SF based on manual features, and its frame-level AUC is 15% higher. On Ped1 and Ped2 datasets, MDT still performs well, with an average frame-level AUC of about 10% higher than MPPCA + SF. Figure 9(b) presents the detection results of Conv and Conv3D based on AE, which basically reach about 75% of the frame-level AUC. In the Avenue dataset, the overall abnormal behavior detection performance on Ped1 and Ped2 datasets is good, and there is little difference between them. Figure 10 shows the comparison of the experimental results of the other two methods: RNN and ConvLSTM.Figure 10
Comparison of experimental results of RNN and ConvLSTM.Figure10 shows the comparison of detection results of AE-based ConvLSTM and Stacked RNN on each dataset. ConvLSTM performs better on the Avenue dataset. Compared with Stacked RNN, the former is better at obtaining time information. In the whole image, it can also be observed that the method based on self-coding achieves better frame-level AUC than the method based on handmade features.


### 4.1. Comparative Analysis of Experimental Results of Memory Enhancement Self-Coding

Figure11 shows the comparison of experimental results of all methods.Figure 11
A comparison of experimental results between all methods and the proposed method.Figure12 shows the comparison of this method with other methods. The self-coding based on memory enhancement proposed is about 2% higher than the best ConvLSTM in the above figure on the dataset Avenue and about 3% higher on the Ped1 and Ped2 datasets. This is mainly due to the introduction of the memory module. AE can well reconstruct abnormal information when reconstructing information. On the Ped1 and Ped2 datasets, there are more abnormal behaviors, which are more complex. The self-coding method based on memory enhancement can detect abnormal behaviors more accurately. In conclusion, self-coding based on memory enhancement can flexibly deal with the detection of different abnormal behaviors in different scenarios and use the reconstruction error information. The method proposed can obtain better results.Figure 12
shows the comparison of experimental results of all methods.


## 4.1. Comparative Analysis of Experimental Results of Memory Enhancement Self-Coding

Figure11 shows the comparison of experimental results of all methods.Figure 11
A comparison of experimental results between all methods and the proposed method.Figure12 shows the comparison of this method with other methods. The self-coding based on memory enhancement proposed is about 2% higher than the best ConvLSTM in the above figure on the dataset Avenue and about 3% higher on the Ped1 and Ped2 datasets. This is mainly due to the introduction of the memory module. AE can well reconstruct abnormal information when reconstructing information. On the Ped1 and Ped2 datasets, there are more abnormal behaviors, which are more complex. The self-coding method based on memory enhancement can detect abnormal behaviors more accurately. In conclusion, self-coding based on memory enhancement can flexibly deal with the detection of different abnormal behaviors in different scenarios and use the reconstruction error information. The method proposed can obtain better results.Figure 12
shows the comparison of experimental results of all methods.


## 5. Recapitulation

The average accuracy from the proposed models is 87.5 percent as compared to the state of the art where average accuracy is 75.5 percent. The results are compared after being analyzed at microlevel like pixel based.


## 6. Conclusion

In this paper, the aim is mainly to study the abnormal behavior detection system of self-coding surveillance video based on memory enhancement. First, the principle of AE is analyzed. The generalization ability of AE can reconstruct exception information well, so it cannot be detected. Noise reduction AE is the use of artificial noise in the input to obtain better feature expression. The advantage is good robustness, while the disadvantage is that the time for adding noise before the training needs to be increased, and the training time increases. Convolution AE has the advantage of better image data processing and a better reconstruction effect. Then, the images with low definition are sharpened by Laplace transform and convolution, and the noisy images are processed by guided filtering. Finally, the experimental comparison of different methods is carried out. The self-coding based on memory enhancement proposed is about 2% higher than the best ConvLSTM on the dataset Avenue and about 3% higher on the Ped1 and Ped2 datasets, which verifies the effectiveness of the proposed method. The disadvantage is that the occlusion of characters will be more serious in the real scene, so it is necessary to consider adding algorithms to reduce the impact of occlusion. Moreover, the complexity of the real scene will be higher, so more situation and more complex scene data should be used to train the system.



---

*Source: 5631281-2022-03-02.xml*