當前位置: 首頁>>代碼示例>>Python>>正文


Python util.mkdir方法代碼示例

本文整理匯總了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') 
開發者ID:hirofumi0810,項目名稱:asr_preprocessing,代碼行數:36,代碼來源:make_config.py

示例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) 
開發者ID:ozan-oktay,項目名稱:Attention-Gated-Networks,代碼行數:8,代碼來源:base_model.py

示例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 
開發者ID:hirofumi0810,項目名稱:asr_preprocessing,代碼行數:40,代碼來源:make_config.py

示例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') 
開發者ID:hirofumi0810,項目名稱:asr_preprocessing,代碼行數:34,代碼來源:make_config.py

示例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 
開發者ID:hirofumi0810,項目名稱:asr_preprocessing,代碼行數:57,代碼來源:make_config.py


注:本文中的utils.util.mkdir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。