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


Python test_options.TestOptions方法代码示例

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


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

示例1: main

# 需要导入模块: from options import test_options [as 别名]
# 或者: from options.test_options import TestOptions [as 别名]
def main():    
    opt = TestOptions().parse()
    opt.no_flip = True  
    opt.batchSize = 1

    data_loader = CreateDataLoader(opt)

    model = SingleGAN()
    model.initialize(opt)

    web_dir = os.path.join(opt.results_dir, 'test')
    webpage = html.HTML(web_dir, 'task {}'.format(opt.name))

    for i, data in enumerate(islice(data_loader, opt.how_many)):
        print('process input image %3.3d/%3.3d' % (i, opt.how_many))
        all_images, all_names = model.translation(data)
        img_path = 'image%3.3i' % i
        save_images(webpage, all_images, all_names, img_path, None, width=opt.fineSize)
            
    webpage.save() 
开发者ID:Xiaoming-Yu,项目名称:SingleGAN,代码行数:22,代码来源:test.py

示例2: run_test

# 需要导入模块: from options import test_options [as 别名]
# 或者: from options.test_options import TestOptions [as 别名]
def run_test(epoch=-1):
    print('Running Test')
    opt = TestOptions().parse()
    opt.serial_batches = True  # no shuffle
    dataset = DataLoader(opt)
    model = create_model(opt)
    writer = Writer(opt)
    # test
    writer.reset_counter()
    for i, data in enumerate(dataset):
        model.set_input(data)
        ncorrect, nexamples = model.test()
        writer.update_counter(ncorrect, nexamples)
    writer.print_acc(epoch, writer.acc)
    return writer.acc 
开发者ID:ranahanocka,项目名称:MeshCNN,代码行数:17,代码来源:test.py

示例3: main

# 需要导入模块: from options import test_options [as 别名]
# 或者: from options.test_options import TestOptions [as 别名]
def main():    
    opt = TestOptions().parse()
    opt.is_flip = False  
    opt.batchSize = 1
    data_loader = CreateDataLoader(opt)
    model = create_model(opt) 
    web_dir = os.path.join(opt.results_dir, 'test')
    webpage = html.HTML(web_dir, 'task {}'.format(opt.exp_name))

    for i, data in enumerate(islice(data_loader, opt.how_many)):
        print('process input image %3.3d/%3.3d' % (i, opt.how_many))
        results = model.translation(data)
        img_path = 'image%3.3i' % i
        save_images(webpage, results, img_path, None, width=opt.fine_size)
    webpage.save() 
开发者ID:Xiaoming-Yu,项目名称:DMIT,代码行数:17,代码来源:test.py

示例4: main

# 需要导入模块: from options import test_options [as 别名]
# 或者: from options.test_options import TestOptions [as 别名]
def main():
    opt = TestOptions().parse()
    if not os.path.isdir(opt.output_dir):
        os.makedirs(opt.output_dir)

    morph = MorphFacesInTheWild(opt)

    image_path = opt.input_path
    expression = np.random.uniform(0, 1, opt.cond_nc)
    morph.morph_file(image_path, expression) 
开发者ID:albertpumarola,项目名称:GANimation,代码行数:12,代码来源:test.py

示例5: prepare_options

# 需要导入模块: from options import test_options [as 别名]
# 或者: from options.test_options import TestOptions [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


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