mseitzer / srgan

Pytorch implementation of "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"
MIT License
42 stars 14 forks source link

running on windows 10 #1

Closed joemcglinchy closed 6 years ago

joemcglinchy commented 6 years ago

Hello, thanks for your work on this! I am trying to run one of the pretrained models (srresnet) on some sample images and have some questions:

1) do you think this will work directly on windows?? There is a pytorch version out there that plays nice with windows which I am using. 2) does it support TIF files? I tried initially with a TIF format image and an error message returned that 0 images were found 3) I tried running the pretrained srresnet model on a JPG image and received this error:

Running on GPU 0
Restored checkpoint from ./resources/pretrained/srresnet.pth
Traceback (most recent call last):
  File "eval.py", line 225, in <module>
    data = runner.infer(loader)
  File "C:\Projects\dl_pytorch\srgan\training\base_runner.py", line 125, in infer
    self.data_iter = iter(loader)
  File "C:\software\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 310, in __iter__
    return DataLoaderIter(self)
  File "C:\software\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 167, in __init__
    w.start()
  File "C:\software\Anaconda3\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\software\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\software\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\software\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\software\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'sr_test_transform.<locals>.transform'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\software\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\software\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
mseitzer commented 6 years ago

Hi, thanks for trying out the project.

  1. I can not say for sure, as I do not have a Windows 10 machine available to test, but provided you have a working Pytorch version, it could work.
  2. As long as pillow can read the tiff file, there should be no problem. Right now input images are filtered by file extension, so that's why it ignores the image. Will add support for the tiff extensions.
  3. This looks like an issue with your Pytorch. Which version are you running? The problem is that your Pytorch uses the native Python multithreading library, instead of Pytorch's custom one. Python's multithreading library appears to be incompatible with my code, whereas it works with the Pytorch's. This is a problem related to Windows' Pytorch. See e.g. here https://github.com/pytorch/pytorch/issues/2394. You can try to run with --conf num_data_workers=1 as a workaround which should disable multithreading.
joemcglinchy commented 6 years ago

The pytorch version I have is from channel peterjc123, which does have a known limitation with the multithreading library. The current solution is to wrap the entire script in the if name == ‘main’: block which looks like it may not be feasible when trying to apply prebuilt Pytorch model implementations. I am going to get Ubuntu up and running on my machine and see if I can use the package as-is.

From: mseitzer [mailto:notifications@github.com] Sent: Tuesday, January 9, 2018 3:04 AM To: mseitzer/srgan srgan@noreply.github.com Cc: Joseph McGlinchy Joseph.McGlinchy@Colorado.EDU; Author author@noreply.github.com Subject: Re: [mseitzer/srgan] running on windows 10 (#1)

Hi, thanks for trying out the project.

  1. I can not say for sure, as I do not have a Windows 10 machine available to test, but provided you have a working Pytorch version, it could work.
  2. As long as pillow can read the tiff file, there should be no problem. Right now input images are filtered by file extension, so that's why it ignores the image. Will add support for the tiff extensions.
  3. This looks like an issue with your Pytorch. Which version are you running? The problem is that your Pytorch uses the native Python multithreading library, instead of Pytorch's custom one. Python's multithreading library appears to be incompatible with my code, whereas it works with the Pytorch's.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mseitzer/srgan/issues/1#issuecomment-356237799, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEiqZubftJqGchxV8DNP6Zs68qx7ZR1Uks5tIzmJgaJpZM4RXI5G.