Skip to content

MMEditing v1.0.0rc6 Release

Compare
Choose a tag to compare
@Z-Fran Z-Fran released this 03 Mar 07:44
216f7d6

Highlights

We are excited to announce the release of MMEditing 1.0.0rc6. This release supports 50+ models, 222+ configs and 209+ checkpoints in MMGeneration and MMEditing. We highlight the following new features

  • Support Gradio gui of Inpainting inference.
  • Support Colorization, Translationin and GAN models inference.

Backwards Incompatible changes

  1. GenValLoop and MultiValLoop has been merged to EditValLoop, GenTestLoop and MultiTestLoop has been merged to EditTestLoop. Use case:
    Case 1: metrics on a single dataset

    >>> # add the following lines in your config
    >>> # 1. use `EditValLoop` instead of `ValLoop` in MMEngine
    >>> val_cfg = dict(type='EditValLoop')
    >>> # 2. specific EditEvaluator instead of Evaluator in MMEngine
    >>> val_evaluator = dict(
    >>>     type='EditEvaluator',
    >>>     metrics=[
    >>>         dict(type='PSNR', crop_border=2, prefix='Set5'),
    >>>         dict(type='SSIM', crop_border=2, prefix='Set5'),
    >>>     ])
    >>> # 3. define dataloader
    >>> val_dataloader = dict(...)

    Case 2: different metrics on different datasets

    >>> # add the following lines in your config
    >>> # 1. use `EditValLoop` instead of `ValLoop` in MMEngine
    >>> val_cfg = dict(type='EditValLoop')
    >>> # 2. specific a list EditEvaluator
    >>> # do not forget to add prefix for each metric group
    >>> div2k_evaluator = dict(
    >>>     type='EditEvaluator',
    >>>     metrics=dict(type='SSIM', crop_border=2, prefix='DIV2K'))
    >>> set5_evaluator = dict(
    >>>     type='EditEvaluator',
    >>>     metrics=[
    >>>         dict(type='PSNR', crop_border=2, prefix='Set5'),
    >>>         dict(type='SSIM', crop_border=2, prefix='Set5'),
    >>>     ])
    >>> # define evaluator config
    >>> val_evaluator = [div2k_evaluator, set5_evaluator]
    >>> # 3. specific a list dataloader for each metric groups
    >>> div2k_dataloader = dict(...)
    >>> set5_dataloader = dict(...)
    >>> # define dataloader config
    >>> val_dataloader = [div2k_dataloader, set5_dataloader]
  1. Support stack and split for EditDataSample, Use case:
# Example for `split`
gen_sample = EditDataSample()
gen_sample.fake_img = outputs  # tensor
gen_sample.noise = noise  # tensor
gen_sample.sample_kwargs = deepcopy(sample_kwargs)  # dict
gen_sample.sample_model = sample_model  # string
# set allow_nonseq_value as True to copy non-sequential data (sample_kwargs and sample_model for this example)
batch_sample_list = gen_sample.split(allow_nonseq_value=True)  

# Example for `stack`
data_sample1 = EditDataSample()
data_sample1.set_gt_label(1)
data_sample1.set_tensor_data({'img': torch.randn(3, 4, 5)})
data_sample1.set_data({'mode': 'a'})
data_sample1.set_metainfo({
    'channel_order': 'rgb',
    'color_flag': 'color'
})
data_sample2 = EditDataSample()
data_sample2.set_gt_label(2)
data_sample2.set_tensor_data({'img': torch.randn(3, 4, 5)})
data_sample2.set_data({'mode': 'b'})
data_sample2.set_metainfo({
    'channel_order': 'rgb',
    'color_flag': 'color'
})
data_sample_merged = EditDataSample.stack([data_sample1, data_sample2])
  1. GenDataPreprocessor has been merged into EditDataPreprocessor,

    • No changes are required other than changing the type field in config.
    • Users do not need to define input_view and output_view since we will infer the shape of mean automatically.
    • In evaluation stage, all tensors will be converted to BGR (for three-channel images) and [0, 255].
  2. PixelData has been removed.

  3. For BaseGAN/CondGAN models, real images are passed from data_samples.gt_img instead of inputs['img'].

New Features & Improvements

  • Refactor FileIO. #1572
  • Refactor registry. #1621
  • Refactor Random degradations. #1583
  • Refactor DataSample, DataPreprocessor, Metric and Loop. #1656
  • Use mmengine.basemodule instead of nn.module. #1491
  • Refactor Main Page. #1609
  • Support Gradio gui of Inpainting inference. #1601
  • Support Colorization inferencer. #1588
  • Support Translation models inferencer. #1650
  • Support GAN models inferencer. #1653, #1659
  • Print config tool. #1590
  • Improve type hints. #1604
  • Update Chinese documents of metrics and datasets. #1568, #1638
  • Update Chinese documents of BigGAN and Disco-Diffusion. #1620
  • Update Evaluation and README of Guided-Diffusion. #1547

Bug Fixes

  • Fix the meaning of momentum in EMA. #1581
  • Fix output dtype of RandomNoise. #1585
  • Fix pytorch2onnx tool. #1629
  • Fix API documents. #1641, #1642
  • Fix loading RealESRGAN EMA weights. #1647
  • Fix arg passing bug of dataset_converters scripts. #1648

Contributors

A total of 17 developers contributed to this release.
Thanks @plyfager, @LeoXing1996, @Z-Fran, @zengyh1900, @VongolaWu, @liuwenran, @austinmw, @dienachtderwelt, @liangzelong, @i-aki-y, @xiaomile, @Li-Qingyun, @vansin, @Luo-Yihang, @ydengbi, @ruoningYu, @triple-Mu

New Contributors

Full Changelog: v1.0.0rc5...v1.0.0rc6