Skip to content

Instantly share code, notes, and snippets.

@SeaOfOcean
Last active September 28, 2017 02:14
Show Gist options
  • Save SeaOfOcean/19bcd9813a836e3c1663931276554a80 to your computer and use it in GitHub Desktop.
Save SeaOfOcean/19bcd9813a836e3c1663931276554a80 to your computer and use it in GitHub Desktop.
# preprocess data
(data, sizes) = preprocess(img_rdd, means, scale, resolution)
# image prediction
output = model.predict(data)
# scale normalized results according to original image sizes
result = output.zip(sizes).map(lambda (output_i, img_size):
scaleOutput(output_i, img_size)
).collect()
# visualize detections
for img_id in range(len(result)):
detections = result[img_id]
visualize(images[img_id], detections)
plt.subplots(figsize=(6, 6))
plt.imshow(cv2.cvtColor(images[img_id], cv2.COLOR_BGR2RGB))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment