本文整理匯總了Python中utils.str2bool方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.str2bool方法的具體用法?Python utils.str2bool怎麽用?Python utils.str2bool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils
的用法示例。
在下文中一共展示了utils.str2bool方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: parse_args
# 需要導入模塊: import utils [as 別名]
# 或者: from utils import str2bool [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Demo for LEDNet from a given image')
parser.add_argument('--input-pic', type=str, default=os.path.join(cur_path, 'png/demo.png'),
help='path to the input picture')
parser.add_argument('--pretrained', type=str,
default=os.path.expanduser('~/cbb/own/pretrained/seg/lednet/LEDNet_final.pth'),
help='Default Pre-trained model root.')
parser.add_argument('--cuda', type=ptutil.str2bool, default='true',
help='demo with GPU')
opt = parser.parse_args()
return opt
示例2: parse_args
# 需要導入模塊: import utils [as 別名]
# 或者: from utils import str2bool [as 別名]
def parse_args():
parser = argparse.ArgumentParser(description='Eval Segmentation.')
parser.add_argument('--batch-size', type=int, default=1,
help='Training mini-batch size')
parser.add_argument('--num-workers', '-j', dest='num_workers', type=int,
default=4, help='Number of data workers')
parser.add_argument('--dataset', type=str, default='citys',
help='Select dataset.')
parser.add_argument('--split', type=str, default='val',
help='Select val|test, evaluate in val or test data')
parser.add_argument('--mode', type=str, default='testval',
help='Select testval|val, w/o corp and with crop')
parser.add_argument('--base-size', type=int, default=1024,
help='base image size')
parser.add_argument('--crop-size', type=int, default=768,
help='crop image size')
parser.add_argument('--pretrained', type=str,
default='./LEDNet_iter_073600.pth',
help='Default Pre-trained model root.')
# device
parser.add_argument('--cuda', type=ptutil.str2bool, default='true',
help='Training with GPUs.')
parser.add_argument('--local_rank', type=int, default=0)
parser.add_argument('--init-method', type=str, default="env://")
args = parser.parse_args()
return args
示例3: main
# 需要導入模塊: import utils [as 別名]
# 或者: from utils import str2bool [as 別名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--log_dir', default='logdir-tacotron')
parser.add_argument('--data_paths', default='.\\data\\moon,.\\data\\son')
parser.add_argument('--load_path', default=None) # 아래의 'initialize_path'보다 우선 적용
#parser.add_argument('--load_path', default='logdir-tacotron/moon+son_2018-12-25_19-03-21')
parser.add_argument('--initialize_path', default=None) # ckpt로 부터 model을 restore하지만, global step은 0에서 시작
parser.add_argument('--batch_size', type=int, default=32)
parser.add_argument('--num_test_per_speaker', type=int, default=2)
parser.add_argument('--random_seed', type=int, default=123)
parser.add_argument('--summary_interval', type=int, default=100000)
parser.add_argument('--test_interval', type=int, default=500) # 500
parser.add_argument('--checkpoint_interval', type=int, default=2000) # 2000
parser.add_argument('--skip_path_filter', type=str2bool, default=False, help='Use only for debugging')
parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.')
parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') # The store_true option automatically creates a default value of False.
config = parser.parse_args()
config.data_paths = config.data_paths.split(",")
setattr(hparams, "num_speakers", len(config.data_paths))
prepare_dirs(config, hparams)
log_path = os.path.join(config.model_dir, 'train.log')
infolog.init(log_path, config.model_dir, config.slack_url)
tf.set_random_seed(config.random_seed)
print(config.data_paths)
if any("krbook" not in data_path for data_path in config.data_paths) and hparams.sample_rate != 20000:
warning("Detect non-krbook dataset. May need to set sampling rate from {} to 20000".format(hparams.sample_rate))
if any('LJ' in data_path for data_path in config.data_paths) and hparams.sample_rate != 22050:
warning("Detect LJ Speech dataset. Set sampling rate from {} to 22050".format(hparams.sample_rate))
if config.load_path is not None and config.initialize_path is not None:
raise Exception(" [!] Only one of load_path and initialize_path should be set")
train(config.model_dir, config)
示例4: main
# 需要導入模塊: import utils [as 別名]
# 或者: from utils import str2bool [as 別名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--log_dir', default='logdir-tacotron2')
parser.add_argument('--data_paths', default='D:\\hccho\\Tacotron-Wavenet-Vocoder-hccho\\data\\moon,D:\\hccho\\Tacotron-Wavenet-Vocoder-hccho\\data\\son')
#parser.add_argument('--data_paths', default='D:\\hccho\\Tacotron-Wavenet-Vocoder-hccho\\data\\small1,D:\\hccho\\Tacotron-Wavenet-Vocoder-hccho\\data\\small2')
#parser.add_argument('--load_path', default=None) # 아래의 'initialize_path'보다 우선 적용
parser.add_argument('--load_path', default='logdir-tacotron2/moon+son_2019-03-01_10-35-44')
parser.add_argument('--initialize_path', default=None) # ckpt로 부터 model을 restore하지만, global step은 0에서 시작
parser.add_argument('--batch_size', type=int, default=32)
parser.add_argument('--num_test_per_speaker', type=int, default=2)
parser.add_argument('--random_seed', type=int, default=123)
parser.add_argument('--summary_interval', type=int, default=100)
parser.add_argument('--test_interval', type=int, default=500) # 500
parser.add_argument('--checkpoint_interval', type=int, default=2000) # 2000
parser.add_argument('--skip_path_filter', type=str2bool, default=False, help='Use only for debugging')
parser.add_argument('--slack_url', help='Slack webhook URL to get periodic reports.')
parser.add_argument('--git', action='store_true', help='If set, verify that the client is clean.') # The store_true option automatically creates a default value of False.
config = parser.parse_args()
config.data_paths = config.data_paths.split(",")
setattr(hparams, "num_speakers", len(config.data_paths))
prepare_dirs(config, hparams)
log_path = os.path.join(config.model_dir, 'train.log')
infolog.init(log_path, config.model_dir, config.slack_url)
tf.set_random_seed(config.random_seed)
print(config.data_paths)
if config.load_path is not None and config.initialize_path is not None:
raise Exception(" [!] Only one of load_path and initialize_path should be set")
train(config.model_dir, config)