cerebras.modelzoo.data.vision.segmentation.transforms.crop_and_pad_augmentations.crop#
- cerebras.modelzoo.data.vision.segmentation.transforms.crop_and_pad_augmentations.crop(data, seg=None, crop_size=128, margins=(0, 0, 0), crop_type='center', pad_mode='constant', pad_kwargs={'constant_values': 0}, pad_mode_seg='constant', pad_kwargs_seg={'constant_values': 0})[source]#
- crops data and seg (seg may be None) to crop_size. Whether this will be achieved via center or random crop is determined by crop_type. Margin will be respected only for random_crop and will prevent the crops form being closer than margin to the respective image border. crop_size can be larger than data_shape - margin -> data/seg will be padded with zeros in that case. margins can be negative -> results in padding of data/seg followed by cropping with margin=0 for the appropriate axes - Parameters
- data – b, c, x, y(, z) 
- seg – 
- crop_size – 
- margins – distance from each border, can be int or list/tuple of ints (one element for each dimension). 
 
 - Can be negative (data/seg will be padded if needed) :param crop_type: random or center :return: