]> git.sesse.net Git - voxel-flow/commitdiff
update readme
authorZiwei Liu <zwliu.hust@gmail.com>
Mon, 5 Feb 2018 01:30:27 +0000 (17:30 -0800)
committerZiwei Liu <zwliu.hust@gmail.com>
Mon, 5 Feb 2018 01:30:27 +0000 (17:30 -0800)
README.md
eval_voxelflow.m [new file with mode: 0644]

index 5abb631c2e8ae5e43b055e7dddbe13be81c568da..2a632660662563e7711a09558f26d5d487ca3056 100755 (executable)
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
 # Video Frame Synthesis using Deep Voxel Flow
 [[Project]](https://liuziwei7.github.io/projects/VoxelFlow) [[Paper]](https://arxiv.org/abs/1702.02463)   
 
-<img src='./misc/demo.gif' width=640>
+<img src='./misc/demo.gif' width=720>
 
 ## Overview
 `Deep Voxel Flow (DVF)` is the author's re-implementation of the video frame synthesizer described in:  
 "Video Frame Synthesis using Deep Voxel Flow"   
-[Ziwei Liu](https://liuziwei7.github.io/), [Raymond A. Yeh](http://www.isle.illinois.edu/~yeh17/), [Xiaoou Tang](http://www.ie.cuhk.edu.hk/people/xotang.shtml), [Yiming Liu](http://bitstream9.me/), [Aseem Agarwala](http://www.agarwala.org/)
+[Ziwei Liu](https://liuziwei7.github.io/), [Raymond A. Yeh](http://www.isle.illinois.edu/~yeh17/), [Xiaoou Tang](http://www.ie.cuhk.edu.hk/people/xotang.shtml), [Yiming Liu](http://bitstream9.me/), [Aseem Agarwala](http://www.agarwala.org/) (CUHK & UIUC & Google)
 In International Conference on Computer Vision (ICCV) 2017, Oral Presentation
 
 <img src='./misc/demo_teaser.jpg' width=800>
@@ -25,6 +25,10 @@ python voxel_flow_train.py --subset=train
 ``` bash
 python voxel_flow_train.py --subset=test
 ```
+* Run the evaluation script:
+``` bash
+matlab eval_voxelflow.m
+```
 
 ## License and Citation
 The use of this software is RESTRICTED to **non-commercial research and educational purposes**.
diff --git a/eval_voxelflow.m b/eval_voxelflow.m
new file mode 100644 (file)
index 0000000..413f8d7
--- /dev/null
@@ -0,0 +1,57 @@
+clear;clc;
+
+num_img = length(subdir);
+flag_valid = zeros(1, num_img, 'single');
+mat_psnr = zeros(1, num_img, 'single');
+mat_ssim = zeros(1, num_img, 'single');
+
+for id_img = 1:num_img
+
+       dir_img_cur = [dir_data, subdir(id_img).name, '/'];
+
+       % read images
+       img_pred = imread([dir_img_cur, 'pred_01.png']);
+       img_target = imread([dir_img_cur, 'target_01.png']);
+       img_prev = imread([dir_img_cur, 'frame_00.png']);
+       img_next = imread([dir_img_cur, 'frame_01.png']);
+
+       img_pred_ycbcr = rgb2ycbcr(uint8(img_pred));
+       img_target_ycbcr = rgb2ycbcr(uint8(img_target));
+
+       img_pred_gray = img_pred_ycbcr(:, :, 1);
+       img_target_gray = img_target_ycbcr(:, :, 1);
+
+       img_pred = single(img_pred);
+       img_target = single(img_target);
+       img_prev = single(img_prev);
+
+       img_pred_gray = single(img_pred_gray);x
+       img_target_gray = single(img_target_gray);
+
+       % check validity
+       if sum(mask_flow(:)) > 0
+               
+               flag_valid(id_img) = 1;
+
+               img_pred_mask = repmat(mask_flow, [1, 1, 3]) .* img_pred;
+               img_target_mask = repmat(mask_flow, [1, 1, 3]) .* img_target;
+
+               mse = sum((img_pred_mask(:) - img_target_mask(:)).^2) ./ (3 .* sum(mask_flow(:)));
+               psnr_cur = 20.0 .* log10(255.0) - 10.0 .* log10(mse);
+               
+               [ssim_cur, ~] = ssim(img_pred_gray, img_target_gray);
+
+               mat_psnr(id_img) = psnr_cur;
+               mat_ssim(id_img) = ssim_cur;
+
+       end
+
+       disp(['Processing Img ', num2str(id_img), '...']);
+
+end
+
+flag_valid(find(mat_psnr == inf)) = 0;
+mat_psnr(find(mat_psnr == inf)) = 0;
+
+mean_psnr = sum(flag_valid .* mat_psnr) ./ sum(flag_valid)
+mean_ssim = sum(flag_valid .* mat_ssim) ./ sum(flag_valid)