Cleaning Up with AI
Cleaning up after a dog is no fun under any circumstances, but when winter rolls around, it takes on a whole new level of unpleasantness with the freezing temperatures and chilling winds. YouTuber Caleb Olson is not one to follow his dog around with a waste bag whenever nature calls, and this procrastination left him with a problem. When he did get around to cleaning up the yard, he had to search his entire backyard to find all the places his dog Twinkie had relieved herself since the last cleaning.
Olson wondered if there might be a better way to deal with this situation, and somewhat ironically, did a bunch of work to enable his procrastination. With a security camera already in place in his backyard, he decided to build a dog poop detector that can map and track each location that he needs to clean up, to save him from having to inspect the entire yard.
To do this, he used an open source animal pose detection toolkit named DeepLabCut to help understand what Twinkie was doing. DeepLabCut uses deep learning to identify key points on an animal’s body. Olson noticed that when his dog pooped, she arched her back, her tail stuck up and stiffened, and she stopped moving. To help DeepLabCut recognize this posture, he had to collect lots of images of Twinkie in the act, and annotate these key points along the spine and tail in those images. These images were then used to train the machine learning algorithm.
Olson wrote some custom Python code to interpret the key points found by DeepLabCut, and to classify them as pooping or not pooping. To make the process more resilient, a voting process was also implemented to track these classifications over time, and only trigger a positive result when a certain threshold was met. The final iteration of the algorithm was able to successfully classify images taken in the dark, with the dog partially out of the frame.
When dog pooping has been detected, a red circle is drawn on a map of the backyard. New circles will be added over time, so that when Olson is ready to go clean up the yard, he can follow a map rather than go hunting through the entire backyard. This map is served up over his local network, so he can pull out his cellphone and see the map on the go.
Olson is interested in moving his local setup to the cloud, and also in exploring how he can generalize the algorithm to work for any dog, rather than just Twinkie. He thinks this might be able to be delivered as a service to other procrastinating dog owners. There just may be a market there, but I would suggest taking it one step further — I would like to see a robot that uses this map to do the cleaning up. Something like a robotic vacuum cleaner, just with a way worse job to do.