@@ -96,10 +96,12 @@ class DatasetItem: # pylint: disable=R0902
96
96
pointcloud_location : Optional [str ] = None
97
97
98
98
def __post_init__ (self ):
99
- self .local = is_local_path (self .image_location )
100
99
assert bool (self .image_location ) != bool (
101
100
self .pointcloud_location
102
101
), "Must specify exactly one of the image_location, pointcloud_location parameters"
102
+ self .local = (
103
+ is_local_path (self .image_location ) if self .image_location else None
104
+ )
103
105
self .type = (
104
106
DatasetItemType .IMAGE
105
107
if self .image_location
@@ -143,26 +145,25 @@ def to_payload(self, is_scene=False) -> dict:
143
145
payload : Dict [str , Any ] = {
144
146
METADATA_KEY : self .metadata or {},
145
147
}
148
+ if self .reference_id :
149
+ payload [REFERENCE_ID_KEY ] = self .reference_id
150
+ if self .item_id :
151
+ payload [DATASET_ITEM_ID_KEY ] = self .item_id
146
152
147
153
if is_scene :
148
154
if self .image_location :
149
155
payload [URL_KEY ] = self .image_location
150
156
elif self .pointcloud_location :
151
157
payload [URL_KEY ] = self .pointcloud_location
152
158
payload [TYPE_KEY ] = self .type .value
159
+ if self .camera_params :
160
+ payload [CAMERA_PARAMS_KEY ] = self .camera_params .to_payload ()
153
161
else :
154
162
assert (
155
163
self .image_location
156
- ), "Must specify image_location for DatasetItems not in a Scene "
164
+ ), "Must specify image_location for DatasetItems not in a LidarScene "
157
165
payload [IMAGE_URL_KEY ] = self .image_location
158
166
159
- if self .reference_id :
160
- payload [REFERENCE_ID_KEY ] = self .reference_id
161
- if self .item_id :
162
- payload [DATASET_ITEM_ID_KEY ] = self .item_id
163
- if self .camera_params :
164
- payload [CAMERA_PARAMS_KEY ] = self .camera_params .to_payload ()
165
-
166
167
return payload
167
168
168
169
def to_json (self ) -> str :
0 commit comments