# Automatic Handgun Detection with Deep Learning in Video Surveillance Images
## 1 Introduction  
According to data collected in 2017 and published by the Small Arms Survey [1], the percentage of firearms held by civilian worldwide was approximately 85% compared to the 13% held by the army forces and 2% by law enforcement (see Figure 1). By country, the number for the USA stands out with a total of 393,347 firearms--most of them unregistered--for a total population of 326,474 inhabitants, representing 120.5 firearms per 100 inhabitants and meaning that it ranks first in both the total number of firearms possessed by civilians and in number of weapons per 100 inhabitants. Spain, with 7.5 firearms per 100 inhabitants ranks 103 out of the 227 countries included in the aforementioned report. These data together with the increase in terrorist attacks and shootings with civilian casualties in regions that are not under armed conflict have raised the need to establish surveillance mechanisms, especially in public spaces susceptible to a large influx of people [2] such as transport terminals, educational, health, commercial, and leisure facilities, etc. Surveillance in public spaces takes multiple forms (which can appear in combination):  
1. CCTV video surveillance;
2. Patrol of security agents;
3. Scanning luggage through X-rays;
4. Active metal detection;
5. Individual frisking of people. Video surveillance is an inexpensive method that allows covering large areas without interfering with the flux of people. However, it faces major limitations such as those arising from image capture speed, image resolution, scene light quality, and occlusions. In addition, the task of monitoring images captured by CCTV systems requires a high level of attention over long periods of time, which leads to unnoticed events because of human operator fatigue. For a firearm detection system to be efficient, it must have two characteristics:  
1. Be able to perform real-time detection;
2. Have a very low rate of undetected visible weapons (false negative rate (FNR)). The first of those requirements is determined by the maximum number of frames per second (fps) that the system can process without losing accuracy in detection. The second provides the most critical type of detection failure, when visible weapons in images are undetected by the system. To propose a system that meets the two characteristics previously noted, this work presents a study of three firearm (handgun) detectors in images based on the application of _convolutional neural networks_ (CNNs). While \"classical\" methods require the manual selection of discriminant features [3], CNNs are able to automatically extract complex patterns from data [4]. For problems with a low availability of data and/or limited computational resources, the CNN training can be initiated with the parameters (weights) obtained by pretraining the network on a similar problem. This method is called _transfer learning_. Based on the initial learned values of the network parameters, network training continues with specific examples for the problem under study. When transfer learning techniques span not only the final layer, but all network parameters, this is called _fine-tuning_. Transfer learning and fine-tuning embrace the intuition that the features learned by CNNs could be shared in similar problems; hence, the models can avoid starting the learning process from scratch for every new problem. To reduce the number of undetected objects or _false negatives_ (FNs) without increasing the number of incorrect detections (_false positives_ (FPs)), this work aimed made the hypothesis that incorporating pose information associated with the person holding a weapon should improve the performance of the models. By including pose information, the objective is to avoid detection errors due to the small size of handguns in the images, partial occlusion when holding them, and low image quality. The manuscript is organized as follows. Section 1 presents the motivation for the problem.