For as long as it's existed, one of the┬ábiggest challenges with video surveillance is that it's usually only useful once the footage has been painstakingly reviewed by humans — either by studying it after the fact or having a security guard attentively monitor the feed for hours at a time.

But what if police officers were equipped with body cameras that could alert them the instant they come into view of a handgun, or some other weapon? Or if bank's security system could sound an alarm the instant cameras detect a robbery in progress?

That reality might not be too far off. In a recent paper submitted to the arXiv preprint repository, researchers at the University of Granada present a system they claim can automatically detect handguns in fractions of a second, even from grainy YouTube videos.

The system uses a convolutional neural network, a kind of machine learning algorithm that mimics the brain and learns to perform tasks by being "trained" on massive datasets. But it turns out that identifying guns is still fairly difficult compared to detecting someone's face.

That's because determining whether an abstract collection of pixels looks like a certain object requires an incredibly large number of examples in the form of training data, which isn't as widely available for handguns as it is for faces. There are also other factors at play, like the fact that handguns come in many varieties and can be held with one or two hands, making it more likely the gun will be partially occluded and thus harder to detect.

Nevertheless, the researchers were able to get around the lack of data by running their comparatively small collection of around 3,000 gun images against a much larger, generic dataset called ImageNet, which contains over 1.2 million images of various objects. In other words, the neural network was able to learn how to detect handguns by looking at previously-learned data for the detection of similar-looking objects.

In the end, the researchers say their system successfully activated an alarm in 27 of the 30 scenes they tested, correctly detecting a gun in less than two-tenths of a second each time. Overall, the optimized model achieved 84% accuracy, with zero false negatives (meaning the system never failed to detect a gun when one was actually present) and 57 false positives.

Systems like these still have a ways to go, especially since those false alarms could have deadly consequences for civilians being approached by body camera-wielding cops. That hasn't stopped companies from trying to equip street cops with object and face recognition technology, however. Taser, one of the major manufacturers of police body cameras, recently revealed it is developing AI-powered body cams using real-time image recognition technology, with the hope of turning cops into data-gathering cyborgs capable of instantly detecting any object or person they come across.