Skip to content

Commit cbd8bd9

Browse files
committed
Add support for testing capsules that don't specify detection names
1 parent 526aa90 commit cbd8bd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vcap/vcap/testing/input_output_validation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def make_detection_node(frame_shape,
4545
node_description.attributes.items()}
4646
extra_data = {data_key: 0.5129319283
4747
for data_key in node_description.extra_data}
48+
detection_names = node_description.detections
4849

4950
# Create random coordinates for this detection
5051
x1 = random.randint(0, width - 3)
@@ -53,7 +54,7 @@ def make_detection_node(frame_shape,
5354
y2 = y1 + random.randint(0, height - y1 + 1) + 2
5455

5556
return DetectionNode(
56-
name=random.choice(node_description.detections),
57+
name=random.choice(detection_names) if len(detection_names) else "N/A",
5758
coords=[[x1, y1], [x2, y1], [x2, y2], [x1, y2]],
5859
attributes=attributes,
5960
encoding=np.zeros((128,)) if node_description.encoded else None,
@@ -164,7 +165,6 @@ def _run_inference_on_images(images: List[np.ndarray], capsule: BaseCapsule):
164165

165166
json.loads(json.dumps(output_node.extra_data))
166167

167-
168168
# If this capsule can encode things, verify that the backend
169169
# correctly implemented the "distance" function
170170
if (capsule.capability.encoded

0 commit comments

Comments
 (0)