Land Cover Mapping
Перейти к файлу
aenchakattu 19e79ec96e added CORS changes 2019-02-11 15:05:51 -08:00
css 0. Initial commit 2018-12-14 18:20:24 -08:00
js 0. Initial commit 2018-12-14 18:20:24 -08:00
land-cover-api added CORS changes 2019-02-11 15:05:51 -08:00
.gitignore 0. Added pyc files to gitignore 2019-01-07 10:19:36 -08:00
DataLoader.py 0. Heavily refactored DataLoader.py 2018-12-20 13:32:31 -08:00
GeoTools.py 0. Testing fix for cached data model 2019-01-07 10:31:17 -08:00
README.md 0. Added bug description 2019-01-30 09:12:48 -08:00
ServerModelsCached.py 0. Testing fix for cached data model 2019-01-07 10:31:17 -08:00
ServerModelsICLR.py 0. Update to demo model path 2018-12-16 17:52:36 -08:00
backend_server.py 0. Command line args should make sense 2019-01-31 16:50:10 -08:00
create_spatial_index.py 0. Added script to create the spatial index used in DataLoader 2018-12-20 13:32:06 -08:00
endpoints.js 0. Initial commit 2018-12-14 18:20:24 -08:00
frontend_server.py 0. Initial commit 2018-12-14 18:20:24 -08:00
index.html 0. Adding AI4E branding and other visual changes 2019-01-25 20:37:56 -08:00
utils.py 0. Syntax fix pointed out by Dan 2018-12-24 17:27:08 -08:00

README.md

Land Cover Mapping Tool

This repository hold both the "frontend" web-application and "backend" web API server that make up our "Land Cover Mapping" demo. An instance of this demo is live, here.

Overview

  • "Frontend"
    • index.html, endpoints.js
    • Whenever an user clicks somewhere on the map, the app will query each server defined in endpoints.js and show the results overlayed on the map.
  • "Backend"
    • Consists of backend_server.py, ServerModels*.py, DataLoader.py
    • backend_server.py starts a bottle server to serve the API
      • Can be provided a port via command line argument, must be provided a "model" to serve via command line argument.
      • The "model" that is provided via the command line argument corresponds to one of the ServerModels*.py files. Currently this interface is just an ugly hack.
    • DataLoader.py contains all the code for finding the data assosciated with a given spatial query.

API

The "backend" server provides the following API:

POST /predPatch

Input example:

{
    "extent": { // definition of bounding box to run model on
        "xmax": bottomright.x,
        "xmin": topleft.x,
        "ymax": topleft.y,
        "ymin": bottomright.y,
        "spatialReference": {
            "latestWkid": 3857 // CRS of the coordinates
        }
    },
    "weights": [0.25, 0.25, 0.25, 0.25], // reweighting of the softmax outputs, there should be one number (per class)
}

Output example:

{
    "extent": ..., // copied from input
    "weights": ..., // copied from input
    "model_name": "Full-US-prerun", // name of the model being served
    "input_naip": "..." // base64 encoding of input NAIP imagery used to generate the model output, as PNG
    "output_hard": "..." // base64 encoding of hard class estimates, also as PNG
    "output_soft": "..." // base64 encoding of soft class estimates, see `utils.class_prediction_to_img()` for how image is generated

}

POST /getInput

Input example:

{
    "extent": { // definition of bounding box to run model on
        "xmax": bottomright.x,
        "xmin": topleft.x,
        "ymax": topleft.y,
        "ymin": bottomright.y,
        "spatialReference": {
            "latestWkid": 3857 // CRS of the coordinates
        }
    },
}

Output example:

{
    "extent": ..., // copied from input
    "input_naip": "..." // base64 encoding of input NAIP imagery used to generate the model output, as PNG
}

Setup

Copy the files from //mslandcoverstorageeast.file.core.windows.net/chesapeake/demo_data/ into data/. This should include: list_all_naip.txt, tile_index.dat, tile_index.idx, tiles.p.

Issues/To-do list

  • /predPatch will probably not work with other CRSs (besides EPSG:3857)
  • /predPatch will probably not fail in an useful way
  • We want the backend_server.py to be decoupled from the implementation of the code needed to run the model. The way this currently works (in main() of backend_server.py) is really hacky.
  • If you switch the "Sharpness" slider immediately after clicking on the map (before results are returned) then an error happens.