Backyard Brains Logo

Neuroscience for Everyone!

+1 (855) GET-SPIKES (855-438-7745)

items ()

Octopus Wrestling and Computer Vision


Hello again my faithful viewers, and thanks for tuning in for another exciting octopus themed blog post. As always I am your host Ilya Chugunov, but today I’ve come with sad news; all good things must come to an end, and this marks the end of my summer research here with Backyard Brains. Now’s a time to grab a hot cocoa and reminisce on what we’ve learned and talk about what there’s still left to do.

First and foremost, if you haven’t already had the chance to look at my previous blog posts, you can see them here:

Octopus Learning and Behavior

Studying Aggressive Behavior in Octopodes

Now let’s recap and break this down into some conversational dialogue.

First, we found out, rather accidentally, that if left together our Bimacs will wrestle each other to assert dominance. This gave us the idea of using computer vision to gather data for analysis with the hope that we could identify some interesting features within their behaviors.

First I built my acrylic setup to record the octopuses doing their thing, making sure to have even lighting and a stable setup for my Go Pro so that the code didn’t just explode from all the variability.

The first, and most classic, behavior found in our trials with the Bimacs were “bouts”, which were little sumo-wrestling fights where each octopus tried to push the other around as far as possible; these were common when both the octopuses were excited and lasted about 5 seconds each.

The second curious behavior found was the “poke”, where one octopus wanted to provoke a real fight, but the other just wasn’t feeling it. The more excited octopus would waltz up to the lazy-bones and just briefly tap him with an arm before jetting off across the chamber.

I noticed that in both the bouts and the pokes, right as the distance between the two octopuses closed, and they made contact, the angle between them rapidly decreased too. They would approach each other sideways (almost backwards at times), then rapidly spin around right as they got close to poke/fight. In the poke behavior, the offending octopus would then spin back around and jet off, while in the bout behavior they’d just stay locked face to face.

Another notable thing our octopus do in their fighting ritual is change colors. As I assume you already know, these guys are covered in chromatophores and seem to flash bright black as they go on the offensive (Can you tell who the attacker is in that picture above?).

The poke behaviour elicited the same response, twice! The first bump was the attacked octopus darkening as the poking octopus approached it and second was the poking octopus turning a dark brown as he squirted away.

“But Ilya, how in the world do you process so much video? And how do you know when the fight starts in the first place?”
Why thanks for the question, hypothetical reader. I use a mess of MOG (Mixture of Gaussians) background subtraction, erosion, and band-pass filtering combined with the OpenCV convex hull functions to find the general outlines of the octopus, and then I check if they’re two separate blobs, or one combined megaoctopus. If they’re 2 blobs, they’re not in contact, and vice versa, so now it’s easy to define first contact and a bout vs a poke (long contact, short contact).


Using a simple windowing function and a pretty boring logistic regression, we can take a bunch of our video clips of octopus fights where we’ve already classified when a fight occurs, and from them predict a point of contact in a new video we feed into the algorithm. This is where the concept of machine learning starts to play into the project, letting a program learn from previous octopus video to predict what will happen in new octopus video.

I’ve compiled my research results and created a poster which I presented at a University of Michigan symposium.

What’s next?

For me, Canada. Heading up to Montreal next week.

In general, my code is up on my GitHub and is completely open source, so anyone is welcome to make changes to it, take it in whatever directions they want; you don’t even have to use it on octopus if you don’t want. 

Now for some musings…

I’m excited about computer vision. Historically, behavioral studies involve a lot of humans watching animals, recording specific events (like eating a certain food and when), or interpreting their behavior. This is not only time consuming, but also unscientific. In these studies, there needs to be redundancy. Multiple people need to record the events. Then, that data needs to be interpreted statistically to ensure that, on average, the interpretations are consistent between different observers. As you can see already, it is challenging. Computer Vision programs are changing this!
By taking the humans out of the equation, you remove chances for bias, for missed behaviors or interaction, or fudged results. Computer vision techniques can be used to comb over hundreds of hours of video footage, quickly providing researchers with quantifiable results. There are certainly still some behavioral studies that require human discretion, for instance, was a touch affectionate or aggressive, but for many researchers, computer vision is the future.

I think there’s a lot still to be done with computer vision and behavioral analysis, and this summer research was just me dipping my foot into the pool. There is much more data we can draw from the same video I was working with, tentacle position and length, how curled the octopus’s arms were, maybe even their heartrate could be extrapolated with enough clever coding. As I continue onward in whatever field of STEM I find myself in next, I hope to keep throwing computational power at problems that don’t seem like they even need a computer, because who knows, maybe they do.

I’ll leave you with some boring philosophy. No one, not a single scientist, knows for certain what the next big thing is going to be. No one knows when or where the next technological revolution is going to be, no one knows if the next world-changing invention is going to be made in a million dollar Elon Musk laboratory, or at 3am by a hungover student in their dorm room. So just know that when you read a blog post like this, about an 11 week undergrad project, even it has the chance to be something big; not all scientific breakthroughs are made by bearded dudes in lab coats, they could be made by you.

Studying the Aggressive Behavior of Octopodes

Oh hey there! Long time no see, why don’t you have a seat and hear what I’ve been up to since my last blog update.

If you were at the Ann Arbor 4th of July parade you might have seen me dressed up as a beautiful purple octopus (or maybe it was a squid? The costume was quite ambiguous). The costume was an elegant combination of recycled foam, acrylic paint, paper mache, and hope.

For the behavioral analysis part of my project I have decided to forgo maze solving, as forcing an octopus to run a maze over and over for data proves both more difficult than previously thought and honestly doesn’t seem that fun for the octopus itself.

Instead, I have decided to delve deeply into deciphering the ancient mystery of Octopus wrestling. Believe it or not, if left to their own devices, bimac octopuses absolutely love to have wrestling matches, pushing around their opponent with their tentacles to figure out who among them is truly the dominant bimac. They then take a short break (only a couple minutes at max) and go back at it again, in a rematch to see if the underdog can take a round off the reigning champion.

Before you get too worried for the safety of our small aquatic friends, know that I’m not forcing or aggravating them into wrestling and that it’s actually quite difficult to prevent them from tusseling. Additionally, I keep a close watch on them to make sure no one is trying any dirty tricks like biting or going for the eyes.

This unique behavior prompted me to laser cut some custom housing arrangements for these 8 legged boxers. They are very territorial, so I had to construct some acrylic dividers with nylon mesh windows to promote water circulation. I inserted these into their aquarium to separate it into three individual tanks for the octopus because I’d prefer them not to fight unsupervised.

Next, to film the matches I constructed an acrylic wrestling chamber with a rack to hold the video camera for recording. This way they have an area to fight and my camera is guaranteed to give me the same angle of video every time.

I mount a go-pro facing directly down into the white, open-faced tank. This way I get identically framed footage every time, very important for later analysis

One tank becomes three…

There are many intricacies to an octopus wrestling match, many behaviors and patterns that we can try to decompose and comprehend with the help of computation. They circle each other, they taunt their opponent with their curled tentacles, they sometimes even act almost coy towards each other. This is where I switch to a completely different animal, Python, to analyze the speeds, positions, angles, and even colorings of the octopuses.

Why won’t you Look me in the Eyes?

Our confidently wrestling octopuses seem to have a bit of a shy side when it comes to making eye contact with each other. As you can see in the two frames from footage recorded of the octopuses before a wrestling bout, they do not appear to be facing each other at all, and watching the footage confirms this; they approach one another by moving sideways, not with their tentacles leading the movement as one would expect.

This however drastically changes as the distance between them closes, as seen in the above graph, as the distance lowers beyond a certain point, the angle between the two octopus rapidly drops to zero (zero meaning they are directly facing each other).

This seems to indicate a certain “fight zone” or, dare I say, a “danger zone”, where if the distance between the two enters this zone they will rapidly spin around to face their opponent with tentacles at the ready. This is most curious since it’s not only octopuses that display this kind of behavior.

Link to Gorilla Fight: Keep an eye out for how they approach eachother at a weird angle…

Even Silverback Gorillas tend to go into a fight sideways, spinning to face their opponent at the last moment of their approach, and black iguanas are suggested to use eye contact and approach to discriminate risk from an approaching animal (As described in the 1992 paper Risk discrimination of eye contact and directness of approach in black iguanas  by Joanna Burger).

Octopuses: Maybe not as Bright as we Think

No, I’m not talking about their intelligence, of course, the octopuses we have are plenty smart, even though they sometimes seem to forget what exactly to do with a crab we give them for food, deciding to instead stare at them for a while. I’m talking about their physical coloring, their chromatophores.

Their coloring is an extremely reliable way to know if you’re coming too close towards them. Even when they’re still in their tank, if you quickly approach the glass they will drastically darken their color, hoping you leave them alone.


When there’s a fair bit of distance between the competitors, they both appear to be a shade of light beige, but once that distance closes and we enter the “danger zone”, the one going on the offensive colors its tentacles a dark brown before entering the active wrestling bout.

In the pictures below we can identify the attacker and defender by their relative colorings, the bottom octopus flaring up with color in its first offensive, and then the top one flaring up in retaliation.

I’m Bored Already, So What and What’s Next?

If we can confidently identify parallels between these octopuses and other non-cephalopod animals when it comes to approaching and commencing a fight, we might be left with a great assay tool to study the physiological and genetic influences on this behavior. Bimacs are quite ubiquitous and easy to care for animals, and so finding such a use for them would help make neuroscience a more accessible topic for audiences outside of research laboratories, since even a high-school student can take good care of a bimac octopus.

I’m now working on a program that uses convex hulls to draw a contour surrounding the octopus, in order to get a bearing its relative size and tell us more about what it’s doing with its tentacles. A tightly curled up octopus will have a very small contour, whereas a more freely spread out one will take up a much larger area with its contour. This might prove to be interesting information when it comes to analyzing the initiation of the wrestling matches where there is a lot of shape changes in the octopuses.

Additionally, I’m hoping to gather enough data in the next couple weeks to show real trends in the octopus behavior and run more general analyses on the full collection of vectors. This will let me say more confident statements on the overall behavior of the bimacs.