当前位置: 首页>>代码示例>>Python>>正文


Python models.create_model方法代码示例

本文整理汇总了Python中models.models.create_model方法的典型用法代码示例。如果您正苦于以下问题:Python models.create_model方法的具体用法?Python models.create_model怎么用?Python models.create_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.models的用法示例。


在下文中一共展示了models.create_model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_func

# 需要导入模块: from models import models [as 别名]
# 或者: from models.models import create_model [as 别名]
def test_func(opt_train, webpage, epoch='latest'):
	opt = copy.deepcopy(opt_train)
	print(opt)
	# specify the directory to save the results during training
	opt.results_dir = './results/'
	opt.isTrain = False
	opt.nThreads = 1   # test code only supports nThreads = 1
	opt.batchSize = 1  # test code only supports batchSize = 1
	opt.serial_batches = True  # no shuffle
	opt.no_flip = True  # no flip
	opt.dataroot = opt.dataroot + '/test'
	opt.model = 'test'
	opt.dataset_mode = 'single'
	opt.which_epoch = epoch
	opt.how_many = 50
	opt.phase = 'test'
	# opt.name = name

	data_loader = CreateDataLoader(opt)
	dataset = data_loader.load_data()
	model = create_model(opt)
	visualizer = Visualizer(opt)
	# create website
	# web_dir = os.path.join(opt.results_dir, opt.name, '%s_%s' % (opt.phase, opt.which_epoch))
	# web_dir = os.path.join(opt.results_dir, opt.name)
	# webpage = html.HTML(web_dir, 'Experiment = %s, Phase = %s, Epoch = %s' % (opt.name, opt.phase, opt.which_epoch))
	# test
	for i, data in enumerate(dataset):
	    if i >= opt.how_many:
	        break
	    model.set_input(data)
	    model.test()
	    visuals = model.get_current_visuals()
	    img_path = model.get_image_paths()
	    print('process image... %s' % img_path)
	    visualizer.save_images_epoch(webpage, visuals, img_path, epoch)

	webpage.save() 
开发者ID:jessemelpolio,项目名称:non-stationary_texture_syn,代码行数:40,代码来源:test_function.py

示例2: prepare_options

# 需要导入模块: from models import models [as 别名]
# 或者: from models.models import create_model [as 别名]
def prepare_options(self, path):
        sys.path.append(path)
        from options.test_options import TestOptions
        from models.models import create_model
        sys.argv = [sys.argv[0]]
        os.mkdir(self.input_file_grp+"/test_A/")
        opt = TestOptions().parse(save=False)
        opt.nThreads = 1   # test code only supports nThreads = 1
        opt.batchSize = 1  # test code only supports batchSize = 1
        opt.serial_batches = True  # no shuffle
        opt.no_flip = True  # no flip
        opt.rood_dir = self.input_file_grp # make into proper path
        opt.checkpoints_dir = self.parameter['checkpoint_dir'] 
        opt.dataroot = self.input_file_grp
        opt.name = self.parameter['model_name']
        opt.label_nc = 0
        opt.no_instance = True
        opt.resize_or_crop = self.parameter['imgresize']
        opt.n_blocks_global = 10
        opt.n_local_enhancers = 2
        opt.gpu_ids = [self.parameter['gpu_id']]
        opt.loadSize = self.parameter['resizeHeight']
        opt.fineSize = self.parameter['resizeWidth']
        
        model = create_model(opt)
    
        return opt, model 
开发者ID:OCR-D,项目名称:ocrd_anybaseocr,代码行数:29,代码来源:ocrd_anybaseocr_dewarp.py


注:本文中的models.models.create_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。