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

Vectorification fails during eval #658

Closed
lewfish opened this issue Jan 16, 2019 · 0 comments
Closed

Vectorification fails during eval #658

lewfish opened this issue Jan 16, 2019 · 0 comments
Assignees
Labels

Comments

@lewfish
Copy link
Contributor

lewfish commented Jan 16, 2019

I ran the Vegas example in test mode and it crashed. This was when running with the following diff

diff --git a/spacenet/vegas.py b/spacenet/vegas.py
index b6c8aa5..30dfec6 100644
--- a/spacenet/vegas.py
+++ b/spacenet/vegas.py
@@ -125,6 +125,11 @@ def build_scene(task, spacenet_config, id, channel_order=None, vector_tile_optio
         label_source = rv.LabelSourceConfig.builder(rv.SEMANTIC_SEGMENTATION) \
             .with_raster_source(label_raster_source) \
             .build()
+
+        label_store = rv.LabelStoreConfig.builder(rv.SEMANTIC_SEGMENTATION_RASTER) \
+            .with_vector_output([{'mode': 'polygons', 'class_id': 1}]) \
+            .build()
+
     elif task.task_type == rv.CHIP_CLASSIFICATION:
         label_source = rv.LabelSourceConfig.builder(rv.CHIP_CLASSIFICATION) \
                                            .with_vector_source(vector_source) \
@@ -144,6 +149,7 @@ def build_scene(task, spacenet_config, id, channel_order=None, vector_tile_optio
                           .with_id(id) \
                           .with_raster_source(raster_source) \
                           .with_label_source(label_source) \
+                          .with_label_store(label_store) \
                           .build()

     return scene
root@65ee5b0edbad:/opt/src# rastervision run local -e spacenet.vegas     -a test True     -a use_remote_data False     -a root_uri ${ROOT_URI}     -a target buildings     -a task_type semantic_segmentation
None
Ensuring input files exist    [####################################]  100%
Checking for existing output  [####################################]  100%
Saving command configuration to /opt/data/spacenet/vegas/eval/buildings_semantic_segmentation/command-config.json...
Running evaluator: SemanticSegmentationEvaluator...
2019-01-16 19:21:25:rastervision.evaluation.semantic_segmentation_evaluator: INFO - Computing evaluation for scene 1332...
2019-01-16 19:21:25:rastervision.evaluation.semantic_segmentation_evaluator: INFO - Computing evaluation for scene 2530...
TopologyException: Input geom 1 is invalid: Ring Self-intersection at or near point -115.2387621 36.218666699899998 at -115.2387621 36.218666699899998
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 "/opt/src/rastervision/__main__.py", line 17, in <module>
    rv.main()
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/src/rastervision/cli/main.py", line 253, in run_command
    rv.runner.CommandRunner.run(command_config_uri)
  File "/opt/src/rastervision/runner/command_runner.py", line 11, in run
    CommandRunner.run_from_proto(msg)
  File "/opt/src/rastervision/runner/command_runner.py", line 17, in run_from_proto
    command.run()
  File "/opt/src/rastervision/command/eval_command.py", line 24, in run
    evaluator.process(scenes, tmp_dir)
  File "/opt/src/rastervision/evaluation/semantic_segmentation_evaluator.py", line 54, in process
    gt_geojson, pred_geojson_local, mode, class_id)
  File "/opt/src/rastervision/evaluation/semantic_segmentation_evaluation.py", line 130, in compute_vector
    results = score.spacenet(predictions, ground_truth)
  File "/usr/local/lib/python3.5/dist-packages/mask_to_polygons/processing/score.py", line 47, in spacenet
    scores = list(map(lambda a: iou(a, pred), results))
  File "/usr/local/lib/python3.5/dist-packages/mask_to_polygons/processing/score.py", line 47, in <lambda>
    scores = list(map(lambda a: iou(a, pred), results))
  File "/usr/local/lib/python3.5/dist-packages/mask_to_polygons/processing/score.py", line 35, in iou
    a_and_b = a.intersection(b).area
  File "/usr/local/lib/python3.5/dist-packages/shapely/geometry/base.py", line 620, in intersection
    return geom_factory(self.impl['intersection'](self, other))
  File "/usr/local/lib/python3.5/dist-packages/shapely/topology.py", line 70, in __call__
    self._check_topology(err, this, other)
  File "/usr/local/lib/python3.5/dist-packages/shapely/topology.py", line 38, in _check_topology
    self.fn.__name__, repr(geom)))
shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f21f68fcfd0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants