Facebook AI-Assisted Road Tracing

From OpenStreetMap Wiki
(Redirected from AI-Assisted Road Tracing)
Jump to navigation Jump to search

Facebook has been running a project to perform AI-Assisted Road Tracing within OpenStreetMap. This has been an ongoing effort since 2017 and has included, Thailand, Indonesia, Malaysia, Vietnam, India, and Tanzania.

In 2016, Facebook started researching how various machine learning algorithms could be integrated into a mapping workflow. At State of the Map 2016, Facebook shared initial results on how one could use AI and new mapping techniques, such as advanced deep neural net models, to detect roads from satellite imagery. In 2017, the team initially mapped Thailand and Indonesia using an internal fork of iD designed to work with AI data. In 2019, this version of iD was further refined and made available to the public for worldwide AI assisted mapping as RapiD. In early 2020, a JOSM plugin for using Map With AI data was also released.

Our goal is to collaborate with the OpenStreetMap community to create quality road data, validated by trained mappers and local OSM communities. Please send questions to osm@fb.com.

For more information on the project please also check out Mapwith.ai and the github page Facebook OSM Data Team.


Partnering with the local OSM communities, the pilot mapping countries were Thailand followed by Indonesia. They chose these countries because of their relative low road coverage on OSM.

Ongoing Projects


  • Ongoing since January 21st, 2020
  • Changeset: #mapwithai #Vietnam


  • Ongoing since February 1st, 2020
  • Changeset: #mapwithai #Tanzania


Completed Projects


  • June 1, 2017 - December 21, 2018
  • Stats for total project length (including community contributions during the time frame):
    • 956,381 New ways added
    • 515,306 km of roads added


  • Road Network Changes from March 1, 2018 - September 24, 2019
    • 1,095,034 new ways added
    • 474,409 km of roads added
  • Stats for total project length (including community contributions during the time frame)
    • 1,711,470 new ways added
    • 614,328 km of roads added


  • December 23, 2019 - December 31, 2019

We added missing roads to area around the city of Leogane at the request of MotoMeds Haiti.


  • September 11, 2019 - January, 20, 2020
  • Changeset: #mapwithai #Malaysia

Unorganized mapping

In addition to the mapping projects controlled by Facebook and collaborators, the road data can also be used by anyone else using RapiD and JOSM's MapWithAI plugin. The tagging by default follows #Element Tags. The changesets themselves may be a bit harder to recognize as they are often untagged: for RapiD you can look for the editor info, for the JOSM plugin I have no idea.

In general, the road data is quite handy for tracing neighborhood service roads and unnamed rural roads. See #Quality and #Mapping Process for what to watch out for when using MapWithAI on your own.

AI Data Processing

Maxar source imagery

Maxar's Vivid+ product provides high-resolution (50cm / pixel, or zoom 18) color-corrected cloud-free satellite imagery with full country coverage. We have license to extract road data from the imagery and contribute to OSM.

The publicly available Maxar Premium layer in iD, RapiD, and JOSM is essentially what is used in the creation of our road predictions. However, this layer is constantly being updated while our predictions are only rerun occasionally, so they may fall out of date with what is being displayed. If our predicted roads appear to be very out of date, feel free to reach out and we can prioritize a rerun.

Figure 2.png

Road Extraction

Currently, Facebook is only directly generating and mapping AI roads, although other data sets such as Microsoft's AI building footprints are available in RapiD. We use the latest deep learning algorithms to assist road extraction and mapping. Here is an example of a prediction using deep learning for an area in Egypt. Initial, predictions are in a raster (image) format rather than a vector format suitable for mapping.

Example of AI road prediction.png

AI road mask example.png

Once an area is predicted, we vectorize the data into lines and then conflate it with OSM. This removes any road already mapped, adds connections, and suggested tags.

AI postprocessing example.png

Data Preparation

Road Type Tagging

During the submission process, our mappers will assign and fix road types according to the general highway tag guidelines of OSM http://wiki.openstreetmap.org/wiki/Key:highway

Before moving to a new location, we will work with mappers from local OSM community in each country to verify our highway tagging method and make sure they align with local conventions.

Some other methods we use to tag roads include:

  • Referring to local Wiki guides for each country.
  • Looking at commonly used tags in the local area of mapping.
  • When connecting to current OSM roads on the map we try to use the same tag where it makes sense to do so.
  • Referring to local community for advice.

Changeset Tags

We currently use the following tagging format for changesets:

  • Current format
    • #mapwithai #country
  • For Thailand and Indonesia:
    • #nsroadimport #thailand
    • #nsroadimport #indonesia

Element Tags

  • Current format
    • source = maxar
  • Before September 12, 2020
  • For Thailand and Indonesia
    • source = digitalglobe
    • import = yes

The 'source' tag indicates that road geometries are based on Maxar satellite imagery.

Mapping Process

The mapping process consists of the following steps summarized in the image below.

