LaneLens: OSM lane counts from street-level imagery

LaneLens infers the number of lanes on a road segment (1 / 2 / 3+) from Mapillary street-level images and combines that with the segment's OpenStreetMap road class (highway) and one-way status. It was built to find OSM lanes values that are probably missing or wrong, on the road types where the road class alone does not tell you the lane count.

It is designed as a review queue for mappers. It is not meant for automatic editing.

LaneLens on Eindhoven, a held-out city: road segments where the model overrides the road-class rule, coloured by which was correct, with example Mapillary images

Headline result

These results come from Eindhoven, a city that was held out entirely during training and validation (3,686 road segments). Each road segment is scored once, using all of its matched images.

Method Macro-F1 Gain over rule (95% CI)
Rule: majority lane count per highway + oneway 0.457 β€”
Image-only CNN β€” +0.155 (0.133 – 0.175)
End-to-end fusion (image + road class + one-way) β€” +0.198 (0.181 – 0.216)
Image CNN + metadata stacker 0.656 +0.198 (0.179 – 0.217)
LaneLens hybrid (released pipeline) 0.640 +0.182 (0.163 – 0.201)

The confidence intervals come from 1,000 bootstrap resamples over road segments.

As a review queue: the hybrid overrides the road-class rule on 794 of the 3,686 segments (22%). On those segments LaneLens is correct 60.3% of the time and the rule is correct 22.5% of the time. So the flagged segments are about 2.7Γ— more likely to contain a real lane-count correction than if the rule were trusted.

How it works

  1. Roads. OSM drivable roads come from Geofabrik extracts, are processed with OSMnx and kept as simplified, undirected segments. Labels come from the lanes tag, mapped to 1 / 2 / 3+ classes. A segment whose tag holds conflicting values is left unlabelled.
  2. Images. Mapillary image metadata is read from vector tiles (zoom 14). Panoramas, imagery captured on foot, and imagery from before 2018 are removed. The rest is thinned to one image per 10 m cell per 45Β° heading bin.
  3. Matching. An image is matched to a segment only if it is within 8 m of it, its camera heading is within Β±30Β° of the segment bearing, and it is not close to either end of the segment (min(8 m, 20% of segment length)). Each segment keeps at most 10 images.
  4. Image model. ConvNeXt-Tiny (convnext_tiny.fb_in22k), fine-tuned at 288Γ—512 resolution with class-weighted cross-entropy loss.
  5. Stacker. A logistic regression combines the image model's log-probabilities with a one-hot road class and the one-way flag. It is fitted on the validation split.
  6. Hybrid policy. The model's prediction is used only for the road classes where it beat the rule on validation by more than 2 points with at least 15 segments: secondary, primary, motorway and motorway_link. Every other class keeps the rule. The policy was chosen on validation and applied to the test city once.
  7. Segment prediction. The image-level probabilities are averaged over all of the segment's images.

Training data

Split Cities Labelled segments Images
Train + validation Utrecht, Rotterdam 5,106 23,172
Test (held out) Eindhoven 3,686 16,444

Validation is 15% of the train cities, split by 500 m spatial blocks so that no segment appears in more than one split.

Per-class results (test city, hybrid)

Lanes Precision Recall F1 Segments
1 0.751 0.817 0.783 1,563
2 0.670 0.743 0.705 1,608
3+ 0.767 0.301 0.432 515

Limitations

  • 3+ lanes are under-detected. Recall is 0.30, and most of the misses are predicted as 2 lanes. Do not use LaneLens to find wide roads.
  • No gain on minor roads. On residential, tertiary and unclassified roads the model does not beat the road-class rule, so the hybrid uses the rule there. When the model is confident on these roads, its predictions are the same as the rule's.
  • The labels are noisy. OSM lanes values are inconsistent, especially on dual carriageways where each direction is mapped as its own way, and on unmarked streets.
  • Only one country has been tested. The model was trained and evaluated on three Dutch cities. Road markings, signage and imagery coverage differ in other countries.
  • Imagery age. Images from 2018 onward are used, so a road that has been rebuilt since then may be mislabelled.
  • Not for automatic editing. A precision of 60% on overrides is useful for flagging segments for review. It is not high enough to edit OSM directly.

Intended use

  • Building review queues, such as MapRoulette-style challenges, for segments where the imagery disagrees with the expected lane count
  • Research on inferring road attributes from crowd-sourced street-level imagery
  • A starting point for transfer to other regions, which needs re-validation there

Files

File Contents
image_only_v2.pt ConvNeXt-Tiny image model (state dict)
fusion_v2.pt End-to-end fusion model (state dict)
stacker.joblib Logistic-regression stacker
config.json Class names, road-class vocabulary, hybrid policy, input size
assets/lanelens_eindhoven.png Overview figure for the held-out test city

Attribution and licences

  • Street-level imagery: Β© Mapillary contributors, CC BY-SA 4.0
  • Road network and labels: Β© OpenStreetMap contributors, ODbL 1.0, via Geofabrik
  • Backbone: ConvNeXt-Tiny ImageNet-22k weights via timm

The model weights are released under CC BY-SA 4.0. Any outputs derived from OSM data must keep ODbL attribution.

Author

Nitin Kumar Pande. GIS Solutions Architect and GeoAI developer Β· geoaipro.tech

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support