clausmichele / ViDeNN

ViDeNN - Deep Blind Video Denoising
MIT License
232 stars 35 forks source link

Test has no attribute 'astype' #3

Closed lalithnag closed 6 years ago

lalithnag commented 6 years ago

Hi,

While executing the following command:

$ python main.py --ckpt_dir=./ckpt_vidcnn-g --use_gpu=0

I get the following error:

CPU

[*] Initialize model successfully...
[*] Reading checkpoint...
Traceback (most recent call last):
  File "main.py", line 57, in <module>
    tf.app.run()
  File "C:\Users\nag\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "main.py", line 53, in main
    vidcnn_test(model)
  File "main.py", line 32, in vidcnn_test
    vidcnn.test(noisy_files, orig_files, ckpt_dir=args.ckpt_dir, save_dir='./data/denoised')
  File "D:\00-code\VidCNN---Learning-Blind-Video-Denoising\model_vidcnn.py", line 64, in test
    test = test.astype(np.float32) / 255.0
AttributeError: 'NoneType' object has no attribute 'astype'

However, if I execute:

$ sh denoise.sh

It runs normally:

VidCNN - Learning Blind Video Denoising
[*] Insert the video file name you want to denoise:
icuts-video-1-suture_left.mov
mkdir: cannot create directory ‘noisy’: File exists
[*] Extracting frames to the Noisy folder...
ffmpeg version N-92539-g1035206102 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg--enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 40.100 / 58. 40.100
  libavformat    58. 23.100 / 58. 23.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 46.100 /  7. 46.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './icuts-video-1-suture_left.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf56.15.102
  Duration: 00:00:20.25, start: 0.000000, bitrate: 1239 kb/s
    Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1237 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to './noisy/%04d.png':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.23.100
    Stream #0:0(eng): Video: png, rgb24, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.40.100 png
frame=  374 fps=116 q=-0.0 Lsize=N/A time=00:00:12.47 bitrate=N/A speed=3.88x
video:84405kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

The video that I want to denoise, is extracted into frames in the following directory: ..\VidCNN---Learning-Blind-Video-Denoising\noisy

Please guide me in executing the program through the script main.py

Thank you!

clausmichele commented 6 years ago

It's simply, it is not finding the file, because it suppose another directory structure:

parser.add_argument('--test_dir', dest='test_dir', default='./data/test', help='folder containing original and noisy folders to be denoised')

So, either you add --test_dir=./ or you put your data inside ./data/test/noisy and ./data/test/original

lalithnag commented 5 years ago

Thanks. My video though is already noisy - so I've just extracted the frames to a noisy folder. In this case what would be in the original folder?

clausmichele commented 5 years ago

Just copy your noisy files in the original folder. The algorithm needs original and noisy just to compute the PSNR, so the output values will be computed between denoised and noisy instead of denoised and original.