m-tassano/fastdvdnet

Remove np.stack from loop in utils.open_sequence

Closed this issue · 1 comments

If the max_num_fr_per_seq is large (> 500), the process of testing is slowing down on the open_sequence method.
By removing the np.stack function from the loop, it speeds up the opening image process:
Fix (utils.py line 129):

print("\tOpen sequence in folder: ", seq_dir)
for fpath in files[0:max_num_fr]:

    img, expanded_h, expanded_w = open_image(fpath,\
        gray_mode=gray_mode,\
        expand_if_needed=expand_if_needed,\
        expand_axis0=False)
    seq_list.append(img)
seq = np.stack(seq_list, axis=0) ### --> np.stack removed from the loop for the same result.
return seq, expanded_h, expanded_w

I updated the code. Thanks for your recommendation.