LoSealL / VideoSuperResolution

A collection of state-of-the-art video or single-image super-resolution architectures, reimplemented in tensorflow.
MIT License
1.61k stars 295 forks source link

How to test vespcn on Vid4 or other video datasets to get PSNR and SSIM? #30

Closed HymEric closed 5 years ago

HymEric commented 5 years ago

When I trained vespcn, This is fine, but oly get psnr. CUDA_VISIBLE_DEVICES=0 python run.py --model vespcn --test vid4

Whrn I want to get ssim, I run: CUDA_VISIBLE_DEVICES=0 python ben.py --model=vespcn --epochs=100 --checkpoint_dir=../Results/vespcn/save --test=vid4 --enable_psnr --enable_ssim Log:


Instructions for updating:
Use standard file APIs to check for files with this prefix.
INFO:tensorflow:Restoring parameters from /tmp/vsr/vespcn/save/vespcn-sc2-ep0100.ckpt
Test:   0%|                                                                               | 0/171 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "ben.py", line 52, in <module>
    tf.app.run(main)
  File "/home/disk3/hym/anaconda3/envs/pytorch100/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "ben.py", line 44, in main
    return EvalModelCheckpoint.evaluate(*args[0][1:])
  File "/home/disk3/hym/pycharm_remote/VideoSuperResolution-master/VSR/Tools/EvalModelCheckpoint.py", line 91, in evaluate
    t.benchmark(loader, test_config)
  File "/home/disk3/hym/pycharm_remote/VideoSuperResolution-master/VSR/Framework/Trainer.py", line 397, in benchmark
    self.fn_benchmark_body()
  File "/home/disk3/hym/pycharm_remote/VideoSuperResolution-master/VSR/Framework/Trainer.py", line 334, in fn_benchmark_body
    self.fn_benchmark_each_step(label, feature, name, post)
  File "/home/disk3/hym/pycharm_remote/VideoSuperResolution-master/VSR/Framework/Trainer.py", line 327, in fn_benchmark_each_step
    mode=v.color_format, subdir=v.subdir)
  File "/home/disk3/hym/pycharm_remote/VideoSuperResolution-master/VSR/Tools/EvalModelCheckpoint.py", line 50, in get_outputs
    imgs = outputs[index] if isinstance(outputs, list) else outputs
TypeError: list indices must be integers or slices, not str

Is there a problem?

LoSealL commented 5 years ago

Yeah, this is a bug, because I update --output_index option recently and haven't correct in ben.py. You can do like this:

python ben.py --input_dir=../Results/vespcn/VID4 --test=vid4 --enable_psnr --enable_ssim

Where ../Results/vespcn/VID4 is predicted output by your model.

P.S: I saw you trained by PyTorch, and you also want to train via Tensorflow?

HymEric commented 5 years ago

Yes, I currently train it by Tensorflow for comparison because some model don't in pytorch.