RaphaelMeudec / deblur-gan

Keras implementation of "DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks"
590 stars 245 forks source link

deblur_image.py - PermissionError: [Errno 13] Permission denied: #12

Open Jasas9754 opened 6 years ago

Jasas9754 commented 6 years ago
(Deblur) S:\deblur-gan>python deblur_image.py --image_path=S:\deblur-gan\images\test\a
C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "deblur_image.py", line 36, in <module>
    deblur_command()
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "deblur_image.py", line 32, in deblur_command
    return deblur(image_path)
  File "deblur_image.py", line 12, in deblur
    'A': np.array([preprocess_image(load_image(image_path))])
  File "S:\deblur-gan\utils.py", line 22, in load_image
    img = Image.open(path)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\PIL\Image.py", line 2543, in open
    fp = builtins.open(filename, "rb")
PermissionError: [Errno 13] Permission denied: 'S:\\deblur-gan\\images\\test\\a'

I don't know what the problem is

RaphaelMeudec commented 6 years ago

Hi! I think the deblur_image script takes a specific image as argument, not a path to a directory of images. Try with path : 'S:\\deblur-gan\\images\\test\\a\\my_test_image.png'

Jasas9754 commented 6 years ago

@RaphaelMeudec Of course I tried it. And this error came out. Just in case, it's win10 anaconda.

(Deblur) S:\deblur-gan>python deblur_image.py --image_path=S:\deblur-gan\images\test\a\my_test_image.png
C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
2018-05-28 22:47:22.886472: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-05-28 22:47:23.058749: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties:
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7715
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 4.97GiB
2018-05-28 22:47:23.065631: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0
2018-05-28 22:47:23.582391: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-05-28 22:47:23.585998: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929]      0
2018-05-28 22:47:23.588923: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0:   N
2018-05-28 22:47:23.591965: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4740 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "deblur_image.py", line 36, in <module>
    deblur_command()
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "deblur_image.py", line 32, in deblur_command
    return deblur(image_path)
  File "deblur_image.py", line 26, in deblur
    im.save('deblur'+image_path)
  File "C:\Users\motor\Anaconda3\envs\Deblur\lib\site-packages\PIL\Image.py", line 1927, in save
    fp = builtins.open(filename, "w+b")
OSError: [Errno 22] Invalid argument: 'deblurS:\\deblur-gan\\images\\test\\a\\my_test_image.png'
asimay commented 6 years ago

this is caused by code bug: im.save('deblur'+image_path) actually no deblur directory. just modify it to local path to solve the problem. and the image_path should not be a specific file name.