Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building type for ./rs features #130

Closed
wboykinm opened this issue Oct 10, 2018 · 9 comments
Closed

Allow building type for ./rs features #130

wboykinm opened this issue Oct 10, 2018 · 9 comments

Comments

@wboykinm
Copy link

Currently the only supported option is parking, which is incompatible with inputs trained on buildings.

root@3d58a7d0d5c3:/app# ./rs features --type building --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
usage: ./rs features [-h] --type {parking} --dataset DATASET masks out
./rs features: error: argument --type: invalid choice: 'building' (choose from 'parking')

root@3d58a7d0d5c3:/app# ./rs features --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
usage: ./rs features [-h] --type {parking} --dataset DATASET masks out
./rs features: error: the following arguments are required: --type
root@3d58a7d0d5c3:/app# ./rs features --type parking --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/app/robosat/tools/__main__.py", line 60, in <module>
    args.func(args)
  File "/app/robosat/tools/features.py", line 38, in main
    assert set(labels).issuperset(set(handlers.keys())), "handlers have a class label"
AssertionError: handlers have a class label

Am I correct that this will require another well-thought-out postprocessing handler?

@daniel-j-h
Copy link
Collaborator

The parking handler right now really works for any polygons. What we need to do is

  • create a generic polygon handler
  • make the handlers work across zoom levels
  • building and parking lot handler can use its functionality

A generic polygon post-processing handler works as long as we don't want to do e.g. special case post-processing for buildings. Also for the zoom level generalization check #51 and #88.

What you can do for now is

  • check the parking lot thresholds and adapt them to your zoom level; see
    kernel_size_denoise = 20
    kernel_size_grow = 20
    simplify_threshold = 0.01
  • remove the filter for z18 (for which the thresholds were tuned) here
    if tile.z != 18:
    raise NotImplementedError("Parking lot post-processing thresholds are tuned for z18")
  • run with --type parking

Or better give #88 a try and see if it works for you.

@wboykinm
Copy link
Author

@daniel-j-h I ran it as faux-parking per your suggestion above (I did not run the linked branch), and it threw this:

root@3d58a7d0d5c3:/app# ./rs features --type parking --dataset config/dataset-parking-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/app/robosat/tools/__main__.py", line 60, in <module>
    args.func(args)
  File "/app/robosat/tools/features.py", line 41, in main
    handler = handlers[args.type]()
  File "/app/robosat/features/parking.py", line 26, in __init__
    denoised = denoise(mask, self.kernel_size_denoise)
NameError: name 'mask' is not defined

Indeed, I don't see that param being handed in.

@daniel-j-h
Copy link
Collaborator

The mask is passed in here

def apply(self, tile, mask):

from the callsite here

handler.apply(tile, mask)

Are you sure you didn't accidentally delete it or change something when removing the tile check?

@wboykinm
Copy link
Author

I may well have. Also using a several-days-old, cpu-specific image at this point. Lemme update and try again.

@wboykinm
Copy link
Author

@daniel-j-h Pulling the updates did the trick! Thanks!

I'd definitely love to see the generic polygon handler though; I'll be trying any number of feature types that are neither parking nor buildings.

@wucangeo
Copy link

wucangeo commented Aug 17, 2019

Wish we can set type ,instead of updating code. Could you update features command please?

@daniel-j-h
Copy link
Collaborator

@wucangeo see the branch in

#88

then it should be easy to re-use the existing handler.

@Grifel79
Copy link

@daniel-j-h How rs features should work with roads detection? I am blocked on the pipeline here. Could you advice please?

@daniel-j-h
Copy link
Collaborator

daniel-j-h commented May 13, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants