Skip to content

Commit

Permalink
Add support for testing capsules that don't specify detection names
Browse files Browse the repository at this point in the history
  • Loading branch information
apockill committed Mar 18, 2021
1 parent 526aa90 commit cbd8bd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vcap/vcap/testing/input_output_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def make_detection_node(frame_shape,
node_description.attributes.items()}
extra_data = {data_key: 0.5129319283
for data_key in node_description.extra_data}
detection_names = node_description.detections

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

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

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


# If this capsule can encode things, verify that the backend
# correctly implemented the "distance" function
if (capsule.capability.encoded
Expand Down

0 comments on commit cbd8bd9

Please sign in to comment.