示例#1
0
    def __init__(self,
                 featurewise_center=False,
                 samplewise_center=False,
                 featurewise_std_normalization=False,
                 samplewise_std_normalization=False,
                 zca_whitening=False,
                 rotation_range=0.,
                 width_shift_range=0.,
                 height_shift_range=0.,
                 shear_range=0.,
                 zoom_range=0.,
                 channel_shift_range=0.,
                 fill_mode='nearest',
                 cval=0.,
                 horizontal_flip=False,
                 vertical_flip=False,
                 rescale=None,
                 preprocessing_function=None,
                 data_format=None):

        ImageDataGenerator.__init__(
            self, featurewise_center, samplewise_center,
            featurewise_std_normalization, samplewise_std_normalization,
            zca_whitening, rotation_range, width_shift_range,
            height_shift_range, shear_range, zoom_range, channel_shift_range,
            fill_mode, cval, horizontal_flip, vertical_flip, rescale,
            preprocessing_function, data_format)
示例#2
0
 def __init__(self, pre_process):
     ImageDataGenerator.__init__(self,
                                 height_shift_range=0.2,
                                 width_shift_range=0.2,
                                 shear_range=0.2,
                                 zoom_range=0.2,
                                 horizontal_flip=True,
                                 validation_split=0.1,
                                 rotation_range=30,
                                 preprocessing_function=pre_process)
示例#3
0
 def __init__(self):
     ImageDataGenerator.__init__(self,
                                 height_shift_range=0.3,
                                 width_shift_range=0.3,
                                 shear_range=0.2,
                                 zoom_range=0.2,
                                 horizontal_flip=True,
                                 validation_split=0.1,
                                 rotation_range=45,
                                 preprocessing_function=keras.applications.
                                 densenet.preprocess_input)
示例#4
0
    def __init__(self,
                 featurewise_center=False,
                 samplewise_center=False,
                 featurewise_std_normalization=False,
                 samplewise_std_normalization=False,
                 zca_whitening=False,
                 zca_epsilon=1e-6,
                 crop_size=(299, 299),
                 random_crop=False,
                 rotation_range=(0, 0),
                 rotation_offset=(0, 0),
                 translate_range=(0, 0),
                 zoom_range=(1, 1),
                 isotropic_zoom=True,
                 horizontal_flip=False,
                 vertical_flip=False,
                 rescale=None,
                 contrast_range=(1, 1),
                 brightness_range=(0, 0),
                 blurring_radius=0,
                 fillval=0,
                 preprocessing_function=None):

        ImageDataGenerator.__init__(
            self,
            featurewise_center,
            samplewise_center,
            featurewise_std_normalization,
            samplewise_std_normalization,
            zca_whitening,
            zca_epsilon,
            rotation_range,
            zoom_range=zoom_range,
            rescale=rescale,
            horizontal_flip=horizontal_flip,
            vertical_flip=vertical_flip,
            preprocessing_function=preprocessing_function)

        self.fillval = fillval
        self.crop_size = crop_size
        self.random_crop = random_crop
        self.rotation_offset = rotation_offset
        self.isotropic_zoom = isotropic_zoom
        self.translate_range = translate_range
        self.contrast_range = contrast_range
        self.brightness_range = brightness_range
        self.blurring_radius = blurring_radius
示例#5
0
    def __init__(self,
                 featurewise_center=False,
                 samplewise_center=False,
                 featurewise_std_normalization=False,
                 samplewise_std_normalization=False,
                 zca_whitening=False,
                 zca_epsilon=1e-6,
                 rotation_range=0.,
                 width_shift_range=0.,
                 height_shift_range=0.,
                 shear_range=0.,
                 zoom_range=0.,
                 channel_shift_range=0.,
                 fill_mode='nearest',
                 cval=0.,
                 horizontal_flip=False,
                 vertical_flip=False,
                 rescale=None,
                 preprocessing_function=None,
                 data_format=None,
                 crop_to=-1):

        ImageDataGenerator.__init__(
            self,
            featurewise_center=featurewise_center,
            samplewise_center=samplewise_center,
            featurewise_std_normalization=featurewise_std_normalization,
            samplewise_std_normalization=samplewise_std_normalization,
            zca_whitening=zca_whitening,
            zca_epsilon=zca_epsilon,
            rotation_range=rotation_range,
            width_shift_range=width_shift_range,
            height_shift_range=height_shift_range,
            shear_range=shear_range,
            zoom_range=zoom_range,
            channel_shift_range=channel_shift_range,
            fill_mode=fill_mode,
            cval=cval,
            horizontal_flip=horizontal_flip,
            vertical_flip=vertical_flip,
            rescale=rescale,
            preprocessing_function=preprocessing_function,
            data_format=data_format)

        self.crop_to = crop_to
