An AI-powered cat flap has been created which stops a pet from entering the building if it’s carrying prey in its mouth.

The device is the brain-child of Amazon worker, Ben Hamm, who’s software wizardry taught a computer algorithm to learn whether his kitchen-bound kitty was bearing furry or feathered gifts.

Upon calculating the presence of extra guests, a computer system linked to the cat flap is able to activate a 15-minute lock-out – more than enough time for a cat to find an alternative resting ground for a late shrew.

Mr Hamm’s creation was revealed to the public in Seattle in June. The launch was covered by tech news webpage, The Verge, which described how two of Amazon’s own tools  are embedded in the invention’s machinery.

Firstly, DeepLens provides video camera technology that’s engineered for AI developments. Secondly, the Amazon service, Sagemaker, was used to construct the core algorithm which could then be trained and set to operate on data collected by the customer (Hamm, in this case).

Mr Hamm underlined how much time had been taken in gathering some 23,000 photographs needed to help flesh out the cat flap computer’s brain. Each of the images had to be addressed individually, to help the device understand whether the cat was in view, which way it was going, and whether it was carrying a small dead animal.

Using ‘supervised learning’, the software can identify patterns in picture sequences or other information and compare them with provided examples to “comprehend” live situations.

One drawback is that the process can require hundreds of thousands of examples before any kind of accuracy can be offered, and even then, correct results are not guaranteed.

During a test period of over a month, Mr Hamm described how his cat Metric was unjustly locked out of the house on one occasion, while the moggy passed through the cat flap on seven occasions brandishing a cute cadaver.

Speaking to the BBC, Martin Garner of CCS Insight consultancy said:

“Amazon, Google and Microsoft have made it much easier to use AI by providing services like Sagemaker, that need little or no coding skill to use.

“But truly ‘democratising AI’, so that anyone can use it, is as risky as democratising dentistry – what the world really needs is more properly trained AI engineers.”