Nature & Climate

Stargazing With Whale Sharks

Anyone can help to save marine life, with the help of a NASA algorithm and a snorkel

4 min read

Diver photographing a whale shark
A diver films a whale shark as it feeds. Image credit: Anna Flam
How We Get To Next logo

Armed with just my mask, fins, and an underwater camera, I swam with all my might to keep up with the world’s largest species of shark as it propelled itself through the water.

Swimming eye-to-eye with this gentle giant was incredible. This one was a juvenile, “only” five meters long (they can grow up to 20m). Its name may be misleading, but the whale shark is a true shark, not a whale. While this enormous fish doesn’t need to come to the surface to breathe, it can be found in shallow feeding gatherings along coastlines. You don’t have to have a scuba qualification to see one–you can jump into the water with just your snorkel.

My swimming partner looked like it was cruising through the water pretty slowly, but it took me some effort to match its speed. I needed to keep up, because I was trying to collect one more of the thousands of pieces of data being used to conserve endangered whale sharks and protect their habitats.

Let me be clear: I’m not a marine biologist. Science didn’t come particularly naturally to me at school. But I’ve been able to take part in conservation projects as a citizen scientist. And so can you, if you’re lucky enough to swim with a whale shark.

Whale shark
Image credit: Anna Flam

On an “ocean safari” with Peri-Peri Divers in Tofo Beach, Mozambique, we were cruising the bay looking for the ocean’s biggest and most impressive creatures: whale sharks, manta rays, and more. In the water, my goal was to take photos for submission to Wildbook for Whale Sharks, a global visual database that tracks the sharks’ movements around the world.

I needed to photograph a shark’s left side (or, ideally, both sides), just behind its gill slits and above its pectoral fin. A whale shark’s spot patterns are as unique as a human fingerprint, and just a single photograph of this area is enough for researchers to identify and track the movements of individual sharks across oceans.

The technology that facilitates this is an adapted version of the Groth algorithm, a pattern-matching algorithm invented in 1986 by Princeton physics professor Edward J. Groth. It was originally intended for the Hubble Space Telescope program, as a way of orienting Hubble by mapping the star fields it would encounter in space.

The leap from orbit, down into the oceans, isn’t as big as you might imagine. The myriad spots peppered across a whale shark’s deep blue back look like the night sky; in Madagascar, whale sharks are called “marokintana,” or “many stars.”

A screenshot of the program for identifying whale sharks
Image credit: Anna Flam

In 2002, programmer Jason Holmberg had a rare whale shark encounter while diving in the Red Sea, and became fascinated by the challenge of improving tracking methods for this mysterious fish. He likely noticed the celestial resemblance, too; with the help of Goddard Space Flight Center astrophysicist Zaven Arzoumanian, he discovered that an adapted version of the Groth algorithm could be used to identify specific whale shark spot patterns.

By 2005, Holmberg and Arzoumanian had created an online data management system for researchers. They’re now involved in the non-profit organization Wild Me, which offers software consultation on citizen science and wildlife research projects. They built the award-winning Wildbook for Whale Sharks, an open-source project that blends structured wildlife research with artificial intelligence, citizen science, and computer vision to speed up tracking animals and help prevent their extinction.

The photo-identification library invites people from around the world–everyone from citizen scientists to professional researchers–to log their encounters in a visual database. Like facial recognition for animals, it uses photographs of the spot pattern behind the sharks’ gill slits, as well as any scars, to distinguish individual sharks from each other. The algorithm provides researchers with a ranked selection of possible matches for them to visually confirm an existing whale shark in the database or, if there is none, create a new individual profile.

The site is maintained by marine biologists who then analyze this data–even if photos have been taken years apart, by different people–to learn more about whale sharks’ locations and, in turn, protect them better from the threat of extinction. More than 9,000 whale sharks have been identified so far by hundreds of different spotters. The Wildbook bot is one of them, scraping social media as well as sites like YouTube for possible sightings of species it’s been trained to recognize.

“Developing a new information model and software platform to house the algorithm was challenging because nothing similar existed in a cloud/web-deployable form,” Holmberg said. “We were the first attempt to move this work off the desktop and into an online format where researchers could pool data easily and run matching in the cloud and across a global data set. There were a lot of early barriers due to perceived competition, but the value of fast and accurate matching eventually exceeded personal suspicions and the whale shark research community has grown into a very collaborative group.”

Can this software be used for all endangered marine species? Unfortunately, it’s not that simple. Anna Flam, a manta ray researcher at the marine conservation NGO the Marine Megafauna Foundation, told me that Manta (the “Wildbook for manta rays”) needed an algorithm designed specifically for mantas: “The whale shark has clear, defined spots, and a rigid side that can’t move, so the software can easily and effectively analyze its patterns. Identifying the unique spot patterns on a manta’s belly is much harder. Firstly, mantas bend, twist, and roll so it’s difficult to get a flat picture that shows all their markings clearly. Plus, rather than clear dots, they can have dashes, patterns, or splotches.”

A stingray
Image credit: Anna Flam

The software itself varies from species to species. “With whale shark identification, researchers set reference points and mark the spots themselves,” she continued. “With mantas, the algorithm picks out the patterns itself. “¦ This means if a fish, bubbles, or backscatter are in the way, the algorithm might mistake this for a marking and give a less accurate calculation.”

Despite the challenges, huge progress is being made. Each Wildbook site for a new species operates individually, but researchers are now working towards one huge database containing many different animals. Combining this vast quantity of data with learning algorithms could be critical in determining how to protect wildlife from the threat of a “sixth mass extinction” caused by destructive human activities.

How We Get To Next logo

How We Get To Next was a magazine that explored the future of science, technology, and culture from 2014 to 2019. This article is part of our Nature & Climate section, which looks at how human activity is changing the planet–for better or worse. Click the logo to read more.