pulse2percept.datasets.han2021

fetch_han2021

Functions

fetch_han2021([videos, resize, as_gray, ...])

Load the original videos of outdoor scenes from [Han2021]

pulse2percept.datasets.han2021.fetch_han2021(videos=None, resize=None, as_gray=None, data_path=None, download_if_missing=True)[source]

Load the original videos of outdoor scenes from [Han2021]

Download the original videos or simulated prosthetic vision of outdoor scenes described in [Han2021] from https://osf.io/pf2ja/ (303MB) to data_path. By default, all datasets are stored in ‘~/pulse2percept_data/’, but a different path can be specified.

Number of videos:

20

Number of frames:

125 or 126

Frame size (px):

320 x 180

Each VideoStimulus object contains a metadata dict with the following fields:

plugin

FFMPEG

ffmpeg_version

FFMPEG version

codec

FFMPEG codec

pix_fmt

pixel format

nframes

Number of frames

duration

Movie duration (seconds)

fps

Frame rate (frames per second)

source

File name of original video (before downscaling)

source_size

Original image size (before downscaling)

source_shape

Original video shape (before downscaling)

size

Actual image size (after downscaling)

rotate

Rotation angle

Added in version 0.9.

Parameters:
  • videos (str | list of strings | None, optional) – Video names you want to download. By default, all videos will be downloaded. Available names: ‘sample1’ - ‘sample4’, ‘stim1’ - ‘stim16’

  • resize ((height, width) or None, optional, default: None) – A tuple specifying the desired height and width of each video frame. The original size is 320x180 pixels.

  • as_gray (bool, optional) – Flag whether to convert the image to grayscale. A four-channel image is interpreted as RGBA (e.g., a PNG), and the alpha channel will be blended with the color black.

  • data_path (string, optional) – Specify another download and cache folder for the dataset. By default all pulse2percept data is stored in ‘~/pulse2percept_data’ subfolders.

  • download_if_missing (optional) – If False, raise an IOError if the data is not locally available instead of trying to download it from the source site.

Returns:

data – VideoStimulus of the original videos in [Han2021]

Return type:

dict of VideoStimulus