Project Workflow.png

  1. Before beginning a new country, we reach out to the local community using the communication channels popular for that country. This can include any combination of mailing lists, OSM forum, Telegram, Facebook, Slack, or WhatsApp.
  2. We use the OSM Tasking manager to divide up tasks and create a flow of editing and validation for the Facebook mapping team.
  3. The Mapper picks a task and loads a task using RapiD editor.
  4. The Mapper evaluates the task adding roads as needed using RapiD suggestions. Once added, the mapper will adjust the roads as needed for things such as geometry and tagging. Poor predictions or low value predictions will be ignored and thus not uploaded. Before upload, mappers resolve any validation issues using the validation panel built into iD and RapiD.
  5. Once a Mapper completes their task it goes to a Reviewer who reviews the task using JOSM with a custom paint style to distinguish AI roads from preexisting data. Small issues will be fixed immediately, while larger issues will be sent back to the Mapper for fixing as part of the ongoing learning process.
    • Some examples of validation the Reviewer will run:
      • Short Unclassified ways (between 10-60 meters)
      • Highway crossing waterway without a bridge ta
      • Highway crossing buildings
      • Overlapping ways
      • Unmerged ways
      • Inconsistency between task squares
      • incorrect highway tags


  1. We monitor all comments made on our edits and reply to them in a timely fashion. We are happy to incorporate feedback and local expertise into our validation process and future mapping behaviors.
  2. Once a project is completed, we load up the entire project grid into JOSM and go back through the data to make final validation corrections. Some road tagging is easier to do at larger scales as there is a fuller picture of the network so this is a vital step to ensuring quality.

Mapping Team

The map editing team consists of Mappers and Validators, and their accounts are listed as below. Among the skills required:

  • Good experience with iD and JOSM.
  • Familiarity with editing norms: how to merge nodes (M), join ways (J), combine ways (C) and un-glueing (G)
  • They knows how to handle conflicts with both iD tool and JOSM.

Our accounts follow recognizable patterns to make it simple to identify our mappers. VLD just stands for validator and RVR for reviewer which were terms we used early on and have stuck with for consistency.

Visit Organised_Editing/Activities/Facebook#Mapping_Team for an up to date list of mappers.


What does AI mean?
Artificial Intelligence (AI) is training a computer to do things that require intelligence when done by humans. In this case it involves creating training data for an area by tracing out satellite imagery the same way you would when editing and feeding it to a computer. The output of this is road masks.
Are there limitations with AI?
Yes, AI and algorithms still have a long way to go to figure things such as assigning tags according to OSM region specific guidelines, figure out the correct OSM relation, add bridges over waterbodies or figure out connections with crossing railways among many other things. Currently all of this is done by our mappers manually.
Are you adding roads directly to OSM without humans validating?
Every single road from the AI output will be added only if a a mapper chooses to add it to the map. This ensures that every way is inspected by a human and corrections will be made to geometry or tagging before uploading to live OSM.
What Imagery are you using?
We are using Maxar's Vivid+ which is high-resolution (50cm / pixel, or zoom 18) color-corrected and cloud-free
Can you share Maxar imagery?
Our imagery is very similar to the Maxar Premium imagery available in iD and JOSM.
Facebook License with Maxar
This license is necessary to comply with our obligations to Maxar, and we think the benefits of supplying this data outweigh the licensing restraints. The data will be under ODBL once it has been contributed to OSM in compliance with the terms.
There is no contradiction between the OSM terms and the Facebook license with Maxar. Our license terms do not apply to data once contributed to OSM and termination of the agreement with Maxar would not impact the data that has already been contributed to OSM.
Is the Imagery free of Cloud Cover?
The intended output of +Vivid is cloud free, and in most cases, Maxar meets this. There are some highly cloudy parts of the world where it’s unavoidable. On average though, this product maintains less than 1% cloud cover.
Who is behind osm@fb.com?
Most of our engineering team and QA team are behind this email. This helps us collaborate as a team and is the most efficient way for everyone to be on the same page. More people also ensures that no emails are missed.
Can you Publish Source Code for ML?
We cannot share the source code for Machine Learning at this time, but we can and will share our internal tools.
Can you Publish Source Code for internal tools?
Yes. RapiD is open source and available at https://github.com/facebookincubator/RapiD/ . The MapWithAI JOSM plugin is also open source and available at https://github.com/KaartGroup/JOSM_MapWIthAI_plugin
Can Facebook share other data?
This is clear violation of privacy so we cannot share this kind of information. We are exploring ways to crowdsource road names for OSM and will share that as we have a more concrete plan.
Are you going to map other countries?
Yes. We have mapped several countries at this point, including Thailand, Indonesia, Malaysia, Vietnam, India, and Tanzania. In India and Tanzania we are taking a more targeted approach rather than mapping whole countries. This will allow us to expand our scope more quickly.


The road output has the following characteristics:

  • Streams may be conflated with roads. Kind of handy for tracing waterway, but obviously confusing.
  • Road types may not make much sense as it's currently inferred from neighboring roads. Use human sense.
  • Roads are not usually merged / split according to human instinct; grids are often not followed. Just manually split and merge as you like.
  • Careful painting of curves, but sometimes resulting in unnecessary nodes on straight roads. Delete the nodes as you like.
  • Some roads may be incorrectly (dis)connected when the imagery is confusing. Switch to non-Maxar imagery or GPX and cross-check. This is confusing for human armchair mappers too.

The building output from Microsoft may have occasionally false positives from waves or other bright natural features. As it is based on Bing instead of Maxar imagery, it is quite obvious when you are using Maxar.