Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function, division
- import os
- import torch
- import torch.nn as nn
- import torchvision
- from torch.autograd import Variable
- import pandas as pd
- from skimage import io, transform
- import numpy as np
- import matplotlib.pyplot as plt
- from torch.utils.data import Dataset, DataLoader
- from torchvision import transforms, utils
- # Ignore warnings
- import warnings
- warnings.filterwarnings("ignore")
- plt.ion() # interactive mode
- %matplotlib inline
- def show_landmarks(image, landmarks):
- """Show image with landmarks"""
- plt.imshow(image)
- plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')
- plt.pause(0.001) # pause a bit so that plots are updated
- print("img_name: ", img_name)
- plt.figure()
- show_landmarks(io.imread(img_name), landmarks)
- plt.show()
- ----------------------------------
- img_name: faces/person-7.jpg
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- <ipython-input-39-bd76f4283ec3> in <module>
- 7 print("img_name: ", img_name)
- 8 plt.figure()
- ----> 9 show_landmarks(io.imread(img_name), landmarks)
- 10 plt.show()
- ~/anaconda3/lib/python3.7/site-packages/skimage/io/_io.py in imread(fname, as_gray, plugin, **plugin_args)
- 46
- 47 with file_or_url_context(fname) as fname:
- ---> 48 img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
- 49
- 50 if not hasattr(img, 'ndim'):
- ~/anaconda3/lib/python3.7/site-packages/skimage/io/manage_plugins.py in call_plugin(kind, *args, **kwargs)
- 207 (plugin, kind))
- 208
- --> 209 return func(*args, **kwargs)
- 210
- 211
- ~/anaconda3/lib/python3.7/site-packages/skimage/io/_plugins/imageio_plugin.py in imread(*args, **kwargs)
- 8 @wraps(imageio_imread)
- 9 def imread(*args, **kwargs):
- ---> 10 return np.asarray(imageio_imread(*args, **kwargs))
- ~/anaconda3/lib/python3.7/site-packages/imageio/core/functions.py in imread(uri, format, **kwargs)
- 263
- 264 # Get reader and read first
- --> 265 reader = read(uri, format, "i", **kwargs)
- 266 with reader:
- 267 return reader.get_data(0)
- ~/anaconda3/lib/python3.7/site-packages/imageio/core/functions.py in get_reader(uri, format, mode, **kwargs)
- 180 modename = MODENAMES.get(mode, mode)
- 181 raise ValueError(
- --> 182 "Could not find a format to read the specified file in %s mode" % modename
- 183 )
- 184
- ValueError: Could not find a format to read the specified file in single-image mode
- <Figure size 432x288 with 0 Axes>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement