A new map of nearly all of Africa shows exactly where the continent’s 1.3 billion people live, down to the meter, which could help everyone from local governments to aid organizations. The map joins others like it from Facebook created by running satellite imagery through a machine learning model.

It’s not exactly that there was some mystery about where people live, but the degree of precision matters. You may know that a million people live in a given region, and that about half are in the bigger city and another quarter in assorted towns. But that leaves hundreds of thousands only accounted for in the vaguest way.

Fortunately, you can always inspect satellite imagery and pick out the spots where small villages and isolated houses and communities are located. The only problem is that Africa is big. Really big. Manually labeling the satellite imagery even from a single mid-sized country like Gabon or Malawi would take a huge amount of time and effort. And for many applications of the data, such as coordinating the response to a natural disaster or distributing vaccinations, time lost is lives lost.

Better to get it all done at once then, right? That’s the idea behind Facebook’s Population Density Maps project, which had already mapped several countries over the last couple of years before the decision was made to take on the entire African continent.

“The maps from Facebook ensure we focus our volunteers’ time and resources on the places they’re most needed, improving the efficacy of our programs,” said Tyler Radford, executive director of the Humanitarian OpenStreetMap Team, one of the project’s partners.

The core idea is straightforward: Match census data (how many people live in a region) with structure data derived from satellite imagery to get a much better idea of where those people are located.

“With just the census data, the best you can do is assume that people live everywhere in the district – buildings, fields, and forests alike,” said Facebook engineer James Gill. “But once you know the building locations, you can skip the fields and forests and only allocate the population to the buildings. This gives you very detailed 30 meter by 30 meter population maps.”

That’s several times more accurate than any extant population map of this size. The analysis is done by a machine learning agent trained on OpenStreetMap data from all over the world, where people have labeled and outlined buildings and other features.

First the huge amount of Africa’s surface that obviously has no structure had to be removed from consideration, reducing the amount of space the team had to evaluate by a factor of a thousand or more. Then, using a region-specific algorithm (because things look a lot different in coastal Morocco than they do in central Chad), the model identifies patches that contain a building.

Throughout this process there’s a lot of double-checking by humans to make sure there are no regional biases or tendencies to mislabel in some way or another. The team has been doing it for some time, so it’s not their first rodeo, but the scale of “one country” versus “all of Africa” is a bit different. Fortunately, there have been some advances, as the company’s AI team wrote in an explanatory blog post:

We’ve been able to simplify the problem to a straightforward binary classification task… Now, given an input image, a single neural net predicts whether the given image contains a building. This approach to classification is also significantly less computationally expensive than a segmentation-based approach because it allows us to use smaller neural nets and produce outputs with a smaller memory footprint.

With greater efficiency, in this case, also comes greater accuracy, because the algorithms will have learned from their previous attempts and more data is included to prevent false positives and negatives. The team found that of 1,000 patches labeled as containing buildings, 996 of them were correct. That kind of error rate sounds pretty acceptable to me, and is certainly better than the existing tools, which only gave you a vague “out there somewhere” when you asked about a small community or off-grid village.

If you’re wondering why Facebook is doing this in the first place, it has to do with their efforts over past years to identify populations with poor connectivity, so they can then beam internet down to them with lasers or the like. That’s all rather low priority right now, what with the company’s many current problems, but the tools it was building clearly had humanitarian applications and it’s nice to see that the baby was not thrown out with the bathwater.