def make_tuning_loader(manifest_file, manifest_root, backend_obj): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct=20) aeon_config['shuffle_manifest'] = True return wrap_dataloader(AeonDataLoader(aeon_config))
def make_validation_loader(manifest_file, manifest_root, backend_obj, subset_pct=100): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct) return wrap_dataloader(AeonDataLoader(aeon_config))
def build_dataloader(config, frcn_rois_per_img): """ Builds the dataloader for the Faster-RCNN network using our aeon loader. Besides, the base loader, we add several operations: 1. Cast the image data into float32 format 2. Subtract the BGRMean from the image. We used pre-defined means from training the VGG network. 3. Repack the data for Faster-RCNN model. This model has several nested branches, so The buffers have to repacked into nested tuples to match the branch leafs. Additionally, buffers for training the RCNN portion of the model are also allocated and provisioned to the model. Arguments: config (dict): dataloader configuration be (backend): compute backend frcn_rois_per_img (int): Number of ROIs to use for training the RCNN portion of the model. This is used to create the target buffers for RCNN. Returns: dataloader object. """ dl = AeonDataLoader(config) dl = TypeCast(dl, index=0, dtype=np.float32) # cast image to float dl = BGRMeanSubtract(dl, index=0, pixel_mean=util.FRCN_PIXEL_MEANS) # subtract means dl = ObjectLocalization( dl, frcn_rois_per_img=frcn_rois_per_img) # repack faster-rcnn return dl
def make_test_loader(manifest_file, manifest_root, backend_obj): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['type'] = 'audio' # No labels provided aeon_config.pop('label', None) dl = AeonDataLoader(aeon_config, backend_obj) dl = TypeCast(dl, index=0, dtype=np.float32) return dl
def make_inference_loader(manifest_file, backend_obj): manifest_root = "" # This is used for demo script which generates abs path manifest aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['type'] = 'video' # No labels provided aeon_config.pop('label', None) dl = AeonDataLoader(aeon_config, backend_obj) dl = TypeCast(dl, index=0, dtype=np.float32) return dl
def make_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_enable'] = True aeon_config['random_seed'] = random_seed aeon_config['augmentation'][0]['center'] = True aeon_config['augmentation'][0]['flip_enable'] = False return wrap_dataloader(AeonDataLoader(aeon_config))
def make_test_loader(manifest_file, manifest_root, backend_obj, subset_pct=100): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['subset_fraction'] = float(subset_pct / 100.0) dl = AeonDataLoader(aeon_config, backend_obj) dl = OneHot(dl, index=1, nclasses=101) dl = TypeCast(dl, index=0, dtype=np.float32) return dl
def make_tuning_loader(manifest_file, manifest_root, backend_obj, dtype=np.float32): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct=10) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_every_epoch'] = True return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj), dtype)
def validation_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, h=96, w=96, scale=[1., 1.], ncls=10): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct, h, w, scale) aeon_config['image']['center'] = True return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj), ncls=ncls)
def make_train_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_every_epoch'] = True aeon_config['random_seed'] = random_seed aeon_config['image']['center'] = False aeon_config['image']['flip_enable'] = True return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj))
def make_inference_loader(manifest_file, backend_obj): manifest_root = "" # This is used for demo script which generates abs path manifest aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) video_config = { "type": "video", "max_frame_count": 16, "frame": { "height": 112, "width": 112 } } aeon_config['etl'] = [video_config] dl = AeonDataLoader(aeon_config) dl = TypeCast(dl, index=0, dtype=np.float32) return dl
def make_alexnet_train_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0, dtype=np.float32): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_enable'] = True aeon_config['random_seed'] = random_seed aeon_config['augmentation'][0]["center"] = False aeon_config['augmentation'][0]["flip_enable"] = True return wrap_dataloader(AeonDataLoader(aeon_config))
def make_train_loader(manifest_file, manifest_root, backend_obj, noise_file=None, random_seed=0): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_enable'] = True aeon_config['random_seed'] = random_seed if noise_file is not None: aeon_config['augmentation'] = [] aeon_config['augmentation'].append(dict()) aeon_config['augmentation'][0]['type'] = "audio" aeon_config['augmentation'][0]['noise_index_file'] = noise_file aeon_config['augmentation'][0]['noise_root'] = os.path.dirname(noise_file) aeon_config['augmentation'][0]['add_noise_probability'] = 0.5 aeon_config['augmentation'][0]['noise_level'] = (0.0, 0.5) return wrap_dataloader(AeonDataLoader(aeon_config))
def make_train_loader(manifest_file, manifest_root, backend_obj, noise_file=None, random_seed=0): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_every_epoch'] = True aeon_config['random_seed'] = random_seed if noise_file is not None: aeon_config['audio']['noise_index_file'] = noise_file aeon_config['audio']['noise_root'] = manifest_root aeon_config['audio']['add_noise_probability'] = 0.5 aeon_config['audio']['noise_level'] = [0.0, 0.5] return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj))
def make_train_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) aeon_config['subset_fraction'] = float(subset_pct / 100.0) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_every_epoch'] = True aeon_config['random_seed'] = random_seed aeon_config['video']['frame']['center'] = False aeon_config['video']['frame']['flip_enable'] = True dl = AeonDataLoader(aeon_config, backend_obj) dl = OneHot(dl, index=1, nclasses=101) dl = TypeCast(dl, index=0, dtype=np.float32) return dl
def train_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0, h=96, w=96, scale=[1., 1.], binary=False): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct, h, w, scale) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_every_epoch'] = True aeon_config['random_seed'] = random_seed aeon_config['image']['center'] = False aeon_config['image']['flip_enable'] = True aeon_config['label']['binary'] = binary # return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj)) return AeonDataLoader(aeon_config, backend_obj)
def make_msra_train_loader(manifest_file, manifest_root, backend_obj, subset_pct=100, random_seed=0, dtype=np.float32): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz, subset_pct) aeon_config['shuffle_manifest'] = True aeon_config['shuffle_enable'] = True aeon_config['random_seed'] = random_seed aeon_config['augmentation'][0]["center"] = False aeon_config['augmentation'][0]["flip_enable"] = True aeon_config['augmentation'][0]['scale'] = [0.08, 1.0] aeon_config['augmentation'][0]['do_area_scale'] = True aeon_config['augmentation'][0]['horizontal_distortion'] = [0.75, 1.33] aeon_config['augmentation'][0]['lighting'] = [0.0, 0.01] aeon_config['augmentation'][0]['contrast'] = [0.9, 1.1] aeon_config['augmentation'][0]['brightness'] = [0.9, 1.1] aeon_config['augmentation'][0]['saturation'] = [0.9, 1.1] return wrap_dataloader(AeonDataLoader(aeon_config))
def make_val_loader(manifest_file, manifest_root, backend_obj): aeon_config = common_config(manifest_file, manifest_root, backend_obj.bsz) return wrap_dataloader(AeonDataLoader(aeon_config, backend_obj))
def make_loader(manifest_file, alphabet, nbands, max_tscrpt_len, max_utt_len, backend_obj): aeon_config = common_config(manifest_file, backend_obj.bsz, alphabet, nbands, max_tscrpt_len, max_utt_len) return wrap_dataloader(AeonDataLoader(aeon_config))
def wrap_dataloader(aeon_config): dl = AeonDataLoader(aeon_config) dl = OneHot(dl, index=1, nclasses=101) dl = TypeCast(dl, index=0, dtype=np.float32) return dl