Skip to content

I have some questions about the read_video of videoio and the load_side_data function in dataset.py #2

@Loewen-Hob

Description

@Loewen-Hob

Hello developer, this is a very exciting project, but I have two questions that I am confused about and would like to get your answers to.
The first question: Each version of the videoio package does not have a read_video interface, but only read_video_params, and the second parameter of read_video_params does not match the options entered in your code. You need to enter int while the code is dict. I really hope you can tell me how to write this read_video function, thank you very much!

__version__ = '0.2.8'
from .video_rgb import videoread, videosave, VideoReader, VideoWriter
from .video_uint16 import uint16read, uint16save, Uint16Reader, Uint16Writer
from .info import read_video_params

The second question: the load_side_data function needs to return residuals and motion_vector, which is also what you focused on in the paper, but there is no such field in the info_list obtained through read_video_params (if), so no matter what, res and mv are Is it possible to get it this way?
mv = torch.zeros(2, 224, 224, dtype=torch.float32)

This is a code snippet that I don't quite understand:

def load_side_data(video_path: str, frame_idxs: List):
    options = {'load_residuals': 1}
    frame_idxs.sort()
    options['target_list'] = frame_idxs

    sidedata_dict = {}


    info_list = read_video(video_path, options)

    for frame_idx in frame_idxs:
        info = info_list[frame_idx-1]
        if 'residuals' in info:
            res = preprocess_residual(info['residuals'])
        else:
            res = torch.zeros(3, 224, 224, dtype=torch.float32)

        if 'motion_vector' in info:
            mv = preprocess_motion_vector(info['motion_vector'])
        else:
            mv = torch.zeros(2, 224, 224, dtype=torch.float32)

        sidedata_dict[frame_idx] = {
            'res': res,
            'mv': mv,
        }

    return sidedata_dict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions