コード例 #1
0
veri_dir = ScriptTestDataset(dir=args.train_dir,
                             loader=file_loader,
                             transform=transform_T,
                             return_uid=True)
veri_dir.partition(args.sample_utt)

test_dir = ScriptTestDataset(dir=args.test_dir,
                             loader=file_loader,
                             transform=transform_T,
                             return_uid=True)
test_dir.partition(args.sample_utt)

valid_dir = ScriptValidDataset(valid_set=train_dir.valid_set,
                               spk_to_idx=train_dir.spk_to_idx,
                               valid_uid2feat=train_dir.valid_uid2feat,
                               valid_utt2spk_dict=train_dir.valid_utt2spk_dict,
                               loader=file_loader,
                               transform=transform,
                               return_uid=True)
indices = list(range(len(valid_dir)))
random.shuffle(indices)
indices = indices[:args.sample_utt]
valid_part = torch.utils.data.Subset(valid_dir, indices)

# sitw_test_dir = SitwTestDataset(sitw_dir=args.sitw_dir, sitw_set='eval', transform=transform_T, return_uid=False)
# indices = list(range(len(sitw_test_dir)))
# random.shuffle(indices)
# indices = indices[:args.sample_utt]
# sitw_test_part = torch.utils.data.Subset(sitw_test_dir, indices)
#
# sitw_dev_dir = SitwTestDataset(sitw_dir=args.sitw_dir, sitw_set='dev', transform=transform_T, return_uid=False)
コード例 #2
0
transform = ConcateNumInput(num_frames=args.num_frames, remove_vad=args.remove_vad)

if args.feat_format == 'npy':
    file_loader = np.load
elif args.feat_format in ['kaldi', 'klfb']:
    file_loader = kaldi_io.read_mat

train_dir = ScriptTrainDataset(dir=args.data_dir, samples_per_speaker=args.input_per_spks, loader=file_loader,
                               transform=transform, num_valid=args.num_valid, domain=args.domain)
# train_dir = LoadScriptDataset(dir=args.data_dir, samples_per_speaker=args.input_per_spks, loader=file_loader,
#                                transform=transform, num_valid=args.num_valid, domain=args.domain)
>>>>>>> Server/Server

valid_dir = ScriptValidDataset(valid_set=train_dir.valid_set, loader=file_loader, spk_to_idx=train_dir.spk_to_idx,
                               dom_to_idx=train_dir.dom_to_idx, valid_utt2dom_dict=train_dir.valid_utt2dom_dict,
                               valid_uid2feat=train_dir.valid_uid2feat, valid_utt2spk_dict=train_dir.valid_utt2spk_dict,
                               transform=transform, domain=args.domain)

if __name__ == "__main__":
    np.random.seed(args.seed)
    torch.manual_seed(args.seed)
    random.seed(args.seed)
<<<<<<< HEAD

=======
>>>>>>> Server/Server
    nj = args.nj
    data_dir = args.data_dir
    out_dir = os.path.join(args.out_dir, args.out_set)

<<<<<<< HEAD