universome / stylegan-v

[CVPR 2022] StyleGAN-V: A Continuous Video Generator with the Price, Image Quality and Perks of StyleGAN2
https://universome.github.io/stylegan-v
333 stars 36 forks source link

Questions about calc_metrics_for_dataset #11

Closed johannwyh closed 2 years ago

johannwyh commented 2 years ago

I encountered an issue of calc_metrics_for_dataset.py that, the dummy_dataset_cfg is set as,

dummy_dataset_cfg = OmegaConf.create({'max_num_frames': 10000, 'sampling': {}})

while constructing the VideoFramesFolderDataset, it computes raw_shape by calling

raw_shape = [len(self._video_idx2frames)] + list(self._load_raw_frames(0)[0][0].shape)

self._load_raw_frames(0) has frame_idx as None, therefore requires to sample frames

frames_idx = sample_frames(self.sampling_dict, total_video_len=min(total_len, self.max_num_frames)) + offset

This sampling_dict is an empty dict, as is set in dummy_dataset_cfg, and causes an error that type key is not found in the dict when sample_frames function executes

if cfg['type'] == 'random':

Seemingly I should not arbitrarily set a type for the sampling_dict as both sampling methods require more arguments in sampling_dict, in which there is nothing available.

May I know how to modify the video dataset construction logic for metric evaluation?

johannwyh commented 2 years ago

Currently I modified the way to compute raw_shape as

raw_shape = [len(self._video_idx2frames)] + list(self._load_raw_frames(0, [0])[0][0].shape)

giving the frame_idx a list [0]. Does it make sense?

universome commented 2 years ago

Hi, I am sorry that you had to dig into all those details due to my mistake and sorry for replying that late. The above change which you made seems reasonable to me, it shouldn't break anywhere.

universome commented 2 years ago

I've just incorporated your changes into the repo. If you like, you can alternatively create a PR with them and i will merge it. Thank you a lot of point out to this error, it's a very crucial part of the code. I am trying to understand now how it was working for me before...

johannwyh commented 2 years ago

Thanks for your kind reply. Just modify your repo directly as I have fixed this bug and move on with my project. I did no version management locally.

Anyway, your framework for metric calculation is awesome, very easy to use.