def __init__(self): io_kernel = { RGB: ArrayType([None, 1]), GRAY: ArrayType([None, 1]), } super().__init__(io_kernel)
def __init__(self, output_dir, base_filename='image.png', return_type='filename'): assert isinstance(output_dir, str), "'output_dir' must be str" assert isinstance(base_filename, str), "'base_filename' must be str" assert return_type in ['filename','datum'],\ "'return_type' must be one of ['filename','datum']" if not os.path.exists(output_dir): os.makedirs(output_dir) self.output_dir = output_dir self.base_filename = base_filename self.return_type = return_type self.image_number = 0 self.batch_dirs = [] self.batch_index = 0 io_map = { ArrayType([None, None, 3]): ArrayType([None, None, 3]), ArrayType([None, None]): ArrayType([None, None]) } super(WriterBlock, self).__init__(io_map, requires_training=False, requires_labels=False)
def __init__(self,cut_off,filter_type='ideal',butterworth_order=1): self.cut_off = cut_off self.filter_type = filter_type self.butterworth_order = butterworth_order io_map = { ArrayType([None,None]):ArrayType([None,None]), ArrayType([None,None,None]):ArrayType([None,None,None]) } super(Lowpass,self).__init__(io_map, requires_training=False)
def __init__(self): io_map = { ArrayType([None, None], [None, None, 3]): ArrayType([None, None, 3]), # ArrayType([None,None],[None,None,3]): # ArrayType([None,None,3]), # ArrayType([None,None],[None,None,3]): # ArrayType([None,None,3]) } super(Gray2Color, self).__init__(io_map, requires_training=False)
def __init__( self, neurons=512, dropout=0.5, num_hidden=1, learning_rate=0.01, decay=1e-6, momentum=0.9, batch_size=128, label_type='integer', validation=0.0, num_epochs=1, ): assert isinstance(neurons, (float, int)),\ "neurons must be a float or int" assert isinstance(num_hidden, (float, int)),\ "num_hidden must be a float or int" assert isinstance(dropout, (float, int)),\ "dropout must be a float or int" assert isinstance(learning_rate, (float, int)),\ "learning_rate must be a float or int" assert isinstance(decay, (float, int)),\ "decay must be a float or int" assert isinstance(momentum, (float, int)),\ "momentum must be a float or int" assert isinstance(batch_size, (float, int)),\ "batch_size must be a float or int" assert label_type in ['integer', 'categorical'],\ "acceptable label_types are ['integer','categorical']" assert isinstance(validation, (float, int)),\ "validation must be a float or int" assert isinstance(num_epochs, (float, int)),\ "num_epochs must be an int" self.neurons = int(neurons) self.dropout = float(dropout) self.num_hidden = int(num_hidden) self.learning_rate = float(learning_rate) self.decay = float(decay) self.momentum = float(momentum) self.batch_size = int(batch_size) self.label_type = label_type self.validation = float(validation) self.num_epochs = int(num_epochs) if self.label_type == 'integer': io_map = {ArrayType([1, None]): int} else: io_map = {ArrayType([1, None]): ArrayType([None], dtypes=np.int32)} super(MultilayerPerceptron, self).__init__(io_map, requires_training=True, requires_labels=True)
def __init__(self, n_keypoints=100): if not isinstance(n_keypoints, (int, float)): error_msg = "'n_keypoints' must be int" self.logger.error(error_msg) raise TypeError(error_msg) self.n_keypoints = int(n_keypoints) self.orb = cv2.ORB_create(self.n_keypoints) io_map = {ArrayType([None, None]): ArrayType([self.n_keypoints, 32])} super(Orb, self).__init__(io_map, requires_training=False)
def __init__(self, n_components, random_state=None): assert isinstance(n_components,(int,float)),\ "n_components must be an integer" self.n_components = int(n_components) self.random_state = random_state io_map = {ArrayType([1, None]): ArrayType([1, self.n_components])} super(PCA, self).__init__( io_map, requires_training=True, requires_labels=False, )
def __init__(self, to_height, to_width, interpolation=cv2.INTER_NEAREST): self.to_height = to_height self.to_width = to_width self.interpolation = interpolation io_map = { ArrayType([None, None]): ArrayType([self.to_height, self.to_width]), ArrayType([None, None, 3]): ArrayType([self.to_height, self.to_width, 3]) } super(Resizer, self).__init__(io_map, requires_training=False)
def __init__(self, min=0, max=255): self.min = min self.max = max io_map = { # ArrayType([None,None]):ArrayType([None,None]), # ArrayType([None,None,3]):ArrayType([None,None,3]), ArrayType([None, None]): ArrayType([None, None]), ArrayType([None, None, 3]): ArrayType([None, None, 3]), } super(Otsu, self).__init__(io_map, requires_training=False)
def __init__(self, device=0, fourcc='MJPG', mode='count'): #JM: error checking for these values will occur in io.CameraCapture self.device = device self.fourcc = fourcc assert mode in ['count', 'time'], "mode must set to 'time' or 'count'" self.mode = mode io_map = { int: ArrayType([None, None], [None, None, 3]), float: ArrayType([None, None], [None, None, 3]), } self.cap = CameraCapture(self.device, self.fourcc) super(CameraBlock, self).__init__(io_map, requires_training=False)
def __init__(self, network='densenet121', pooling_type='avg'): self.network = network self.pooling_type = pooling_type # building the keras network self.model_fn, self.preprocess_fn, self.min_input_size, output_shape\ = self._keras_importer(network,pooling_type) io_map = { ArrayType([None, None], [None, None, 3]): ArrayType([1, output_shape]) } name = "Pretrained" + self.network[0].upper() + self.network[1:] super(PretrainedNetwork, self).__init__(io_map, name=name, requires_training=False)
def __init__(self, term): assert isinstance(term, (int, float, np.ndarray)) # forceably convert term to a float so integer datum # will consistently be a float if isinstance(term, int): term = float(term) self.term = term io_map = {ArrayType(): Same(), int: float, float: float} super(Subtract, self).__init__(io_map)
def __init__(self, order='rgb'): if order == 'rgb': self.flag = cv2.COLOR_RGB2GRAY elif order == 'bgr': self.flag = cv2.COLOR_BGR2GRAY else: raise ValueError("unknown channel order, must be 'rgb' or 'bgr'") self.order = order io_map = { ArrayType([None, None], [None, None, 3]): ArrayType([None, None]), # ArrayType([None,None],[None,None,3]): # ArrayType([None,None]), # ArrayType([None,None],[None,None,3]): # ArrayType([None,None]) } super(Color2Gray, self).__init__(io_map, requires_training=False)
def __init__(self, kernel, C=1): assert kernel in ['linear', 'poly', 'rbf', 'sigmoid'],\ "kernel must be one of ['linear', 'poly', 'rbf', 'sigmoid']" assert isinstance(C, (int, float)), "C must be a float or integer" self.kernel = kernel self.C = float(C) io_map = {ArrayType([1, None]): int} super(SupportVectorMachine, self).__init__(io_map, requires_training=True, requires_labels=True)
def __init__(self): io_map = { ArrayType([None, None]): ArrayType([None, None]), ArrayType([None, None, None]): ArrayType([None, None, None]), } super(FFT, self).__init__(io_map, requires_training=False)
def __init__(self, a=0, b=1): self.a = a self.b = b io_map = {ArrayType(): Same()} super(Normalize, self).__init__(io_map)
def __init__(self, discard_imaginary=True): self.discard_imaginary = discard_imaginary io_map = {ArrayType([None,None]):ArrayType([None,None]), ArrayType([None,None,None]):ArrayType([None,None,None]), } super(IFFT,self).__init__(io_map, requires_training=False)
def __init__(self): io_map = {str: ArrayType([None, None], [None, None, 3])} notes = "loads images from disk given an input filename" super(ImageLoader, self).__init__(io_map, notes=notes, requires_training=False)
def __init__(self): io_kernel = {ArrayType() : io.IOBase} super().__init__(io_kernel, requires_labels=False, requires_training=False)
def __init__(self): self.term = term io_map = {ArrayType(): ArrayType([None])} super(Flatten, self).__init__(io_map)