def create_dataset(self, mode): # set directory for different modes and create respective datasets if mode == 'train': s_list = os.path.join(self.datapath, 'CM_protocol/cm_train.trn') t = 15000 elif mode == 'dev': s_list = os.path.join(self.datapath, 'CM_protocol/cm_develop.ndx') t = 10000 elif mode == 'test': s_list = os.path.join(self.datapath, 'CM_protocol/cm_evaluation.ndx') t = 10000 else: print('Invalid mode! specify one of train, dev, test.') f = (self.sr, self.frame_size, self.frame_shift) DLoad = Dataloader(file_dir=os.path.join(self.datapath, 'wav'), speaker_list=s_list, f_param=f, thresh=t) DLoad.create_dataset() return DLoad
parser.add_argument('-samples', type=int, default=100, help="sampling") parser.add_argument('-n_samples', type=int, default=50, help="train or test images") parser.add_argument('-d_output', type=int, default=2, help="dimension of model ouput") parser.add_argument('-batch_size', type=int, default=64, help="dimension of model ouput") parser.add_argument('-n_filter', type=int, default=3, help="dimension of model ouput") parser.add_argument('-model', type=str, default="point", help="training model") parser.add_argument('-testpath', type=str, default="test.tfrecord", help="test path") parser.add_argument('-tfrecordpath', type=str, default="train.tfrecord", help="dimension of model ouput") parser.add_argument('-actv', type=str, default="relu", help="dimension of model ouput") args = parser.parse_args() dataloader = Dataloader(args) if __name__ == "__main__": dataset = dataloader.create_dataset() optimizer = tf.train.AdamOptimizer(args.lr) model_path = "{}_l_{}_b_{}_f_{}.h5".format(args.model, args.lr, args.batch_size, args.n_filter) log_path = "{}".format(args.model) if not os.path.exists(log_path): os.mkdir(log_path) callbacks = [ModelCheckpoint(filepath=model_path, save_best_only=True, monitor='loss', verbose=2, save_weights_only=True), TensorBoard(log_dir=log_path)]