habana_frameworks.mediapipe.fn.VideoDecoder
habana_frameworks.mediapipe.fn.VideoDecoder¶
Class:
habana_frameworks.mediapipe.fn.VideoDecoder( output_format=it.RGB_I, resize=[0, 0], crop_after_resize=[0, 0, 0, 0], resampling_mode=ft.BI_LINEAR, random_crop_type=rct.NO_RANDOM_CROP, frames_per_clip=1, max_frame_vid=1, dpb_size=16 )
- Define graph call:
__call__(input, video_offset, resample_idx, random_crop_tensor)
- Parameter:
input - Video file list.
video_offset - Indicates the Start and Number of frames to be decoded for each video.
(Optional) resample_idx - Indicates selected frames from decoded frames to be returned from decoder for each video. It should be an np array of size = [batch_size, frames_per_clip]. Supported data types: INT32.
(Optional) random_crop_tensor - Tensor containing crop coordinates of each video in a batch, size=[batch_size, 4]. Supported dimensions: minimum = 2, maximum = 2. Supported data types: UINT32.
- Output:
Returns an HPUTensor of shape (N, F, C, H, W) or (N, F, H, W, C) depending on
output_format
, where W or C are FCD (Fastest Changing Dimension) respectively, N is the batch size, and F is the frames per clip.
Description:
Decodes and resizes batch of videos. Supported formats: H.264 (elementary stream format) and MP4 (container format).
- Supported backend:
Legacy
Keyword Arguments:
kwargs |
Description |
---|---|
output_format |
Output color format produced by decoder.
|
resize |
Video resizing dimension after decoding in width, height.
|
crop_after_resize |
Video cropping dimension after decoding and resizing. Crop dimensions are [left, top, width, height].
|
resampling_mode |
Resampling mode selection.
|
random_crop_type |
Random crop mode selection.
|
frames_per_clip |
Number of frames to output per clip.
|
max_frame_vid |
Max frames to be decoded for any video, considering that few frames will be dropped because of FPS resampling.
|
dpb_size |
Number of output frames to be allocated by decoder depends on
|
Note
Performance considerations:
Maximal performance is achieved when scale factor is up to 9x.
Cropping to less than 48x48 pixels results in performance degradation.
See also