cvtools.data_augs.augmentations module¶
-
class
cvtools.data_augs.augmentations.Compose(transforms)[源代码]¶ 基类:
objectComposes several augmentations together. :param transforms: list of transforms to compose. :type transforms: List[Transform]
Example
>>> augmentations.Compose([ >>> transforms.CenterCrop(10), >>> transforms.ToTensor(), >>> ])
-
class
cvtools.data_augs.augmentations.Lambda(lambd)[源代码]¶ 基类:
objectApplies a lambda as a transform.
-
class
cvtools.data_augs.augmentations.RandomHorMirror[源代码]¶ 基类:
object水平方向(flipping around the y-axis)镜像
-
class
cvtools.data_augs.augmentations.RandomSampleCrop[源代码]¶ 基类:
objectCrop :param img: the image being input during training :type img: Image :param boxes: the original bounding boxes in pt form :type boxes: Tensor :param labels: the class labels for each bbox :type labels: Tensor :param mode: the min and max jaccard overlaps :type mode: float tuple
返回: - (img, boxes, classes)
- img (Image): the cropped image boxes (Tensor): the adjusted bounding boxes in pt form labels (Tensor): the class labels for each bbox
-
class
cvtools.data_augs.augmentations.RandomVerMirror[源代码]¶ 基类:
object竖直方向(flipping around the x-axis)镜像
-
class
cvtools.data_augs.augmentations.SSDAugmentation(size=300, mean=(104, 117, 123))[源代码]¶ 基类:
object
-
class
cvtools.data_augs.augmentations.SwapChannels(swaps)[源代码]¶ 基类:
object- Transforms a tensorized image by swapping the channels in the order
- specified in the swap tuple.
参数: swaps (int triple) -- final order of channels eg: (2, 1, 0)
-
cvtools.data_augs.augmentations.horizontal_mirror(image, boxes)[源代码]¶ 水平方向(flipping around the y-axis)镜像
参数: - image (np.ndarray) -- numpy数组
- boxes (np.ndarray) -- numpy数组,nx4 or nx8
-
cvtools.data_augs.augmentations.jaccard_numpy(box_a, box_b)[源代码]¶ Compute the jaccard overlap of two sets of boxes. The jaccard overlap is simply the intersection over union of two boxes. E.g.:
A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)参数: - box_a -- Multiple bounding boxes, Shape: [num_boxes,4]
- box_b -- Single bounding box, Shape: [4]
返回: Shape: [box_a.shape[0], box_a.shape[1]]
返回类型: jaccard overlap
-
cvtools.data_augs.augmentations.rotate_180(img, bboxes=None)[源代码]¶ 顺时针旋转180度
- bboxes支持的格式
- 两点式: x1y1x2y2, 四点式:x1y1x2y2x3y3x4y4
参数: - img (np.ndarray) -- the format of opencv image
- bboxes (list or np.ndarray) -- supported format two points: x1y1x2y2, four points: x1y1x2y2x3y3x4y4
-
cvtools.data_augs.augmentations.rotate_270(img, bboxes=None)[源代码]¶ 逆时针旋转90度
- bboxes支持的格式
- 两点式: x1y1x2y2, 四点式:x1y1x2y2x3y3x4y4
参数: - img (np.ndarray) -- the format of opencv image
- bboxes (list or np.ndarray) -- supported format two points: x1y1x2y2, four points: x1y1x2y2x3y3x4y4