This article is more than 1 year old

Boffins hunt and kill cockroaches with machine vision laser

Oh the hijinks of academia

Researchers gave a laser beam machine vision and trained it to hunt cockroaches.

The rationale is that pesticides are bad for the environment – at least that was the excuse they gave in the abstract.

Ildar Rakhmatulin, Mathieu Lihoreau and Jose Pueyo of Heriot-Watt University, University Paul Sabatier and the University of Sussex claimed "more effective and environmental friendly approaches are needed to counteract these damaging effects."

Therefore, lasers.

"Since a laser can be remotely directed to neutralize undesirable targets, this approach could be highly promising for controlling insect pests in a selective and ecofriendly fashion," they say in a paper titled "Selective neutralization and deterring of cockroaches with laser automated by machine vision" [PDF] published in the Oriental Insects journal last month.

The team got their hands on an Nvidia Jetson Nano – a small but powerful computer that runs multiple neural networks in parallel for applications like image classification – and fed it a data set of 1,000 or so images of cockroaches.

AI training done, they needed to give the Roachinator machine vision to allow it to "see" via two 8MP Sony IMX219 camera modules for the Raspberry Pi. They also added a configurable laser – naturally – and a galvanometer rigged to change the laser's direction. The setup is elegantly explained with the figure below:

AI device for killing cockroaches

Click to enlarge

"The single-board computer Jetson Nano ... processes the digital signal from two cameras ... and determines the position of the target insect in the 3-D space. After calculations, the Jetson Nano transmits the analog signal in the 0-5V range to the board with an operational amplifier. This board converts the signal into a bipolar voltage (± 5V), which powers the boards with a motor driver for the galvanometer ... The galvanometer, with the help of mirrors, changes the direction of the laser to shoot the target."

The team said all parts were "generally available equipment" costing no more than $250 apiece. A bargain if you're really struggling with a roach infestation.

Python 3.7 was the language of choice for the algorithm, which works as follows:

Roachinator algorithm

Click to enlarge

German cockroaches (Blattella germanica) were the unfortunate subject of the experiment. Small groups from a batch of 150, male and female, were placed in a clear plastic box (8cm x 24cm x 6cm) with a shelter inside. When the insects hid beneath the shelter, the team found that a 100mW laser was sufficient to send them running – handy if you want to keep the pests out of a certain place.

When it came to neutralization, however, it was found that a 1.6W laser was more effective than a 300mW laser because the roaches ran faster from the lower power setting. "This speed increment in the lower laser group is because to neutralize the individuals generally the laser needs to shoot the target continuously for about 2-3 seconds ... and at this lower laser power, cockroaches do not die instantly, but instead moved quickly outside the laser beam," the team wrote.

Images of crispy cockroaches are included in the paper.

Though the researchers do not intend to commercialize the Roachinator, the training data can be found on Kaggle and the computery bits on GitHub. Proceed with caution.

Just think of all the potential applications. You could replace the training data for another target, maybe build the device into something like Elon Musk's Optimus, wait for AI to reach sentience, and... Hang on, that sounds like a movie plot and it did not end well. As you were. ®

More about


Send us news

Other stories you might like