HD1K — Torchvision 0.22 documentation (original) (raw)
class torchvision.datasets.HD1K(root: ~typing.Union[str, ~pathlib.Path], split: str = 'train', transforms: ~typing.Optional[~typing.Callable] = None, loader: ~typing.Callable[[str], ~typing.Any] = <function default_loader>)[source]¶
HD1K dataset for optical flow.
The dataset is expected to have the following structure:
root hd1k hd1k_challenge image_2 hd1k_flow_gt flow_occ hd1k_input image_2
Parameters:
- root (str or
pathlib.Path
) – Root directory of the HD1K Dataset. - split (string , optional) – The dataset split, either “train” (default) or “test”
- transforms (callable , optional) – A function/transform that takes in
img1, img2, flow, valid_flow_mask
and returns a transformed version. - loader (callable , optional) – A function to load an image given its path. By default, it uses PIL as its image loader, but users could also pass in
torchvision.io.decode_image
for decoding image data into tensors directly.
Special-members:
__getitem__(index: int) → Union[Tuple[Image, Image, Optional[ndarray], Optional[ndarray]], Tuple[Image, Image, Optional[ndarray]]][source]¶
Return example at given index.
Parameters:
index (int) – The index of the example to retrieve
Returns:
A 4-tuple with (img1, img2, flow, valid_flow_mask)
where valid_flow_mask
is a numpy boolean mask of shape (H, W) indicating which flow values are valid. The flow is a numpy array of shape (2, H, W) and the images are PIL images. flow
and valid_flow_mask
are None ifsplit="test"
.
Return type: