Advertisement
lamiastella

res

Oct 6th, 2020 (edited)
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. from __future__ import print_function, division
  2. import os
  3. import torch
  4. import torch.nn as nn
  5. import torchvision
  6. from torch.autograd import Variable
  7. import pandas as pd
  8. from skimage import io, transform
  9. import numpy as np
  10. import matplotlib.pyplot as plt
  11. from torch.utils.data import Dataset, DataLoader
  12. from torchvision import transforms, utils
  13.  
  14.  
  15.  
  16. # Ignore warnings
  17. import warnings
  18. warnings.filterwarnings("ignore")
  19.  
  20. plt.ion() # interactive mode
  21. %matplotlib inline
  22.  
  23. def show_landmarks(image, landmarks):
  24. """Show image with landmarks"""
  25. plt.imshow(image)
  26. plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')
  27. plt.pause(0.001) # pause a bit so that plots are updated
  28.  
  29. print("img_name: ", img_name)
  30. plt.figure()
  31. show_landmarks(io.imread(img_name), landmarks)
  32. plt.show()
  33. ----------------------------------
  34. img_name: faces/person-7.jpg
  35.  
  36. ---------------------------------------------------------------------------
  37. ValueError Traceback (most recent call last)
  38. <ipython-input-39-bd76f4283ec3> in <module>
  39. 7 print("img_name: ", img_name)
  40. 8 plt.figure()
  41. ----> 9 show_landmarks(io.imread(img_name), landmarks)
  42. 10 plt.show()
  43.  
  44. ~/anaconda3/lib/python3.7/site-packages/skimage/io/_io.py in imread(fname, as_gray, plugin, **plugin_args)
  45. 46
  46. 47 with file_or_url_context(fname) as fname:
  47. ---> 48 img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  48. 49
  49. 50 if not hasattr(img, 'ndim'):
  50.  
  51. ~/anaconda3/lib/python3.7/site-packages/skimage/io/manage_plugins.py in call_plugin(kind, *args, **kwargs)
  52. 207 (plugin, kind))
  53. 208
  54. --> 209 return func(*args, **kwargs)
  55. 210
  56. 211
  57.  
  58. ~/anaconda3/lib/python3.7/site-packages/skimage/io/_plugins/imageio_plugin.py in imread(*args, **kwargs)
  59. 8 @wraps(imageio_imread)
  60. 9 def imread(*args, **kwargs):
  61. ---> 10 return np.asarray(imageio_imread(*args, **kwargs))
  62.  
  63. ~/anaconda3/lib/python3.7/site-packages/imageio/core/functions.py in imread(uri, format, **kwargs)
  64. 263
  65. 264 # Get reader and read first
  66. --> 265 reader = read(uri, format, "i", **kwargs)
  67. 266 with reader:
  68. 267 return reader.get_data(0)
  69.  
  70. ~/anaconda3/lib/python3.7/site-packages/imageio/core/functions.py in get_reader(uri, format, mode, **kwargs)
  71. 180 modename = MODENAMES.get(mode, mode)
  72. 181 raise ValueError(
  73. --> 182 "Could not find a format to read the specified file in %s mode" % modename
  74. 183 )
  75. 184
  76.  
  77. ValueError: Could not find a format to read the specified file in single-image mode
  78.  
  79. <Figure size 432x288 with 0 Axes>
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement