little fixes for vre/vre_collage
Browse files
scripts/semantic_mapper/semantic_mapper.py
CHANGED
@@ -305,8 +305,12 @@ class SafeLandingAreas(BinaryMapper):
|
|
305 |
where_safe = sema_safe * where_safe
|
306 |
return self.disk_to_memory_fmt(where_safe)
|
307 |
|
308 |
-
def get_new_semantic_mapped_tasks(tasks_subset: list[str] | None = None
|
309 |
-
|
|
|
|
|
|
|
|
|
310 |
buildings_mapping = [
|
311 |
{
|
312 |
"others": [x for x in mapillary_classes if x not in
|
@@ -419,8 +423,6 @@ def get_new_semantic_mapped_tasks(tasks_subset: list[str] | None = None) -> dict
|
|
419 |
"semantic_mask2former_r50_mapillary_converted", [m2f_r50_mapillary]),
|
420 |
m2f_swin_coco_converted := SemanticMask2FormerCOCOConverted(
|
421 |
"semantic_mask2former_swin_coco_converted", [m2f_coco]),
|
422 |
-
SemanticMedian("semantic_output", [m2f_swin_mapillary_converted, m2f_r50_mapillary_converted,
|
423 |
-
m2f_swin_coco_converted]),
|
424 |
buildings := BinaryMapper("buildings", [m2f_mapillary, m2f_coco, m2f_r50_mapillary],
|
425 |
buildings_mapping, mode="majority"),
|
426 |
BinaryMapper("sky-and-water", [m2f_mapillary, m2f_coco, m2f_r50_mapillary],
|
@@ -435,6 +437,12 @@ def get_new_semantic_mapped_tasks(tasks_subset: list[str] | None = None) -> dict
|
|
435 |
original_classes=[mapillary_classes, coco_classes, mapillary_classes],
|
436 |
semantics=[m2f_mapillary, m2f_coco, m2f_r50_mapillary]),
|
437 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
if tasks_subset is None:
|
439 |
return {t.name: t for t in available_tasks}
|
440 |
return {t.name: t for t in available_tasks if t.name in tasks_subset}
|
@@ -456,7 +464,7 @@ if __name__ == "__main__":
|
|
456 |
cache_task_stats=True, batch_size_stats=100)
|
457 |
orig_task_names = list(reader.task_types.keys())
|
458 |
|
459 |
-
new_tasks = get_new_semantic_mapped_tasks()
|
460 |
for task_name in reader.task_names:
|
461 |
if task_name not in orig_task_names:
|
462 |
reader.remove_task(task_name)
|
|
|
305 |
where_safe = sema_safe * where_safe
|
306 |
return self.disk_to_memory_fmt(where_safe)
|
307 |
|
308 |
+
def get_new_semantic_mapped_tasks(tasks_subset: list[str] | None = None,
|
309 |
+
include_semantic_output: bool = False) -> dict[str, TaskMapper]:
|
310 |
+
"""
|
311 |
+
The exported function for VRE! Note, semantic_output is also in dronescapes_representations so it can fail
|
312 |
+
if used with vre or vre_collage --external_representations. So we default it to false.
|
313 |
+
"""
|
314 |
buildings_mapping = [
|
315 |
{
|
316 |
"others": [x for x in mapillary_classes if x not in
|
|
|
423 |
"semantic_mask2former_r50_mapillary_converted", [m2f_r50_mapillary]),
|
424 |
m2f_swin_coco_converted := SemanticMask2FormerCOCOConverted(
|
425 |
"semantic_mask2former_swin_coco_converted", [m2f_coco]),
|
|
|
|
|
426 |
buildings := BinaryMapper("buildings", [m2f_mapillary, m2f_coco, m2f_r50_mapillary],
|
427 |
buildings_mapping, mode="majority"),
|
428 |
BinaryMapper("sky-and-water", [m2f_mapillary, m2f_coco, m2f_r50_mapillary],
|
|
|
437 |
original_classes=[mapillary_classes, coco_classes, mapillary_classes],
|
438 |
semantics=[m2f_mapillary, m2f_coco, m2f_r50_mapillary]),
|
439 |
]
|
440 |
+
if include_semantic_output:
|
441 |
+
available_tasks.append(
|
442 |
+
SemanticMedian("semantic_output", [m2f_swin_mapillary_converted, m2f_r50_mapillary_converted,
|
443 |
+
m2f_swin_coco_converted]),
|
444 |
+
)
|
445 |
+
|
446 |
if tasks_subset is None:
|
447 |
return {t.name: t for t in available_tasks}
|
448 |
return {t.name: t for t in available_tasks if t.name in tasks_subset}
|
|
|
464 |
cache_task_stats=True, batch_size_stats=100)
|
465 |
orig_task_names = list(reader.task_types.keys())
|
466 |
|
467 |
+
new_tasks = get_new_semantic_mapped_tasks(include_semantic_output=True)
|
468 |
for task_name in reader.task_names:
|
469 |
if task_name not in orig_task_names:
|
470 |
reader.remove_task(task_name)
|
vre_dronescapes/cfg.yaml
CHANGED
@@ -2,13 +2,13 @@ default_io_parameters:
|
|
2 |
binary_format: npz
|
3 |
image_format: not-set
|
4 |
compress: True
|
5 |
-
|
|
|
6 |
default_learned_parameters:
|
7 |
device: ${oc.env:VRE_DEVICE,cpu}
|
8 |
|
9 |
default_compute_parameters:
|
10 |
batch_size: 15
|
11 |
-
output_size: [540, 960]
|
12 |
|
13 |
representations:
|
14 |
rgb:
|
@@ -71,5 +71,5 @@ representations:
|
|
71 |
sensor_width: 3840
|
72 |
sensor_height: 2160
|
73 |
window_size: 11
|
74 |
-
|
75 |
output_dtype: float16
|
|
|
2 |
binary_format: npz
|
3 |
image_format: not-set
|
4 |
compress: True
|
5 |
+
output_size: [540, 960]
|
6 |
+
|
7 |
default_learned_parameters:
|
8 |
device: ${oc.env:VRE_DEVICE,cpu}
|
9 |
|
10 |
default_compute_parameters:
|
11 |
batch_size: 15
|
|
|
12 |
|
13 |
representations:
|
14 |
rgb:
|
|
|
71 |
sensor_width: 3840
|
72 |
sensor_height: 2160
|
73 |
window_size: 11
|
74 |
+
io_parameters:
|
75 |
output_dtype: float16
|