Exemplo n.º 1
0
    def __call__(self, results):
        """Call function.

        Args:
            results (dict): A dict containing the necessary information and
                data for augmentation.

        Returns:
            dict: A dict containing the processed data and information.
        """
        flip = np.random.random() < self.flip_ratio

        if flip:
            for key in self.keys:
                if isinstance(results[key], list):
                    for v in results[key]:
                        if key in ('bbox', 'bboxes'):
                            bboxflip_(v, self.direction, self.Len)
                        elif key in ('flow'):
                            flowflip_(v, self.direction)
                        else:
                            imflip_(v, self.direction)
                else:
                    if key in ('bbox', 'bboxes'):
                        bboxflip_(results[key], self.direction, self.Len)
                    elif key in ('flow'):
                        raise NotImplementedError(
                            "not implemented flow for just one frame")
                    else:
                        imflip_(results[key], self.direction)

        results['flip'] = flip
        results['flip_direction'] = self.direction

        return results
Exemplo n.º 2
0
    def __call__(self, results):
        """Call function.

        Args:
            results (dict): A dict containing the necessary information and
                data for augmentation.

        Returns:
            dict: A dict containing the processed data and information.
        """
        flip = np.random.random() < self.flip_ratio

        if flip:
            for key in self.keys:
                if isinstance(results[key], list):
                    for v in results[key]:
                        imflip_(v, self.direction)
                else:
                    imflip_(results[key], self.direction)

        results['flip'] = flip
        results['flip_direction'] = self.direction

        return results