From 8039c0863a80973ca1750c86047e231f9c00a60f Mon Sep 17 00:00:00 2001 From: Zehui-Lin Date: Fri, 28 May 2021 11:42:04 +0800 Subject: [PATCH 1/2] fix func declaration --- slowfast/datasets/transform.py | 8 ++++---- slowfast/datasets/utils.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slowfast/datasets/transform.py b/slowfast/datasets/transform.py index 06b4dbcc7..5d6faf1e7 100644 --- a/slowfast/datasets/transform.py +++ b/slowfast/datasets/transform.py @@ -41,7 +41,7 @@ def random_short_side_scale_jitter( corresponding boxes. Args: images (tensor): images to perform scale jitter. Dimension is - `num frames` x `channel` x `height` x `width`. + `channel` x `num frames` x `height` x `width`. min_size (int): the minimal size to scale the frames. max_size (int): the maximal size to scale the frames. boxes (ndarray): optional. Corresponding boxes to images. @@ -114,7 +114,7 @@ def random_crop(images, size, boxes=None): Perform random spatial crop on the given images and corresponding boxes. Args: images (tensor): images to perform random crop. The dimension is - `num frames` x `channel` x `height` x `width`. + `channel` x `num frames` x `height` x `width`. size (int): the size of height and width to crop on the image. boxes (ndarray or None): optional. Corresponding boxes to images. Dimension is `num boxes` x 4. @@ -151,12 +151,12 @@ def horizontal_flip(prob, images, boxes=None): Args: prob (float): probility to flip the images. images (tensor): images to perform horizontal flip, the dimension is - `num frames` x `channel` x `height` x `width`. + `channel` x `num frames` x `height` x `width`. boxes (ndarray or None): optional. Corresponding boxes to images. Dimension is `num boxes` x 4. Returns: images (tensor): images with dimension of - `num frames` x `channel` x `height` x `width`. + `channel` x `num frames` x `height` x `width`. flipped_boxes (ndarray or None): the flipped boxes with dimension of `num boxes` x 4. """ diff --git a/slowfast/datasets/utils.py b/slowfast/datasets/utils.py index 47a1b7f44..d9a7b75d2 100644 --- a/slowfast/datasets/utils.py +++ b/slowfast/datasets/utils.py @@ -125,7 +125,7 @@ def spatial_sampling( with the given spatial_idx. Args: frames (tensor): frames of images sampled from the video. The - dimension is `num frames` x `height` x `width` x `channel`. + dimension is `channel` x `num frames` x `height` x `width`. spatial_idx (int): if -1, perform random spatial sampling. If 0, 1, or 2, perform left, center, right crop if width is larger than height, and perform top, center, buttom crop if height is larger From 2226f8a2d44de921187b1bbdd48c6f66798b0826 Mon Sep 17 00:00:00 2001 From: Zehui-Lin Date: Tue, 8 Jun 2021 18:28:11 +0800 Subject: [PATCH 2/2] minor --- slowfast/datasets/transform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slowfast/datasets/transform.py b/slowfast/datasets/transform.py index b850aae8d..be0c54d59 100644 --- a/slowfast/datasets/transform.py +++ b/slowfast/datasets/transform.py @@ -57,7 +57,7 @@ def random_short_side_scale_jitter( scale. If False, take a uniform sample from [min_scale, max_scale]. Returns: (tensor): the scaled images with dimension of - `num frames` x `channel` x `new height` x `new width`. + `channel` x `num frames` x `new height` x `new width`. (ndarray or None): the scaled boxes with dimension of `num boxes` x 4. """ @@ -126,7 +126,7 @@ def random_crop(images, size, boxes=None): Dimension is `num boxes` x 4. Returns: cropped (tensor): cropped images with dimension of - `num frames` x `channel` x `size` x `size`. + `channel` x `num frames` x `size` x `size`. cropped_boxes (ndarray or None): the cropped boxes with dimension of `num boxes` x 4. """