MMEditing v1.0.0rc6 Release
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
GenValLoop
andMultiValLoop
has been merged toEditValLoop
,GenTestLoop
andMultiTestLoop
has been merged toEditTestLoop
. 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]
- Support
stack
andsplit
forEditDataSample
, 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])
-
GenDataPreprocessor
has been merged intoEditDataPreprocessor
,- No changes are required other than changing the
type
field in config. - Users do not need to define
input_view
andoutput_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]
.
- No changes are required other than changing the
-
PixelData
has been removed. -
For BaseGAN/CondGAN models, real images are passed from
data_samples.gt_img
instead ofinputs['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
- @dienachtderwelt made their first contribution in #1578
- @i-aki-y made their first contribution in #1590
- @triple-Mu made their first contribution in #1618
- @Li-Qingyun made their first contribution in #1640
- @Luo-Yihang made their first contribution in #1648
- @ydengbi made their first contribution in #1557
Full Changelog: v1.0.0rc5...v1.0.0rc6