Exemplo n.º 1
0
    def __call__(self, **data_dict):
        data = data_dict.get(self.data_key)

        ret_val = augment_channel_translation(data=data, const_channel=self.const_channel, max_shifts=self.max_shift)

        data_dict[self.data_key] = ret_val[0]

        return data_dict
    def __call__(self, **data_dict):
        data = data_dict.get(self.data_key)

        ret_val = augment_channel_translation(data=data, const_channel=self.const_channel, max_shifts=self.max_shift)

        data_dict[self.data_key] = ret_val[0]

        return data_dict
def channel_translation_generator(generator, const_channel=0, max_shifts=None):
    """
    Translates all channels within an instance of a batch according to randomly drawn shifts from within [-max_shift, max_shift].
    One channel is held constant, the others are shifted in the same manner.
    :param generator:
    :param const_channel:
    :param max_shifts:
    :return:
    """

    if max_shifts is None:
        max_shifts = {'z': 2, 'y': 2, 'x': 2}

    for data_dict in generator:
        data_dict["data"] = augment_channel_translation(data_dict["data"], const_channel, max_shifts)
        yield data_dict
Exemplo n.º 4
0
def channel_translation_generator(generator, const_channel=0, max_shifts=None):
    """
    Translates all channels within an instance of a batch according to randomly drawn shifts from within [-max_shift, max_shift].
    One channel is held constant, the others are shifted in the same manner.
    :param generator:
    :param const_channel:
    :param max_shifts:
    :return:
    """

    if max_shifts is None:
        max_shifts = {'z': 2, 'y': 2, 'x': 2}

    for data_dict in generator:
        data_dict["data"] = augment_channel_translation(
            data_dict["data"], const_channel, max_shifts)
        yield data_dict