|
9 | 9 | TEST_MODEL_NAME = "[PyTest] Test Model"
|
10 | 10 | TEST_MODEL_RUN = "[PyTest] Test Model Run"
|
11 | 11 | TEST_DATASET_NAME = "[PyTest] Test Dataset"
|
| 12 | +TEST_DATASET_3D_NAME = "[PyTest] Test Dataset 3D" |
12 | 13 | TEST_SLICE_NAME = "[PyTest] Test Slice"
|
13 | 14 | TEST_PROJECT_ID = "60b699d70f139e002dd31bfc"
|
14 | 15 |
|
|
21 | 22 | "https://homepages.cae.wisc.edu/~ece533/images/cat.png",
|
22 | 23 | ]
|
23 | 24 |
|
| 25 | +TEST_POINTCLOUD_URLS = [ |
| 26 | + "https://scale-us-attachments.s3.us-west-2.amazonaws.com/select/examples/kitti_example_frame.json", |
| 27 | +] |
| 28 | + |
24 | 29 | TEST_DATASET_ITEMS = [
|
25 | 30 | DatasetItem(TEST_IMG_URLS[0], "1"),
|
26 | 31 | DatasetItem(TEST_IMG_URLS[1], "2"),
|
@@ -72,6 +77,28 @@ def reference_id_from_url(url):
|
72 | 77 | for i in range(len(TEST_IMG_URLS))
|
73 | 78 | ]
|
74 | 79 |
|
| 80 | +TEST_CUBOID_ANNOTATIONS = [ |
| 81 | + { |
| 82 | + "label": f"[Pytest] Cuboid Annotation ${i}", |
| 83 | + "geometry": { |
| 84 | + "position": { |
| 85 | + "x": 50 * i + 10, |
| 86 | + "y": 60 * i + 10, |
| 87 | + "z": 70 * i + 10, |
| 88 | + }, |
| 89 | + "dimensions": { |
| 90 | + "x": 10 * i, |
| 91 | + "y": 20 * i, |
| 92 | + "z": 30 * i, |
| 93 | + }, |
| 94 | + "yaw": 5 * i, |
| 95 | + }, |
| 96 | + "reference_id": reference_id_from_url(TEST_POINTCLOUD_URLS[i]), |
| 97 | + "annotation_id": f"[Pytest] Cuboid Annotation Annotation Id{i}", |
| 98 | + } |
| 99 | + for i in range(len(TEST_POINTCLOUD_URLS)) |
| 100 | +] |
| 101 | + |
75 | 102 |
|
76 | 103 | TEST_MASK_URL = "https://raw.githubusercontent.com/scaleapi/nucleus-python-client/master/tests/testdata/000000000285.png"
|
77 | 104 |
|
@@ -157,6 +184,29 @@ def assert_polygon_annotation_matches_dict(
|
157 | 184 | assert instance_pt.y == dict_pt["y"]
|
158 | 185 |
|
159 | 186 |
|
| 187 | +def assert_cuboid_annotation_matches_dict( |
| 188 | + annotation_instance, annotation_dict |
| 189 | +): |
| 190 | + assert annotation_instance.label == annotation_dict["label"] |
| 191 | + assert ( |
| 192 | + annotation_instance.annotation_id == annotation_dict["annotation_id"] |
| 193 | + ) |
| 194 | + for instance_pt, dict_pt in zip( |
| 195 | + annotation_instance.position, annotation_dict["geometry"]["position"] |
| 196 | + ): |
| 197 | + assert instance_pt.x == dict_pt["x"] |
| 198 | + assert instance_pt.y == dict_pt["y"] |
| 199 | + assert instance_pt.z == dict_pt["z"] |
| 200 | + for instance_pt, dict_pt in zip( |
| 201 | + annotation_instance.dimensions, |
| 202 | + annotation_dict["geometry"]["dimensions"], |
| 203 | + ): |
| 204 | + assert instance_pt.x == dict_pt["x"] |
| 205 | + assert instance_pt.y == dict_pt["y"] |
| 206 | + assert instance_pt.z == dict_pt["z"] |
| 207 | + assert annotation_instance.yaw == annotation_dict["geometry"]["yaw"] |
| 208 | + |
| 209 | + |
160 | 210 | def assert_segmentation_annotation_matches_dict(
|
161 | 211 | annotation_instance, annotation_dict
|
162 | 212 | ):
|
|
0 commit comments