Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting documentation does not work #125

Open
reubengann opened this issue Apr 15, 2023 · 5 comments
Open

Starting documentation does not work #125

reubengann opened this issue Apr 15, 2023 · 5 comments

Comments

@reubengann
Copy link

reubengann commented Apr 15, 2023

I love the idea of this project, but following the readme.md does not produce a working test. Is there something I'm missing? For instance, after creating the environment

conda create -n vsr python=3.7
conda activate vsr
conda install tensorflow-gpu==1.15.0
pip install -e .
python prepare_data.py --filter vespcn vid4

you will get an error that torch is needed (which the readme says is optional). That's fine, so the user may then install torch that's compatible with this version of python and tensorflow from conda

conda install pytorch torchvision

Now you can run the prepare data example, but when you go to evaluate:

python eval.py srcnn -t vid4 --pretrain=C:\repos\VideoSuperResolution\models\srcnn_ep0200.pth

You will get "RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU."

A user's next inclination would be to find out how to find out how to install torch with gpu support, so they go over to https://pytorch.org/get-started/locally/ and follow the directions. Making a new environment.

conda create -n vsr python=3.9
activate vsr
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -e .
conda install tensorflow-gpu keras
python prepare_data.py --filter vespcn vid4

This now fails with

2023-04-14 22:02:00,744 WARNING: [!] PyTorch version too low: 2.0.0, recommended 1.2.0
C:\repos\VideoSuperResolution\VSR\DataLoader\VirtualFile.py:423: SyntaxWarning: "is" with a literal. Did you mean "=="?
assert len(padding) is 2, f"Invalid padding, {padding}"
C:\repos\VideoSuperResolution\VSR\Util\ImageProcess.py:31: SyntaxWarning: "is" with a literal. Did you mean "=="?
return ret.pop() if len(ret) is 1 else ret
C:\repos\VideoSuperResolution\VSR\DataLoader\Loader.py:335: SyntaxWarning: "is" with a literal. Did you mean "=="?
assert len(shape) is 5, f"Shape is not 5D, which is {len(shape)}"

I would be happy to help with development if that's what's needed.

@LoSealL
Copy link
Owner

LoSealL commented Apr 15, 2023

Hi, thanks for still playing with this old repo. After you setup environment, the following messages seem to be warnings, but nor errors, what behaviour do you expect?

This now fails with
2023-04-14 22:02:00,744 WARNING: [!] PyTorch version too low: 2.0.0, recommended 1.2.0
C:\repos\VideoSuperResolution\VSR\DataLoader\VirtualFile.py:423: SyntaxWarning: "is" with a literal. Did you mean "=="?
assert len(padding) is 2, f"Invalid padding, {padding}"
C:\repos\VideoSuperResolution\VSR\Util\ImageProcess.py:31: SyntaxWarning: "is" with a literal. Did you mean "=="?
return ret.pop() if len(ret) is 1 else ret
C:\repos\VideoSuperResolution\VSR\DataLoader\Loader.py:335: SyntaxWarning: "is" with a literal. Did you mean "=="?
assert len(shape) is 5, f"Shape is not 5D, which is {len(shape)}"

@reubengann
Copy link
Author

reubengann commented Apr 15, 2023 via email

@LoSealL
Copy link
Owner

LoSealL commented Apr 15, 2023

The assert is an actual error that halts the program.

On Sat, Apr 15, 2023, 11:29 AM Tang, Wenyi @.> wrote: Hi, thanks for still playing with this old repo. After you setup environment, the following messages seem to be warnings, but nor errors, what behaviour do you expect? This now fails with 2023-04-14 22:02:00,744 WARNING: [!] PyTorch version too low: 2.0.0, recommended 1.2.0 C:\repos\VideoSuperResolution\VSR\DataLoader\VirtualFile.py:423: SyntaxWarning: "is" with a literal. Did you mean "=="? assert len(padding) is 2, f"Invalid padding, {padding}" C:\repos\VideoSuperResolution\VSR\Util\ImageProcess.py:31: SyntaxWarning: "is" with a literal. Did you mean "=="? return ret.pop() if len(ret) is 1 else ret C:\repos\VideoSuperResolution\VSR\DataLoader\Loader.py:335: SyntaxWarning: "is" with a literal. Did you mean "=="? assert len(shape) is 5, f"Shape is not 5D, which is {len(shape)}" — Reply to this email directly, view it on GitHub <#125 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE33JRSCMLAF5CJJICJNGRLXBK5HHANCNFSM6AAAAAAW7DFJS4 . You are receiving this because you authored the thread.Message ID: @.>

And what is the assertion error message?

@reubengann
Copy link
Author

I don't get any other message. Perhaps I'm wrong that it halts? But when I then run

python eval.py srcnn -t vid4 --pretrain=C:\repos\VideoSuperResolution\models\srcnn_ep0200.pth

It says it runs for 0 iterations and no results end up in the Results\srcnn folder.

2023-04-15 12:02:23,813 WARNING: [!] PyTorch version too low: 2.0.0, recommended 1.2.0
2023-04-15 12:02:29,611 INFO: Total params: 69251
Test: 0it [00:00, ?it/s]
2023-04-15 12:02:29,620 INFO: .

Which makes me think it did not prepare the data. Is that incorrect?

@MeraMeskul
Copy link

MeraMeskul commented Oct 10, 2023

Are you trying to work on a PC which does not have Nvidia GPU ?
If so, I have the same problem.
Interestingly, .vsr folder wasn't there, so I created one and add config.yml file to directory below.
VideoSuperResolution-master.vsr\config.yml
The content is:

backend: tensorflow  # (tensorflow, pytorch)
verbose: info        # (debug, info, warning, error)

When i tried to run, it takes backend as pytorch, not as tensorflow.
In another issue, somebody gave a hint.
In the code whose dir is given below,
VideoSuperResolution-master\VSR\Backend_init_.py
change Line 24:

'backend': os.environ.get('VSR_BACKEND', 'pytorch'),

as

'backend': os.environ.get('VSR_BACKEND', 'tensorflow'),

and it will take the backend as tensorflow.

If we try to figure out how it works that way, we can fix that bug, or our directories is not properly created in true places.

I don't know this repo is valid for CPU-only PC's or not. This can be a question for the repo owner @LoSealL.

Edit: These are the following if you want to use your config.yml properly:
Edit system variables add VSR_HOME as ...\VideoSuperResolution-master\ .vsr, ... is your full path.
Edit Line 27-29 of VideoSuperResolution-master\VSR\Backend_init_.py as

if (Path(HOME) / 'config.yml').exists():
  with open((Path(HOME) / 'config.yml'), encoding='utf8') as fd:
    CONFIG = yaml.load(fd.read(), Loader=_Loader)

Now, the program should be able to read config.yml properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants