Autonomous Dog Training with Companion
януари 15, 2020
A guest post by Michael Wang and Noemie Guerin from Companion

Introduction

In this post, I will share how we developed systems to understand dog behavior and influence it through training, and our journey to miniaturizing our computing to fit in a B2B dog training product.

Improving our Pets’ Lives with Technology

Today’s technology has the potential to improve our pets’ lives. As a personal example, I am the proud pet dad of a 4-year-old rescue cat, Adelle. Like many other pet parents, I work full time, leaving my cat alone at home for up to 8 hours per day. When I am at work or away from home, I worry about her, as I never want her to feel lonely or bored, to run out of water or food, or to get sick in my absence.

Luckily, available technology allows me to check on her and improve her welfare in my absence. For example, I have an automatic pet food dispenser to dispense 2 meals a day for Adelle so she always gets fed on time with the correct portion sizes, I have a self-cleaning litter box so that she always has clean litter throughout the day, and I use a Whistle GPS tracker to help ensure that she never gets lost.

While these devices help me ensure my pet's physical well-being, I was always curious to take a step further in our application of technology to help address animal welfare issues. What if we could use technology to communicate with animals? To keep them happy and engaged when we are away from them? Millions of dogs spend multiple hours home alone everyday, and millions more are housed in shelters where they receive little individual attention. Could we leverage this time to improve the quality of the human-animal bond? These are the kind of problems that our team at Companion is interested in solving.

Introducing Companion

In the past two years, our small dedicated team of animal behaviorists and engineers has been working on a new device capable of engaging dogs and working on training autonomously, when people can't be with them. Our first product, the CompanionPro, interacts with dogs through the use of lights, sounds, and a treat dispenser to work on basic obedience behaviors like sit, down, stay, and recall.

Our users are dog shelters and businesses who would like help to improve their dog training services. Shelters are often resource-strapped and can't provide training to all the dogs in their care, despite evidence showing that dogs who are responsive to basic obedience commands are more likely to get adopted in forever homes. Doggie daycares tell us that they struggle to find enough dog trainers to cover the demand for dog training services in their facilities. And facilities who specialize in dog training tell us that they wish their trainers could focus on teaching dogs advanced tasks, but that they instead have to spend long hours repeating the same exercises to ensure that dogs will be responsive to basic obedience behaviors. Luckily, machines excel at performing repetitive tasks with perfect consistency and infinite patience, which brought us on the path of creating an autonomous training device.

Building this product presented many challenges. We first had to run experiments to prove that we could train dogs in the absence of a human trainer in the room, then build models to understand dog behavior and determine how to react to it, and finally miniaturize our technology to fit it in a product that we could sell to dog shelters and businesses.

Understanding animals with TensorFlow

Just as good communication starts with good listening among people, good dog training relies on a good understanding of their signals and behavior. In order to understand the kind of perception problems that TPUs helped us solve, we need to understand what kind of information human trainers find important to understand dogs. Below are some of the questions a human trainer may ask themselves during dog training:
  1. Is the dog eating the treat?
  2. Is the dog performing the “sit” behavior?
  3. Does the dog already know the “down” command?
  4. Has the dog had any previous training?
  5. Where is the dog within the environment?
  6. How far away is the dog from me?
  7. Is the dog paying attention to me?
  8. Am I working with a food motivated dog?
  9. Is the dog barking or whining?
To answer these questions, we opted to use Machine Learning, and more specifically Deep Learning, which excels at solving problems related to human perception and looking for patterns in things like behavior over time. Deep Learning is widely applied in fields such as Computer Vision and Natural Language Processing for this reason. Our first step was to map out all the signals we were interested in collecting. Our Animal Behavior team listed all the body postures and vocalizations that we wanted to collect to be able to understand dogs' readiness for training.

To train our powerful Computer Vision neural networks, we chose to use TensorFlow as our Deep Learning platform. Using Google's cloud TPUs, training our networks was both faster and cheaper than using multiple GPUs for the same task. The resulting models could then be run locally on GPUs with our desktops to determine the dog’s real time behavior and ultimately to train dogs. Our models analyze the dogs' body language and vocalizations to understand their current state and be able to engage them.
Figure 1: Examples of the Companion identifying different dog postures. Above is Indy, one of our tester dogs at doggie daycare. Indy's Mom saw an improvement in his responsiveness to "sit" and "recall" after a few weeks in training.
Boomer, our CEO's dog, during one of his multiple test sessions.

Autonomously Interacting with Animals

