mmgeneration icon indicating copy to clipboard operation
mmgeneration copied to clipboard

How to inference my data with a pix2pix model?

Open xiaojifu opened this issue 3 years ago • 1 comments

Hello,i have train a pix2pix model with my own dataset,and now i want to inference this model.I try the way in translation_demo.py. But i found that when i takes paired image as input, i can get a comparatively good result, when i takes a source image as input, i got very bad result. what should i do if i want to get a good result only input a source image?

xiaojifu avatar Jun 07 '22 14:06 xiaojifu

Hi @xiaojifu , you may modify the test_pipeline in your config this way.

test_pipeline = [
    dict(
        type='LoadImageFromFile',
        io_backend='disk',
        key='pair',
        domain_a=domain_a,
        flag='color'),
    dict(
        type='Resize',
        keys=[f'img_{domain_a}'],
        scale=(256, 256),
        interpolation='bicubic'),
    dict(type='RescaleToZeroOne', keys=[f'img_{domain_a}']),
    dict(
        type='Normalize',
        keys=[f'img_{domain_a}'],
        to_rgb=False,
        **img_norm_cfg),
    dict(type='ImageToTensor', keys=[f'img_{domain_a}']),
    dict(
        type='Collect',
        keys=[f'img_{domain_a}'],
        meta_keys=[f'img_{domain_a}_path'])
]

plyfager avatar Jul 10 '22 23:07 plyfager