示例#6
0
    def __init__(self, ImageDataGenerator, config):
        """ Set DataGenerator parameters.

        Args:
        ImageDataGenerator: ImageDataGenerator object from Keras
        config: dict

        """
        self.config = config
        ImageDataGenerator.__init__(self, ImageDataGenerator)
        self.xSamples = self.config['dataset']['xSamples']
        self.ySamples = self.config['dataset']['ySamples']
        self.num_freq = len(util.get_frequencies())
        self.factor = self.config['dataset']['factor']
        self.mask_generator = MaskGenerator(int(self.xSamples / self.factor),
                                            int(self.ySamples / self.factor),
                                            self.num_freq,
                                            rand_seed=7)
示例#7
0
    def __init__(self,
                 rot90=False,
                 gaussian_blur_range=None,
                 color_shift=None,
                 contrast_stretching=False,
                 histogram_equalization=False,
                 adaptive_equalization=False,
                 cut_out=None,
                 *args,
                 **kwargs):

        self.rot90 = rot90
        self.gaussian_blur_range = gaussian_blur_range
        self.color_shift = color_shift
        self.contrast_stretching = contrast_stretching
        self.histogram_equalization = histogram_equalization
        self.adaptive_equalization = adaptive_equalization
        self.cut_out = cut_out

        ImageDataGenerator.__init__(self, *args, **kwargs)
 def __init__ (self,images, targets, 
                 batch_size, keys=None,
                 rescale = 1./255,
                 horizontal_flip = True,
                 fill_mode = "nearest",
                 zoom_range = 0.05,
                 width_shift_range = 0,
                 height_shift_range=0,
                 rotation_range=10):
 
     ImageDataGenerator.__init__(self, 
             rescale = rescale,
             horizontal_flip = horizontal_flip,
             fill_mode = fill_mode,
             zoom_range = zoom_range,
             width_shift_range = width_shift_range,
             height_shift_range=height_shift_range,
             rotation_range=rotation_range)
     
     self.batch_size = batch_size
     
     if keys is None:
         self.keys = list(images.keys())
     else:
         self.keys=keys
     self.n_samples = len(self.keys)
     self.n = 0
     
     self.images=images
     self.targets={}
     self.fract = np.divide(input_shape,output_shape)
     for i,k in enumerate(images.keys()):
         self.targets[k] = np.zeros(output_shape+(len(targets[k]),))
         for j,l in enumerate(targets[k].keys()):
             for m in range(len(targets[k][l][0])):
                 val_x = int(targets[k][l][1][m]/self.fract[0])
                 val_y = int(targets[k][l][0][m]/self.fract[0])
                 self.targets[k][val_x-1:val_x+2,val_y-1:val_y+2,j]=1
                 
     self.X = np.empty((self.batch_size,)+self.images[k].shape)
     self.Y = np.zeros((self.batch_size,)+output_shape+(len(targets[k]),))
示例#9
0
 def __init__(self,args):
     ImageDataGenerator.__init__(self,
              args['featurewise_center'],
              args['samplewise_center'],
              args['featurewise_std_normalization'],
              args['samplewise_std_normalization'],
              args['zca_whitening'],
              args['rotation_range'],
              args['width_shift_range'],
              args['height_shift_range'],
              args['shear_range'],
              args['zoom_range'],
              args['channel_shift_range'],
              args['fill_mode'],
              args['cval'],
              args['horizontal_flip'],
              args['vertical_flip'],
              args['rescale' ],
              args['preprocessing_function'],
              args['data_format'])
    #Additional Params for this DataGenerator
     self.elastic_deformation=args['elastic_deformation']
 def __init__(self, **kwargs):
     ImageDataGenerator.__init__(self, **kwargs)
示例#11
0
 def __init__(self):
     ImageDataGenerator.__init__(self, rescale=1./255, shear_range= 0.2, zoom_range= 0.2, horizontal_flip=True, validation_split=0.1)
示例#12
0
 def __init__(self):
     ImageDataGenerator.__init__(self, rescale=1./255, height_shift_range=0.25, width_shift_range=0.25, shear_range= 0.2, zoom_range= 0.2,
                                 horizontal_flip=True, rotation_range = 30, validation_split=0.03)