Skip to content

Commit a4f783b

Browse files
Drew KaulDrew Kaul
authored andcommitted
fix check_all_scene_paths_remote and make test scene more complex
1 parent 019fcfe commit a4f783b

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

nucleus/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
HEIGHT_KEY = "height"
4242
IGNORED_ITEMS = "ignored_items"
4343
IMAGE_KEY = "image"
44+
IMAGE_LOCATION_KEY = "image_location"
4445
IMAGE_URL_KEY = "image_url"
4546
INDEX_KEY = "index"
4647
ITEMS_KEY = "items"

nucleus/scene.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
METADATA_KEY,
88
REFERENCE_ID_KEY,
99
POINTCLOUD_LOCATION_KEY,
10+
IMAGE_LOCATION_KEY,
1011
)
1112
from .annotation import is_local_path
1213
from .dataset_item import DatasetItemType, DatasetItem
@@ -174,8 +175,15 @@ def check_all_scene_paths_remote(scenes: List[LidarScene]):
174175
for scene in scenes:
175176
for frame in scene.frames_dict.values():
176177
for item in frame.items.values():
177-
if is_local_path(getattr(item, POINTCLOUD_LOCATION_KEY)):
178+
pointcloud_location = getattr(item, POINTCLOUD_LOCATION_KEY)
179+
if pointcloud_location and is_local_path(pointcloud_location):
178180
raise ValueError(
179-
f"All paths for DatasetItems in a Scene must be remote, but {item.url} is either "
181+
f"All paths for DatasetItems in a Scene must be remote, but {item.pointcloud_location} is either "
182+
"local, or a remote URL type that is not supported."
183+
)
184+
image_location = getattr(item, IMAGE_LOCATION_KEY)
185+
if image_location and is_local_path(image_location):
186+
raise ValueError(
187+
f"All paths for DatasetItems in a Scene must be remote, but {item.image_location} is either "
180188
"local, or a remote URL type that is not supported."
181189
)

tests/helpers.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@
3737
"reference_id": "lidar_frame_1",
3838
"metadata": {},
3939
},
40+
"camera": {
41+
"image_url": TEST_IMG_URLS[0],
42+
"reference_id": "camera_frame_1",
43+
"metadata": {
44+
"camera_params": {
45+
"position": {"x": 0, "y": 0, "z": 0},
46+
"heading": {
47+
"w": 0.6,
48+
"x": -0.6,
49+
"y": 0.3,
50+
"z": -0.3,
51+
},
52+
"fx": 1000,
53+
"fy": 1000,
54+
"cx": 1000,
55+
"cy": 500,
56+
}
57+
},
58+
},
4059
}
4160
],
4261
"metadata": {},

0 commit comments

Comments
 (0)