NVIDIA / FastPhotoStyle

Style transfer, deep learning, feature transform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get results of a batch of content/style pairs?

zhonglism opened this issue · comments

As the title described, I now have 50 content/style picture pairs, I want to get results of them in a batch, not one by one shown in example, can any one tell me how to make it?

If you look in the repository at demo.py, you could modify it with something like this:

content_list = ['filename1.jpg', 'filename2.jpg']
style_list = ['stylename1.jpg', 'stylename2.jpg']
result_list = ['result1.jpg', 'results2.jpg']

for content_image_fn, style_image_fn, result_image_fn in zip(content_list, style_list, result_list):
    process_stylization.stylization(
        stylization_module=p_wct,
        smoothing_module=p_pro,
        content_image_path=content_image_fn,
        style_image_path=style_image_fn,
        content_seg_path=args.content_seg_path,
        style_seg_path=args.style_seg_path,
        output_image_path=result_image_fn,
        cuda=args.cuda,
        save_intermediate=args.save_intermediate,
        no_post=args.no_post
    )

I did something very similar and it worked (my situation is more complicated because I apply multiple styles to each content image, but the idea is similar).

commented

Only the first image set (filename1.png, style1.png, result1.png) will work.
The function as batch is insufficient.
Where is the problem?

content_list = ['filename1.png', 'filename2.png']
style_list = ['style1.png', 'style2.png']
result_list = ['result1.png', 'results2.png']

for content_image_fn, style_image_fn, result_image_fn in zip(content_list, style_list, result_list):
process_stylization.stylization(
p_wct=p_wct,
content_image_path=content_image_fn,
style_image_path=style_image_fn,
content_seg_path=args.content_seg_path,
style_seg_path=args.style_seg_path,
output_image_path=result_image_fn,
cuda=args.cuda
)

@mingyuliutw can you help us about the batch question?