Skip to content

Instantly share code, notes, and snippets.

@alankbi
Last active February 14, 2020 16:51
Show Gist options
  • Save alankbi/0ff3b1a1aef061ff625ebf2710c1cfce to your computer and use it in GitHub Desktop.
Save alankbi/0ff3b1a1aef061ff625ebf2710c1cfce to your computer and use it in GitHub Desktop.
Read in and predict on an image with Detecto
# Specify the path to your image
image = utils.read_image('images/image0.jpg')
predictions = model.predict(image)
# predictions format: (labels, boxes, scores)
labels, boxes, scores = predictions
# ['alien', 'bat', 'bat']
print(labels)
# xmin ymin xmax ymax
# tensor([[ 569.2125, 203.6702, 1003.4383, 658.1044],
# [ 276.2478, 144.0074, 579.6044, 508.7444],
# [ 277.2929, 162.6719, 627.9399, 511.9841]])
print(boxes)
# tensor([0.9952, 0.9837, 0.5153])
print(scores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment