Skip to content

Instantly share code, notes, and snippets.

@emadehsan
Created January 29, 2020 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emadehsan/a93419de91d3bf65296ca2ba84c81f5e to your computer and use it in GitHub Desktop.
Save emadehsan/a93419de91d3bf65296ca2ba84c81f5e to your computer and use it in GitHub Desktop.
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
# Run detection
results = model.detect([image], verbose=1)
# Visualize results
r = results[0]
visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'],
class_names, r['scores'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment