## 3 Proposed Algorithm
### Firearm Dataset Used  
We evaluate our anomaly detection approach on three firearm-related datasets that include VISILAB [11], UCF-Crime [36], and YouTube samples [7] to encompass a wide range of real-world scenarios, including indoor, outdoor, and night time low-resolution video frames, respectively.  
The VISILAB dataset [11] used in this study was collected in a controlled environment, as most image recognition algorithms and HPE models are sensitive to variations in lighting conditions, subject size, background, distance from the camera with different imaging sensor, and other factors. To address these challenges, the dataset includes subjects both with and without firearms, holding various common objects while assuming different normal poses, and wearing diverse clothing colors. The videos were filmed indoors, ensuring a range of conditions that meet the requirements of indoor surveillance systems.  
Figure 2 showcases examples from the VISILAB firearm benchmark dataset [11], annotated with full-body landmarks and hand detection, featuring both normal and abnormal samples extracted from videos. This video dataset consists of a total of 398 videos, categorized into three classes: _'handgun'_ (141 videos), _'machine gun'_ (139 videos), and _'no gun'_ (118 videos), with an average frame rate of 251. The data were collected from various surveillance cameras with different resolutions, capturing diverse objects, venues, and backgrounds. The _'no gun'_ category includes commonly used objects such as empty hands, various types of smartphones, water bottles, sanitizers, boxes, and laptops. Localizing _handgun_ in firearm detection scenarios is particularly challenging due to the limited availability of abnormal samples and the variability of anomalies. These anomalies can range from subtle structural defects to more pronounced issues such as brightness variations, color distortions, and partial occlusion of _handgun_. In such cases, the confidence values of key hand landmarks, including the _wrist_, _pinky_, _index_, and _thumb_, are crucial for accurate hand detection. In our approach, we use a confidence threshold of 20% to confirm the visibility of both hands. The ROIs of the left and right hands are highlighted with cyan and red bounding boxes, respectively (see Figure 2).  
UCF-Crime is a challenging dataset consisting of long, untrimmed surveillance videos encompassing 13 categories of real-world anomalies. For our analysis, we exclude videos in which firearms are not visibly present. From the filtered dataset, 1629 frames depicting the act of shooting someone with a firearm are selected for use during the inference phase. Figure 3 displays three representative frames from the UCF-Crime dataset, each illustrating a shooting-related anomaly.  
Another noteworthy dataset used in our analysis is the YouTube dataset used in [7], which captures outdoor shooting scenarios under challenging conditions such as low lighting and distant subjects, while depicting the act of shooting someone with a _handgun_. For our evaluation, we consider 2451 frames extracted from this dataset. Figure 3 presents three representative frames, each illustrating a shooting-related anomaly within typical outdoor environments. The augmented dataset simulates environments with low or poor illumination by generating darkened versions of the original images, achieved through adjustments to the value component in the HSV color space. Another important factor affecting firearm detection performance, particularly small objects, is camera distance. To introduce further variability into the YouTube dataset, an additional augmented set was added by reducing the image size by half and padding the remaining area with black pixels, thereby preserving the original image resolution. One example of the original and augmented images is shown in Figure 3c to illustrate the visual differences between the dataset versions.