## 3 Proposed Algorithm
### Hand Patch Extraction Based on HPE  
Human body landmarks detection in outdoor scenarios, including surveillance applications, presents significant challenges. These include the vast range of possible poses, numerous degrees of freedom, occlusions, varying subject distances from the camera, and diverse clothing styles. In the proposed firearm approach, we utilized the BlazePose Full model (i.e., Mediapipe 0.10.15) [34], a lightweight CNN architecture designed for human body landmarks detection. The keypoints topology of BlazePose is shown in Figure 4.  
Figure 2: Examples from the VISILAB benchmark _hundgun_ firearm datasets. Superimposed on the images are the human-body landmarks from MediaPipe [46]. Based on the visibility threshold, the ROIs of the left and right hands are highlighted with cyan and red bounding boxes, respectively. Images credit: VISILAB firearm image database [11] **(a)** Firearm VISILAB; **(b)** ROIs VISILAB; **(c)** Normal Samples VISILAB; **(d)** ROIs VISILAB. [[https://data.mendeley.com/datasets/bbzpxhd22j/2](https://data.mendeley.com/datasets/bbzpxhd22j/2)]([https://data.mendeley.com/datasets/bbzpxhd22j/2](https://data.mendeley.com/datasets/bbzpxhd22j/2)), accessed on 3 February 2025. During inference, the network detects 33 body keypoints for a single person and operates at over 30 frames per second. This efficiency makes it particularly well-suited for applications such as action recognition [47]. The proposed algorithm utilizes deep features derived from visible hand observations captured by camera and firearm-related human body landmarks. By analyzing the combination of hand landmarks and _elbow_ positioning, it effectively detects dangerous poses. For dangerous pose detection, twenty key body landmarks are derived from the normalized skeleton [7]. These twenty landmarks include ten landmarks on the right arm, including the hand, and ten landmarks on the left arm, including the hand. Instead of using the neck keypoint, as in OpenPose [35], we normalize landmarks based on _torso_ size, calculated  
Figure 4: Keypoints topology of human body landmarks extracted by BlazePose. Figure 3: Examples from the UCF-Crime and YouTube benchmark _handgun_ firearm datasets. Superimposed on the images are the human-body landmarks from MediaPipe [46]. Based on the visibility threshold, the ROIs of the left and right hands are highlighted with cyan and red bounding boxes, respectively. **(a)** Firearm UCF-Crime; **(b)** ROIs UCF-Crime; **(c)** Firearm YouTube; **(d)** ROIs YouTube. from the positions of the _left_hip_, _right_hip_, _left_shoulder_ and _right_shoulder_. Normalization is a pre-processing step that standardizes the coordinate origin for each detected keypoint, if present. This process ensures that only the relative positions between keypoints are considered, removing irrelevant factors such as the subject's size, position within the image, camera distance, and image resolution. The landmarks associated with the firearm are represented as a feature vector, denoted as \(\vec{l}\). These landmark details are essential for anomaly detection, as they provide critical information for anomaly detection and keypoints for the accurate patch selection. To accurately extract deep features from both hands, it is essential to carefully select patch sizes to avoid cropping the hands or using oversized patches, as these could lead to distortions in background-related features introduced by the imaging sensors. This necessitates adjusting the patch size dynamically based on the subject's relative distance from the camera. The proposed patch size detection algorithm relies on observing skeleton size variations as the subject moves relative to the camera or is captured by multiple cameras. This process requires quantifying the skeleton size in each video frame and correlating these measurements with the appropriate patch size.