本文整理匯總了Python中util.html.HTML屬性的典型用法代碼示例。如果您正苦於以下問題:Python html.HTML屬性的具體用法?Python html.HTML怎麽用?Python html.HTML使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類util.html
的用法示例。
在下文中一共展示了html.HTML屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from util import html [as 別名]
# 或者: from util.html import HTML [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()
示例2: main
# 需要導入模塊: from util import html [as 別名]
# 或者: from util.html import HTML [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()
示例3: test_func
# 需要導入模塊: from util import html [as 別名]
# 或者: from util.html import HTML [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()