## 3 Methodology
### Crowd Density Measures Pantic Risk
#### 3.1.1 CDNet Framework  
In this study, we propose CDNet (Crowd Density Network), a CNN-based deep learning model optimized for crowd density estimation. Unlike conventional CNNs, CDNet  
\begin{table}
\begin{tabular}{p{42.7 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**NO.** & **Reference** & **Method** & **Data Source** & **Feature** & **Susceptible Factor** \\ \hline
1 & [PERSON] et al. [19] & Open pose, dynamic centroid model & Experiment Volunteers, a set of falling activity records & Acceleration, mass inertial of human body subsegments, and internal constraints & Simple group behavior patterns \\ \hline
2 & [PERSON] et al. [23] & Decision tree classifier & Experiment Volunteers, a set of falling activity records & Acceleration, tilting angle, and still time & Environment \\ \hline
3 & [PERSON] et al. [24] & Multisensory data fusion with Support Vector Machine (SVM) & Experiments of 100 Volunteers & Acceleration & Multi-noise or multi-source environments \\ \hline
4 & [PERSON] et al. [25] & Variational abnormal behavior detection (VABD) & UCSD, CUHK, Corridor, ShanghaiTech & Motion consistency & Sensitivity \\ \hline
5 & [PERSON] et al. [26] & Improved k-means & UMN & Velocity vector & Sensitivity \\ \hline
6 & [PERSON] et al. [27] & Simulation & / & Move probability & Sensitivity \\ \hline
7 & [PERSON] et al. [28] & LK optical flow method & UMN & Intersection density & Environment \\ \hline
8 & [PERSON] et al. [29] & CNN and LSTM & Fall Detection Dataset & Fall, down & Real-time \\ \hline
9 & [PERSON] et al. [30] & Partitioned Convolutional Neural Network & / & Cognitive impairment patterns & Simple group behavior patterns \\ \hline
10 & [PERSON] et al. [31] & Two-stream CNN & Avenue Dataset & Racing, tossing objects, and loitering & False positives \\ \hline \hline \end{tabular}
\end{table}
Table 1: Related methods of abnormal behavior detection.  
integrates an attention mechanism and a contextual enhancement module (CEM) to better capture local and global density variations. The model consists of a Backbone Extractor (BE), Density Perception Module (DPM), Contextual Enhancement Module (CEM), and Density Map Generator (DMG). BE, built on a pre-trained VGG-16, is enhanced with an attention mechanism and additional convolutional layers to improve spatial and semantic feature extraction. DPM processes feature maps from the BE using multi-scale convolutional kernels, allowing the model to adapt to varying crowd densities across spatial resolutions. CEM refines these features by integrating Spatial Pyramid Pooling (SPP) and a Transformer-based self-attention mechanism, generating dynamic weights to emphasize critical density regions. Finally, the DMG fuses the enhanced feature maps to produce the final density map through convolution layers, batch normalization, activation functions, and skip connections, ensuring efficient feature integration and precise density estimation. An overview of the CDNet working principles is presented in Figure 1.  
To verify the proposed CDNet, we choose the ShanghaiTech crowd-count dataset [32] as the main dataset to validate our proposed CDNet model. We mainly used the Part A subset for our experiments because high-density scenarios are more challenging and require more robust models than low-density scenarios. We scaled all images to a uniform size (\(512\times 512\)) to fit the model inputs and improve the training efficiency. The training uses a custom mixed loss function (MSE + MAE) to optimize the global and local density distributions. The model performance can be comprehensively analyzed through the predicted density map, as shown in Figure 2.