updates to these
Browse files
scripts/dronescapes_viewer/dronescapes_representations.py
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
import sys
|
2 |
from pathlib import Path
|
3 |
-
from vre.representations.cv_representations import (
|
4 |
-
|
5 |
-
|
6 |
from vre.representations import Representation
|
7 |
-
sys.path.append(str(Path(__file__).parents[1] / "semantic_mapper"))
|
8 |
-
from semantic_mapper import (
|
9 |
-
get_new_semantic_mapped_tasks, m2f_mapillary, m2f_coco, m2f_r50_mapillary,
|
10 |
-
BinaryMapper, mapillary_classes, coco_classes)
|
11 |
|
12 |
def get_gt_tasks() -> dict[str, Representation]:
|
13 |
color_map = [[0, 255, 0], [0, 127, 0], [255, 255, 0], [255, 255, 255],
|
14 |
[255, 0, 0], [0, 0, 255], [0, 255, 255], [127, 127, 63]]
|
15 |
classes_8 = ["land", "forest", "residential", "road", "little-objects", "water", "sky", "hill"]
|
16 |
tasks = [
|
17 |
-
SemanticRepresentation("
|
18 |
-
DepthRepresentation("
|
19 |
-
NormalsRepresentation("
|
20 |
]
|
21 |
return {t.name: t for t in tasks}
|
22 |
|
23 |
def get_other_tasks(include_semantics_original: bool, include_ci: bool) -> dict[str, Representation]:
|
|
|
|
|
|
|
|
|
24 |
tasks = [
|
25 |
rgb := ColorRepresentation("rgb"),
|
26 |
OpticalFlowRepresentation("opticalflow_rife"),
|
@@ -61,6 +61,8 @@ def get_other_tasks(include_semantics_original: bool, include_ci: bool) -> dict[
|
|
61 |
|
62 |
def get_dronescapes_task_types(include_semantics_original: bool, include_gt: bool,
|
63 |
include_ci: bool) -> dict[str, Representation]:
|
|
|
|
|
64 |
res = {
|
65 |
**get_new_semantic_mapped_tasks(),
|
66 |
**get_other_tasks(include_semantics_original, include_ci),
|
|
|
1 |
import sys
|
2 |
from pathlib import Path
|
3 |
+
from vre.representations.cv_representations import (DepthRepresentation, NormalsRepresentation, ColorRepresentation,
|
4 |
+
HSVRepresentation, EdgesRepresentation, OpticalFlowRepresentation)
|
5 |
+
from vre.representations.semantic_segmentation import SemanticRepresentation
|
6 |
from vre.representations import Representation
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def get_gt_tasks() -> dict[str, Representation]:
|
9 |
color_map = [[0, 255, 0], [0, 127, 0], [255, 255, 0], [255, 255, 255],
|
10 |
[255, 0, 0], [0, 0, 255], [0, 255, 255], [127, 127, 63]]
|
11 |
classes_8 = ["land", "forest", "residential", "road", "little-objects", "water", "sky", "hill"]
|
12 |
tasks = [
|
13 |
+
SemanticRepresentation("semantic_output", classes=classes_8, color_map=color_map),
|
14 |
+
DepthRepresentation("depth_output", min_depth=0, max_depth=300),
|
15 |
+
NormalsRepresentation("camera_normals_output"),
|
16 |
]
|
17 |
return {t.name: t for t in tasks}
|
18 |
|
19 |
def get_other_tasks(include_semantics_original: bool, include_ci: bool) -> dict[str, Representation]:
|
20 |
+
sys.path.append(str(Path(__file__).parents[1] / "semantic_mapper"))
|
21 |
+
from semantic_mapper import (
|
22 |
+
m2f_mapillary, m2f_coco, m2f_r50_mapillary,
|
23 |
+
BinaryMapper, mapillary_classes, coco_classes)
|
24 |
tasks = [
|
25 |
rgb := ColorRepresentation("rgb"),
|
26 |
OpticalFlowRepresentation("opticalflow_rife"),
|
|
|
61 |
|
62 |
def get_dronescapes_task_types(include_semantics_original: bool, include_gt: bool,
|
63 |
include_ci: bool) -> dict[str, Representation]:
|
64 |
+
sys.path.append(str(Path(__file__).parents[1] / "semantic_mapper"))
|
65 |
+
from semantic_mapper import get_new_semantic_mapped_tasks
|
66 |
res = {
|
67 |
**get_new_semantic_mapped_tasks(),
|
68 |
**get_other_tasks(include_semantics_original, include_ci),
|
scripts/semantic_mapper/semantic_mapper.py
CHANGED
@@ -300,7 +300,8 @@ class SemanticMedian(TaskMapper, NpIORepresentation):
|
|
300 |
|
301 |
@overrides
|
302 |
def make_images(self, data: ReprOut) -> np.ndarray:
|
303 |
-
|
|
|
304 |
|
305 |
class SafeLandingAreas(BinaryMapper, NpIORepresentation):
|
306 |
def __init__(self, name: str, depth: DepthRepresentation, camera_normals: NormalsRepresentation,
|
|
|
300 |
|
301 |
@overrides
|
302 |
def make_images(self, data: ReprOut) -> np.ndarray:
|
303 |
+
data_output = data.output.argmax(-1) if np.issubdtype(data.output.dtype, np.floating) else data.output
|
304 |
+
return colorize_semantic_segmentation(data_output, self.classes, self.color_map)
|
305 |
|
306 |
class SafeLandingAreas(BinaryMapper, NpIORepresentation):
|
307 |
def __init__(self, name: str, depth: DepthRepresentation, camera_normals: NormalsRepresentation,
|
vre_dronescapes/.gitignore
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
*.npz
|
2 |
.logs/
|
3 |
.collage/
|
|
|
4 |
|
|
|
1 |
*.npz
|
2 |
.logs/
|
3 |
.collage/
|
4 |
+
collages/
|
5 |
|