def create_new_dataset(self, new_dataset_conf):
     """
     Build new dataset and respective TFRecord(s).
     Args:
         new_dataset_conf: A dictionary containing the following keys:
             one of the following:
                 - relative_labels
                 - from_xml
                 - adjusted_frame
                 - coordinate_labels(optional)
             and:
                 - sequences
                 - workers(optional, defaults to 32)
                 - batch_size(optional, defaults to 64)
                 - new_size(optional, defaults to None)
     Returns:
         None
     """
     default_logger.info(f'Generating new dataset ...')
     test_size = new_dataset_conf.get('test_size')
     labels_frame = self.generate_new_frame(new_dataset_conf)
     save_tfr(
         labels_frame,
         os.path.join('..', 'Data', 'TFRecords'),
         new_dataset_conf['dataset_name'],
         test_size,
         self,
     )
示例#2
0
 def create_new_dataset(self, new_dataset_conf):
     """
     Create a new TFRecord dataset.
     Args:
         new_dataset_conf: A dictionary containing the following keys:
             - dataset_name(required) str representing a name for the dataset
             - test_size(optional) ex: 0.1
             - augmentation(optional) True or False
             - sequences(required if augmentation is True)
             - aug_workers(optional if augmentation is True) defaults to 32.
             - aug_batch_size(optional if augmentation is True) defaults to 64.
             And one of the following is required:
                 - relative_labels: Path to csv file with the following columns:
                 ['Image', 'Object Name', 'Object Index', 'bx', 'by', 'bw', 'bh']
                 - coordinate_labels: Path to csv file with the following columns:
                 ['Image Path', 'Object Name', 'Image Width', 'Image Height',
                 'X_min', 'Y_min', 'X_max', 'Y_max', 'Relative Width', 'Relative Height',
                 'Object ID']
                 - from_xml: True or False to parse from XML Labels folder.
     """
     default_logger.info(f'Generating new dataset ...')
     test_size = new_dataset_conf.get('test_size')
     labels_frame = self.generate_new_frame(new_dataset_conf)
     save_tfr(
         labels_frame,
         os.path.join('..', 'Data', 'TFRecords'),
         new_dataset_conf['dataset_name'],
         test_size,
         self,
     )