DmitryUlyanov / deep-image-prior

Image restoration with neural networks but without learning.
https://dmitryulyanov.github.io/deep_image_prior
Other
7.9k stars 1.43k forks source link

How to run the code? #45

Open Xu-Xuanhui opened 5 years ago

Xu-Xuanhui commented 5 years ago

How to run the code?I didn't see any test.

indiaskapie commented 5 years ago

You have to install all the required libraries first. then you can convert the jupyter notebooks to python to run the files.

chebotarevmichael commented 5 years ago

Could upgrade ReadMe? What is "jupyter notebooks"? I hope to find something like: "For checking sample, please run: 'python main.py'. Results of work u can find in directory 'results'."

chebotarevmichael commented 5 years ago

I installed all libs, converted them with help jupyter nbconvert --to script *.ipynb And try to start all python files. They were failed with different errors. Fo example, for python super-resolution.py error:

(base) D:\MYPROJECTS\Artificial neural network\deep-image-prior-master>python super-resolution.py
Traceback (most recent call last):
  File "super-resolution.py", line 15, in <module>
    get_ipython().run_line_magic('matplotlib', 'inline')
NameError: name 'get_ipython' is not defined

It doesn`t work with python3.6, python3.7 or ipyton.

yuanjunchai commented 5 years ago

I installed all libs, converted them with help jupyter nbconvert --to script *.ipynb And try to start all python files. They were failed with different errors. Fo example, for python super-resolution.py error:

(base) D:\MYPROJECTS\Artificial neural network\deep-image-prior-master>python super-resolution.py
Traceback (most recent call last):
  File "super-resolution.py", line 15, in <module>
    get_ipython().run_line_magic('matplotlib', 'inline')
NameError: name 'get_ipython' is not defined

It doesn`t work with python3.6, python3.7 or ipyton.

Have you solved the problem?

chebotarevmichael commented 5 years ago

I installed all libs, converted them with help jupyter nbconvert --to script *.ipynb And try to start all python files. They were failed with different errors. Fo example, for python super-resolution.py error:

(base) D:\MYPROJECTS\Artificial neural network\deep-image-prior-master>python super-resolution.py
Traceback (most recent call last):
  File "super-resolution.py", line 15, in <module>
    get_ipython().run_line_magic('matplotlib', 'inline')
NameError: name 'get_ipython' is not defined

It doesn`t work with python3.6, python3.7 or ipyton.

Have you solved the problem?

no, I didn`t. I think we should try to use second way: Docker

@DmitryUlyanov, could u help us?

mmuckermann-c24 commented 5 years ago

https://stackoverflow.com/questions/32538758/nameerror-name-get-ipython-is-not-defined

suke27 commented 5 years ago

is this problem resolved, how can we run the code?

kreha1 commented 5 years ago

Tried running the docker image on arch linux, but sudo nvidia-docker run --rm -it --ipc=host -p 8888:8888 deep-image-prior results in

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"process_linux.go:407: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: exec command: [/usr/bin/nvidia-container-cli --load-kmods configure --ldconfig=@/sbin/ldconfig --device=all --compute --utility --require=cuda>=9.0 --pid=10095 /var/lib/docker/overlay2/4242eac71e9a73f35091406359eeda340d732bd51a56929694337829b397e509/merged]\\\\nnvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.

I installed nvidia-docker from AUR using binaries as I couldn't build it from source. I was successful with building the image itself, so I have no idea why it doesn't run.

gtolun commented 5 years ago

Hi, After $ nvidia-docker build -t deep-image-prior . it looks like everything went fine. but upon executing nvidia-docker run --rm -it --ipc=host -p 8888:8888 deep-image-prior all I get is a long error message on the screen.

[I 15:10:02.159 NotebookApp] [nb_conda_kernels] enabled, 0 kernels found
[I 15:10:02.171 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'allow_remote_access'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 864, in _default_allow_remote
    addr = ipaddress.ip_address(self.ip)
  File "/opt/miniconda/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/opt/miniconda/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "</opt/miniconda/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1630, in initialize
    self.init_webapp()
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1378, in init_webapp
    self.jinja_environment_options,
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 159, in __init__
    default_url, settings_overrides, jinja_env_options)
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 252, in init_settings
    allow_remote_access=jupyter_app.allow_remote_access,
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 867, in _default_allow_remote
    for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
  File "/opt/miniconda/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

BTW, both commands needed sudo running under Mint 18.03

Any suggestions to get your code running?

If I need to run it directly (i.e., without Docker image), do you have better instructions (for non-coders)?

Thanks.

luistelmocosta commented 5 years ago

Hi, After $ nvidia-docker build -t deep-image-prior . it looks like everything went fine. but upon executing nvidia-docker run --rm -it --ipc=host -p 8888:8888 deep-image-prior all I get is a long error message on the screen.

[I 15:10:02.159 NotebookApp] [nb_conda_kernels] enabled, 0 kernels found
[I 15:10:02.171 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'allow_remote_access'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 864, in _default_allow_remote
    addr = ipaddress.ip_address(self.ip)
  File "/opt/miniconda/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/opt/miniconda/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "</opt/miniconda/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1630, in initialize
    self.init_webapp()
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 1378, in init_webapp
    self.jinja_environment_options,
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 159, in __init__
    default_url, settings_overrides, jinja_env_options)
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 252, in init_settings
    allow_remote_access=jupyter_app.allow_remote_access,
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/opt/miniconda/lib/python3.7/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/opt/miniconda/lib/python3.7/site-packages/notebook/notebookapp.py", line 867, in _default_allow_remote
    for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
  File "/opt/miniconda/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

BTW, both commands needed sudo running under Mint 18.03

Any suggestions to get your code running?

If I need to run it directly (i.e., without Docker image), do you have better instructions (for non-coders)?

Thanks.

Did you manage to solve this? I am having the exact same issue

tuliopic commented 5 years ago

The solution is to change the dockerfile.txt (@gtolun): from : CMD jupyter notebook --ip="*" --no-browser --allow-root to : CMD jupyter notebook --ip="0.0.0.0" --no-browser --allow-root and then re run the first command :

sudo nvidia-docker build -t deep-image-prior .
nvidia-docker run --rm -it --ipc=host -p 8888:8888 deep-image-prior
chenhao1208 commented 3 years ago

It seems difficult to make it.