Skip to content

Instantly share code, notes, and snippets.

@innat
Created June 19, 2021 13:54
Show Gist options
  • Save innat/00de7561033ba373745d425c6da7bf8c to your computer and use it in GitHub Desktop.
Save innat/00de7561033ba373745d425c6da7bf8c to your computer and use it in GitHub Desktop.
def vis(path1, path2, n_images, is_random=True, figsize=(16, 16)):
'''
https://github.com/innat
'''
plt.figure(figsize=figsize)
image_names = os.listdir(path1)
masks_names = os.listdir(path2)
for i in range(n_images):
if is_random:
image_name = random.choice(masks_names)
masks_name = image_name
else:
image_name = masks_names[i]
masks_name = masks_names[i]
img = cv2.imread(os.path.join(path1, image_name))
msk = cv2.imread(os.path.join(path2, masks_name))
plt.subplot(121); plt.imshow(img);
plt.subplot(122); plt.imshow(msk);
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment