本文整理汇总了Python中utils.util.mkdir方法的典型用法代码示例。如果您正苦于以下问题:Python util.mkdir方法的具体用法?Python util.mkdir怎么用?Python util.mkdir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.util
的用法示例。
在下文中一共展示了util.mkdir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from utils import util [as 别名]
# 或者: from utils.util import mkdir [as 别名]
def main():
args = parser.parse_args()
htk_save_path = mkdir(args.htk_save_path)
path = Path(data_path=args.data_path, config_path='./config')
# HTK settings
save_config(audio_file_type='wav',
feature_type=args.feature_type,
channels=args.channels,
config_save_path='./config',
sampling_rate=16000,
window=args.window,
slide=args.slide,
energy=bool(args.energy),
delta=bool(args.delta),
deltadelta=bool(args.deltadelta))
data_types = ['eval1', 'eval2', 'eval3']
if bool(args.subset):
data_types += ['train_subset']
if bool(args.fullset):
data_types += ['train_fullset']
for data_type in data_types:
wav_paths = path.wav(data_type=data_type)
save_path = mkdir_join(htk_save_path, data_type)
with open('./config/wav2htk_' + data_type + '.scp', 'w') as f:
for wav_path in wav_paths:
speaker = basename(wav_path).split('.')[0]
save_path_tmp = join(save_path, speaker + '.htk')
f.write(wav_path + ' ' + save_path_tmp + '\n')
示例2: initialize
# 需要导入模块: from utils import util [as 别名]
# 或者: from utils.util import mkdir [as 别名]
def initialize(self, opt, **kwargs):
self.gpu_ids = opt.gpu_ids
self.isTrain = opt.isTrain
self.ImgTensor = torch.cuda.FloatTensor if self.gpu_ids else torch.Tensor
self.LblTensor = torch.cuda.FloatTensor if self.gpu_ids else torch.Tensor
self.save_dir = opt.save_dir; mkdir(self.save_dir)
示例3: main
# 需要导入模块: from utils import util [as 别名]
# 或者: from utils.util import mkdir [as 别名]
def main():
args = parser.parse_args()
htk_save_path = mkdir(args.htk_save_path)
# HTK settings
save_config(audio_file_type='wav',
feature_type=args.feature_type,
channels=args.channels,
config_save_path='./config',
sampling_rate=16000,
window=args.window,
slide=args.slide,
energy=bool(args.energy),
delta=bool(args.delta),
deltadelta=bool(args.deltadelta))
# NOTE: 120-dim features are extracted by default
parts = ['train-clean-100', 'dev-clean', 'dev-other',
'test-clean', 'test-other']
if bool(args.large):
parts += ['train-clean-360', 'train-other-500']
elif bool(args.medium):
parts += ['train-clean-360']
for part in parts:
# part/speaker/book/*.wav
wav_paths = [p for p in glob(join(args.data_path, part, '*/*/*.wav'))]
with open('./config/wav2htk_' + part + '.scp', 'w') as f:
for wav_path in wav_paths:
# ex.) wav_path: speaker/book/speaker-book-utt_index.wav
speaker, book, utt_index = basename(
wav_path).split('.')[0].split('-')
save_path = mkdir_join(
htk_save_path, part, speaker, book, basename(wav_path).split('.')[0] + '.htk')
f.write(wav_path + ' ' + save_path + '\n')
# ex.) htk_path: speaker/book/speaker-book-utt_index.htk
示例4: main
# 需要导入模块: from utils import util [as 别名]
# 或者: from utils.util import mkdir [as 别名]
def main():
args = parser.parse_args()
htk_save_path = mkdir(args.htk_save_path)
path = Path(data_path=args.data_path,
config_path=args.config_path)
# HTK settings
save_config(audio_file_type='nist',
feature_type=args.feature_type,
channels=args.channels,
config_save_path='./config',
sampling_rate=16000,
window=args.window,
slide=args.slide,
energy=bool(args.energy),
delta=bool(args.delta),
deltadelta=bool(args.deltadelta))
# NOTE: 123-dim features are extracted by default
for data_type in ['train', 'dev', 'test']:
wav_paths = path.wav(data_type=data_type)
save_path = mkdir_join(htk_save_path, data_type)
with open('./config/wav2htk_' + data_type + '.scp', 'w') as f:
for wav_path in wav_paths:
speaker = wav_path.split('/')[-2]
utt_index = basename(wav_path).split('.')[0]
save_path_tmp = mkdir_join(
save_path, speaker, utt_index + '.htk')
f.write(wav_path + ' ' + save_path_tmp + '\n')
示例5: main
# 需要导入模块: from utils import util [as 别名]
# 或者: from utils.util import mkdir [as 别名]
def main():
args = parser.parse_args()
htk_save_path = mkdir(args.htk_save_path)
# HTK settings
save_config(audio_file_type='wav',
feature_type=args.feature_type,
channels=args.channels,
config_save_path='./config',
sampling_rate=8000,
window=args.window,
slide=args.slide,
energy=bool(args.energy),
delta=bool(args.delta),
deltadelta=bool(args.deltadelta))
# NOTE: 120-dim features are extracted by default
# Switchboard
with open('./config/wav2htk_swbd.scp', 'w') as f:
for wav_path in glob(join(args.wav_save_path, 'swbd/*.wav')):
# ex.) wav_path: wav/swbd/*.wav
save_path = mkdir_join(
htk_save_path, 'swbd', basename(wav_path).split('.')[0] + '.htk')
f.write(wav_path + ' ' + save_path + '\n')
# ex.) htk_path: wav/swbd/*.htk
# eval2000 (swbd)
with open('./config/wav2htk_eval2000_swbd.scp', 'w') as f:
for wav_path in glob(join(args.wav_save_path, 'eval2000/swbd/*.wav')):
# ex.) wav_path: wav/eval2000_swbd/*.wav
save_path = mkdir_join(
htk_save_path, 'eval2000', 'swbd', basename(wav_path).split('.')[0] + '.htk')
f.write(wav_path + ' ' + save_path + '\n')
# ex.) htk_path: wav/eval2000/swbd/*.htk
# eval2000 (callhome)
with open('./config/wav2htk_eval2000_ch.scp', 'w') as f:
for wav_path in glob(join(args.wav_save_path, 'eval2000/callhome/*.wav')):
# ex.) wav_path: wav/eval2000_ch/*.wav
save_path = mkdir_join(
htk_save_path, 'eval2000', 'callhome', basename(wav_path).split('.')[0] + '.htk')
f.write(wav_path + ' ' + save_path + '\n')
# ex.) htk_path: wav/eval2000/callhome/*.htk
# Fisher
if bool(args.fisher):
with open('./config/wav2htk_fisher.scp', 'w') as f:
for wav_path in glob(join(args.wav_save_path, 'fisher/*/*.wav')):
# ex.) wav_path: wav/fisher/speaker/*.wav
speaker = wav_path.split('/')[-2]
save_path = mkdir_join(
htk_save_path, 'fisher', speaker, basename(wav_path).split('.')[0] + '.htk')
f.write(wav_path + ' ' + save_path + '\n')
# ex.) htk_path: wav/fisher/speaker/*.htk