Stop, or AI’ll Shoot!



Even for someone who always tries to look at the bright side of every situation, there are limits. Consider a cockroach infestation, for example. These disgusting creepy crawlies infest urban areas by the millions, spreading disease and triggering allergies and asthma in the process. They have been noted to carry over thirty kinds of bacteria, six types of parasitic worms, and seven known pathogens — not exactly the type of houseguest anyone would like to have. And once these pests move in, getting rid of them is no small chore. Good luck getting rid of an insect that can live for a month without food, is virtually crush-proof, and can live for a week without its head! Oh, the humanity!

The most effective methods to control cockroaches in residential settings are sticky traps and insecticide gels. But in both cases, the catching range is limited and many of the little devils will just avoid these areas. I am not sure about you, but images of gigantic, radioactive insects from low-budget 1950s B movies are flashing through my mind right about now. Things are not looking too good for us humans. But wait … what is that glimmer of light in the distance? Could it be the answer to this age-old problem? Well, maybe (probably not though). In any case, it is pretty cool. That glorious red glow is a machine learning-powered, cockroach-zapping laser!

You heard that right, a team from Heriot-Watt University, University Paul Sabatier, and the University of Sussex have created a device that uses computer vision and AI to fry invading cockroaches with lasers. What could go wrong? Obviously nothing — aside from a mild case of permanent blindness or a house fire. Alright, alright, so those things could be a bit of a problem, which is why the researchers do not have a plan to commercialize their solution, but they have open-sourced their design for anyone sufficiently fed up with a cockroach infestation to build their own.

And building such a device is a pretty reasonable ask for anyone technically inclined. The parts can all be had for about $250, and they are on the user-friendly side. The core of the bug zapper is an NVIDIA Jetson Nano single board computer, which was made exactly for this type of job. No, not specifically for killing cockroaches, but for machine learning with 472 GFLOPs of computing power in a package small enough to hide out underneath the kitchen cabinets. A pair of camera modules give the device the ability to see cockroaches, and a galvanometer, with the help of mirrors, changes the path of a laser beam to direct it where it is needed.

To detect cockroaches, the team extracted 1,000 images of them from an existing dataset and used these images to train a YOLO object detection model. They were careful to include images with various levels of lighting to make sure their detector would work under varying conditions. Using coordinates from object detections performed with the pair of cameras employed, the team devised a method to determine the appropriate signal to send the galvanometer to adjust the path of the laser.

When the system was fully tuned, it was able to directly focus the laser on a detected insect and “neutralize” it. Cockroach sympathizers need not fret — the team also pointed out that using lower power levels would leave the bugs unscathed and send them scampering off in a different direction. So if you do not mind cockroaches hanging out in your neighbor’s house, so long as they leave you alone, that may be just the option you are looking for.

This work may not be ready for use outside of a research lab just yet, but the idea is worth developing further. Traditional pest control methods like insecticide have off-target effects and other negative ecological impacts, so new paths are well worth exploring, even if they do seem a bit far-fetched at present.Zapping cockroaches with a laser (📷: I. Rakhmatulin et al.)

Performing a controlled experiment (📷: I. Rakhmatulin et al.)

Labeling the training data (📷: I. Rakhmatulin et al.)