Once we were confident in our ability to understand a dog's behavior in real-time, we started reacting to that behavior to create interactions. Our device is equipped with a treat dispenser, and with lights and speakers to be able to communicate with the dog through audio and visual signals, and treat rewards. Companion uses rewards-based positive reinforcement training. It means that our device provides rewards for desirable behaviors to make the frequency of that behavior go up.

The steps are the same as those that a human trainer would take. Let's imagine we are trying to teach a dog to sit and stay when told "sit". Our first step is to acclimate the dog to the CompanionPro. To get the dog used to the device, it will first give the dogs treats unconditionally. When the human supervising the dog is confident that the dog is happy with the device, they can leave the room and let the dog interact autonomously with it. So far, working with hundreds of dogs in shelters and daycare facilities, we have been able to acclimate over 95% of dogs, across all breeds and ages, to our CompanionPro device.

Throughout training, the device will always make sure that the dog is ready to work, looking for signs that the dog is comfortable and eager to interact. The CompanionPro will then wait for the dog to sit naturally and immediately reward the dog for that behavior. As the dog starts sitting more, the device will then introduce the verbal command "sit". Using an adaptive learning method, the CompanionPro can then increase the duration the dog needs to be sitting to start shaping a stay. Using multiple training sessions, we can gradually increase the “sit and stay” duration from fractions of a second to multiple minutes. When a dog has gone through this process for multiple behaviors, we can start playing games with the dog, asking for multiple behaviors in the same session, so the dog sharpens their understanding of verbal commands. For example, we can rotate between asking for “sit”, “down”, and “recall”.

Using this system running on large desktop GPUs, we have been able to engage dogs in CompanionPro training. The guardians of our testers all reported that their dogs were more responsive to their verbal commands, and generally more attentive when they practiced training at home.

One of the most common conditions treated at the SF SPCA behavior clinic is Separation Anxiety. Dogs with Separation Anxiety become overly distressed when left alone, and can vocalize, have painful GI issues, or destroy furniture when their guardians leave the home. This makes treatment difficult as the dog only presents symptoms when left alone, i.e. when nobody is around to help soothe them. Companion's team collaborated with the SF SPCA behavior team to test the effect of using Companion training as a way to engage dogs with separation anxiety when their guardians leave the home, and reduce signs of distress. Our early results imply that our automated training method may alleviate the symptoms of separation anxiety, thereby improving dogs' welfare and their guardians' quality of life.

After successful training trials and early signs that our technology can help to alleviate separation anxiety, we had our confirmation that autonomous training worked and could benefit dogs and their guardians. The next step was including our technology in a product practical enough to be used in dog businesses.

Miniaturizing Autonomous Dog Training

The testing systems we used required large desktop GPUs with TensorFlow, presenting multiple challenges in the shelters and dog businesses in which we work. Beyond the actual weight of our development devices, they were also costly and far from being dog-proof. In order to fit into a practical product, we had to look for solutions to miniaturize our systems.

We looked for a mobile platform that would still have the computing power necessary to run our neural networks, in order to understand and respond to dog behavior in real time. After evaluating several mobile platforms, we chose Google's EdgeTPU, which would allow us to run TensorFlow Lite, TensorFlow's mobile sibling. We found that Google’s EdgeTPU specifically allowed us to take our mobile Computer Vision models and run them up to 4 times faster than on previous systems.

Since miniaturizing, we have been able to train more dogs using our mobile platform, and to work hard on wrapping up our product. Today we are able to announce that Companion will start taking reservations for our CompanionPro devices to be delivered in late 2020. We can't wait to help thousands more dogs find homes and create lasting bonds with their guardians with TensorFlowLite.

Conclusion

At Companion, we have developed a device using Google’s TensorFlowLite (and EdgeTPU) to train dogs autonomously to an advanced level of responsiveness on multiple behaviors including sit, down, stay, and recall. We believe this will have a very large, positive effect on adoption and retention rates in lean shelters across the US, by making enrichment and training available for all dogs at lower cost. Google’s EdgeTPUs enable us to understand the dog’s behavior as they interact with our device. This understanding allows the CompanionPro device to use precise positive reinforcement by rewarding dogs with food when they perform desired behaviors. Ultimately, the Companion helps us to understand and improve the lives of our pets.

Resources

[1] Companion's Website
[2] SF SPCA Blog Post
[3] Separation Anxiety Disorder
Next post
Autonomous Dog Training with Companion

A guest post by Michael Wang and Noemie Guerin from Companion

IntroductionIn this post, I will share how we developed systems to understand dog behavior and influence it through training, and our journey to miniaturizing our computing to fit in a B2B dog training product.
Improving our Pets’ Lives with TechnologyToday’s technology has the potential to improve our pets’ lives. As a personal example,…