Esempio n. 1
0
    def __init__(self,
                 data_path,
                 config=None,
                 datatype="categorical",
                 training=True):
        """__init__.

        Args:
            data_path: Dataset Path which should be in structure way
            please see readme file for more details on structuring.
            config: Config file , a dict file contains all required attributes
            to configure.
            datatype: Dataset Type i.e (Bbox , Labels ,Segmentations)
            bbox dataset is object detection dataset which will be provided in
            form of [image,bboxs] or [image, class_targets,bbox_targets].
            training: is pipeline in training mode or not?
        """

        # bunch the config dict.
        config = Bunch(config)
        if not isinstance(data_path, str):
            msg = f"datapath should be str but pass {type(data_path)}."
            logging.error(msg)
            raise TypeError("Only str allowed")

        self._datatype = datatype
        self._data_path = data_path
        self.config = config
        self._training = training
        self._shuffle_buffer = None
        self._batch_size = self.config.get("batch_size", 32)
        self._image_size = self.config.get("image_size", [512, 512])
        self._drop_remainder = self.config.get("drop_remainder", True)
        self.augmenter = augment.Augment(self.config, datatype)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Create an Augmentation pipeline !
        config = {
            "batch_size": 1,
            "image_size": [512, 512],
            "transformations": {
                "flip_left_right": None,
                "gridmask": None,
                "random_rotate": None,
            },
            "categorical_encoding": "labelencoder",
        }
        config = Bunch(config)

        self.augmentor = augment.Augment(config)
        tf.compat.v1.random.set_random_seed(111111)