Skip to main content
Public Preview
The following content is a read-only preview of an executable Jupyter notebook.To run this notebook interactively:
  1. Go to Models in Wherobots Cloud.
  2. Select the model whose notebook you wish to run.
  3. Click Try it, select the Solution notebook tab, then click Open the solution notebook.
tile2net banner This notebook will guide you through detecting sidewalks from aerial imagery, using Wherobots RasterFlow and the Tile2Net model. You will gain a hands-on understanding of how to run models like Tile2Net on your selected area of interest, vectorize the model outputs, and work with those vectors in WherobotsDB.

Tile2Net

The Tile2Net1 model is an open source segmentation model that can detect sidewalks and other pathways from very high resolution imagery. This model predicts 4 classes:
  • background
  • road
  • sidewalk
  • crosswalk
It was trained on ~19cm aerial imagery from USGS for Cambridge, Manhattan, Brooklyn, and Washington DC. We will demonstrate results using 30cm resolution data from the National Agriculture Imagery Program (NAIP).

Preview: model inputs and outputs

The interactive map linked below shows the input imagery and model outputs for this notebook’s example AOI. Toggle layers in the sidebar to compare the inputs, the raster model output, and the vectorized geometries side-by-side. Layers (top layer first, as in the map’s layer list):
  • Tile2Net PM Tiles: Vectorized sidewalk, road and crosswalk polygons in PMTiles format, created from the vector geometries
  • Tile2Net vector geometries: Vectorized sidewalk / road / crosswalk polygons derived from the raster output
  • Tile2Net model outputs: Raster output from the model, with bands for sidewalk / road / crosswalk classes
  • Tile2Net input mosaic: RGB high-resolution aerial imagery the model runs on
View the interactive map here.

Selecting an Area of Interest (AOI)

To start, we will choose an Area of Interest (AOI) for our analysis. Tile2Net was trained on select geographies in the Northeastern United States. So we will pick a location in that geographic region that wasn’t in the training data and where these is recent 30cm resolution NAIP data: College Park, Maryland.

Selecting a time range and verifying NAIP coverage

Because NAIP collects state-level imagery at mixed resolutions, Tile2Net’s required 30cm data may not exist for your selected AOI or timeframe. The USDA’s NAIP coverage map (PDF, 2002-2025) shows what is available where.

Using the Wherobots Tasks API

Each RasterFlow workflow runs as a task through the Wherobots Python SDK. run_task below starts a task run, waits for it to finish, and returns its output value. Recipes return an object with input_mosaic and result; standalone tasks return a URI. Call wb.tasks.get("<task name>").input_schema to see every input a task accepts.

Running a model

RasterFlow has pre-defined workflows to simplify orchestration of the processing steps for model inference. These steps include:
  • Ingesting imagery for the specified Area of Interest (AOI)
  • Generating a seamless image from multiple image tiles (a mosaic)
  • Running inference with the selected model
The recipe returns input_mosaic for the source imagery and result for the predictions. Each contains a mosaic_index_uri for its GeoParquet index and a first_row_mosaic for its first Zarr store. Note: This step will take approximately 30 minutes to complete.

(Optional) Build an optimized Zarr for visualization

RasterFlow writes its outputs as Zarr stores at native resolution. To explore them interactively on cloud.wherobots.com/map, you can build an optimized multiscale Zarr. build_zarr_multiscales adds downsampled overview levels (image pyramids) to the store so the map can stream coarse tiles when zoomed out and full-resolution pixels when zoomed in. This step is optional and can take a few minutes for large outputs, so the code below is commented out by default — uncomment it to run it. Pass aoi to select a chunk-aligned bounding window from a single Zarr source. It accepts polygon or multipolygon WKT in EPSG:4326, or an S3 GeoJSON or GeoParquet URI with a CRS. Pixels outside the polygon remain within that rectangular window. Omit aoi to process the full store.

Visualizing outputs

You can visualize the Zarr, GeoParquet, and other geospatial outputs using cloud.wherobots.com/map.

Vectorize the raster model outputs

The output for the Tile2Net model is a raster with four classes: background, road, sidewalk, crosswalk. We can run a seperate flow to convert the roads, sidewalks and crosswalks into vector geometries, based on the confidence threshold. Converting these results to geometries allows us to more easily post process the results or join the resuilts with other vector data.

Save the vectorized results to the catalog

We can store these vectorized outputs in the catalog by using WherobotsDB to persist the GeoParquet results.

Visualize the vectorized results

To visualize the vectorized results, we will filter out results with a score lower than 0.2. This threshold was determined through observation to strike a balance: it eliminates obvious noise without being overly aggressive, ensuring that we don’t accidentally filter out too many relevant results. Gaps in prediction for Tile2net are likely due to it being used with lower resolution imagery (30cm resolution) than what it was trained on (19cm resolution), as well as changes in geographic context, and occlusion from trees over the pathways.

Generate PM Tiles for visualization

To improve visualization performance of a large number of geometries, we can use Wherobots built-in high performance PM tile generator.

References

  1. Hosseini, M., Sevtsuk, A., Miranda, F., Cesar Jr, R. M., & Silva, C. T. (2023). Mapping the walk: A scalable computer vision approach for generating sidewalk network datasets from aerial imagery. Computers, Environment and Urban Systems, 101, 101950.