1 Star 0 Fork 0

pauleta/ChaLearn_liveness_challenge

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
a.parkin 提交于 2019-03-09 18:47 . init commit
import argparse,json,random,os
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torchvision as tv
from trainer import Model
from opts import get_opts
def main():
# Load options
parser = argparse.ArgumentParser(description='Attribute Learner')
parser.add_argument('--config', type=str, help = 'Path to config .opt file. Leave blank if loading from opts.py')
conf = parser.parse_args()
opt = torch.load(conf.config) if conf.config else get_opts()
print('===Options==')
d=vars(opt)
for k in d.keys():
print(k,':',d[k])
# Fix seed
random.seed(opt.manual_seed)
np.random.seed(opt.manual_seed)
torch.manual_seed(opt.manual_seed)
torch.cuda.manual_seed_all(opt.manual_seed)
cudnn.benchmark = True
# Create working directories
try:
os.makedirs(opt.out_path)
os.makedirs(os.path.join(opt.out_path,'checkpoints'))
os.makedirs(os.path.join(opt.out_path,'log_files'))
print( 'Directory {} was successfully created.'.format(opt.out_path))
except OSError:
print( 'Directory {} already exists.'.format(opt.out_path))
pass
# Training
M = Model(opt)
M.train()
'''
TODO: M.test()
'''
if __name__ == '__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pauleta/ChaLearn_liveness_challenge.git
git@gitee.com:pauleta/ChaLearn_liveness_challenge.git
pauleta
ChaLearn_liveness_challenge
ChaLearn_liveness_challenge
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385