Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Version to 1.0.0rc6 #1661

Merged
merged 61 commits into from
Mar 2, 2023
Merged

Bump Version to 1.0.0rc6 #1661

merged 61 commits into from
Mar 2, 2023

Conversation

Z-Fran
Copy link
Collaborator

@Z-Fran Z-Fran commented Feb 23, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

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

Who can help? @ them here!

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

dienachtderwelt and others added 30 commits January 5, 2023 19:33
* [Refactor] Refactor fileio

* fix ut

* fix self.backend_args

* fix self.backend_args

* fix self.backend_args

* fix self.backend_args

* fix vis_backend

* fix vis_backend

* fix vis_backend

* fix vis_backend

* fix vis_backend

* fix ut
* fix jpeg config

* fix random degradation
* [CodeCamp #99] type hints Part C

* face id

Co-authored-by: Z-Fran <[email protected]>
* -

* fix dev_scripts

* update field name in readme

* refactor format in readme
* Add tools/misc/print_config.py

* Change print_config.py location

Co-authored-by: Z-Fran <[email protected]>
* fix ema momentum meaning, results in codes and config changes

* fix comments

* Update mmedit/engine/hooks/ema.py

Co-authored-by: Yanhong Zeng <[email protected]>

* complete warning for old user

* fix lint

* fix ut

* test warning

* pytest capture warning

* fix lint

Co-authored-by: Yanhong Zeng <[email protected]>
fix disco bug with glide added.
* remove python<3.7 ut head.

* fix lint
* [Refactor] use mmengine.basemodule instead of nn.module

* fix init_cfg

* fix conflict

* fix init_cfg
* revert opencv change.

* pass stylegan1 and 2

* revert sd ut.
* use baseinferencer from engine.

* remove abstract functions in baseinferencer.

* remove funtions.

* fix init model with blank ckpt

* use super init.
* remove sd test head

* add conv_act

* fix typo.

* remove unused code
* 第一次提交

* 第一次提交

* 第二次提交

* 第三次提交

* 第四次提交,修改 isort

* 第5次提交,isort调整

* 第五次提交,调整isort

* 第6次提交,调整yapf

* 第7次提交,针对部分类型修改

* 第7次提交,针对部分类型修改

* 第7次提交,针对部分类型修改

* 第7次提交,针对部分类型修改

* 第八次提交,根据要求修改部分参数类型和函数返回类型

spearable_conv_module.py参数kernel_size,stride,padding,dilation根据ConvModule的同名参数进行修改类型。resnet.py类ResNet中forward函数返回的类型是list;其他部分根据要求修改

* 第八次提交,yapf调整

* 第九次提交,img_normalize.py部分类型修改

根据tests/test_models/test_base_archs/test_img_normalize.py创建这个class时给的参数rgb_mean和rgb_std的类型,以及mmedit/models/editors/ttsr/lte.py创建这个class的参数vgg_mean和vgg_std的参数类型,修改img_mean 和 img_std的类型

* 第十次提交,修改base_edit_model.py和base_mattor.py部分参数类型

base_edit_model.py函数convert_to_datasample的返回类型修改为List[EditDataSample],因为其返回的变量inputs也是函数的参数,因此将参数inputs的类型也修改为List[EditDataSample];
base_mattor.py的函数convert_to_datasample的返回类型修改为List[EditDataSample]

* gradio实现inpaiting gui

* yapf isort 调整

删除一些不用的包和注释,以及调整代码使其符合yapf和isort校验

* send_notification函数和setting输入项调整

1、使用gr.Label来取代原来的pyler作为通知的输出
2、model_setting改为下拉选择

* lint 调整

* double-quote-string 调整

* double-quote-string调整

* docformatter 调整

---------

Co-authored-by: LeoXing1996 <[email protected]>
* open stylegan circleci ut.

* fix lint.
* add colorization inferencer

* fix lint

* add ut

* fix ut

* clean code

* remove cuda only

* mask out gpu

* skip forward in cpu ut.

* skip instancecrop.

* fix lint.

* skip forward without cuda.

* coverage with cu102

* revert ci setting.
fix esrgan's readme
revise README of RDN, StyleGAN3 and Tdan
* refine biggan readme

* refine disco readme

* fix lint
* [Feature] Support auto import modules from registry

* fix mmengine version
Luo-Yihang and others added 6 commits February 21, 2023 18:44
* [Fix] fix dataset_converters scripts bug

* [Fix] fix dataset_converters scripts bug
fixbug: register transforms
* Update dataset_prepare.md

* Update dataset_prepare.md
* Update nafnet_c64eb11128mb1db1111_8xb8-lr1e-3-400k_gopro.py

* Update nafnet_c64eb2248mb12db2222_8xb8-lr1e-3-400k_sidd.py

* Update nafnet_net.py

* Update nafnet_net.py

* Update test_nafnet.py

* Update test_nafnet.py

---------

Co-authored-by: Z-Fran <[email protected]>
* [Docs]: Add metrics and dataset_prepare in user_guides

* fix lint

---------

Co-authored-by: Yanhong Zeng <[email protected]>
Co-authored-by: Z-Fran <[email protected]>
Co-authored-by: Z-Fran <[email protected]>
@Z-Fran Z-Fran self-assigned this Feb 23, 2023
@CLAassistant
Copy link

CLAassistant commented Feb 23, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
15 out of 17 committers have signed the CLA.

✅ Z-Fran
✅ liangzelong
✅ liuwenran
✅ dienachtderwelt
✅ zengyh1900
✅ xiaomile
✅ triple-Mu
✅ plyfager
✅ Li-Qingyun
✅ LeoXing1996
✅ i-aki-y
✅ Luo-Yihang
✅ ruoningYu
✅ VongolaWu
✅ vansin
❌ matrixgame2018
❌ ydengbi
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.24 🎉

Comparison is base (e7c0539) 87.90% compared to head (9f33d9c) 88.15%.

❗ Current head 9f33d9c differs from pull request most recent head 869f576. Consider uploading reports for the commit 869f576 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              1.x    #1661      +/-   ##
==========================================
+ Coverage   87.90%   88.15%   +0.24%     
==========================================
  Files         399      399              
  Lines       26015    26372     +357     
  Branches     4044     4114      +70     
==========================================
+ Hits        22868    23247     +379     
- Misses       2240     2241       +1     
+ Partials      907      884      -23     
Flag Coverage Δ
unittests 88.15% <ø> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmedit/evaluation/functional/inception_utils.py 35.54% <0.00%> (-17.79%) ⬇️
mmedit/evaluation/metrics/sad.py 85.71% <0.00%> (-14.29%) ⬇️
mmedit/models/editors/pix2pix/pix2pix.py 83.48% <0.00%> (-13.72%) ⬇️
mmedit/evaluation/metrics/matting_mse.py 79.31% <0.00%> (-11.17%) ⬇️
mmedit/evaluation/metrics/gradient_error.py 88.88% <0.00%> (-11.12%) ⬇️
mmedit/evaluation/metrics/connectivity_error.py 90.00% <0.00%> (-7.62%) ⬇️
...edit/evaluation/metrics/base_sample_wise_metric.py 81.13% <0.00%> (-6.97%) ⬇️
mmedit/models/editors/eg3d/eg3d.py 93.49% <0.00%> (-6.51%) ⬇️
...medit/apis/inferencers/unconditional_inferencer.py 94.11% <0.00%> (-5.89%) ⬇️
mmedit/models/editors/ddpm/ddpm_scheduler.py 75.51% <0.00%> (-5.61%) ⬇️
... and 137 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

LeoXing1996 and others added 17 commits February 28, 2023 21:33
* refactor packeditinput and editdatasample

* move util from formatting to img_utils

* fix bugs in ut

* use permute instead of transpose in all_to_tensor

* remove undesired output results

* fix the path of results in ut

* use np.ascontiguousarray(img) in image_to_tensor

* remove entry function from unit test files

* refine sinGAN's config

Co-authored-by: LeoXing1996 <[email protected]>
* unify GenDataPreprocessor and EditDataPreprocessor

* revise models with EditDataPreprocessor

* adopt configs with revised EditDataPreprocessor

* adopt train_step and unit tests to revised EditDataPreprocessor

* fix unit test of inpainter inferencer

* add more metainfo to EditDataSample

* refactor EditDataPreprocessor to standardize the output channel order and value range of data_samples and inputs

* adopt SR models to refactored EditDataPreprocessor

* revise padding checking in destruct

* revise color order conversion to support get input channel order from metafile and handle single channel images

* remove norm_data_samples_in_testing and use upper case for channel order

* adopt baseGAN and baseCondGAN for new data preprocessor

* convert is_list_of to is_seq_of

* refactor inpaintors to adopt new data preprocessor

* standardize channel order representation and refactor channel order conversion behaviors

* refactor channel conversion in destruct and remove unused codes

* update unit test for edit data preprocessor and fix some bugs

* adopt inpainting models' with data preprocessor

* adopt frame interpolation models' with data preprocessor

* revise train_step and unit tests of global_local and partial_conv

* adopt colorization models' with data preprocessor

* revise train_step and unit tests of aot-gan

* adopt SR and VSR models with data preprocessor

* revise test config of LIIF

* adopt dcgan and SWD, MS-SSIM to new data preprocessor

* adopt wgan, ggan and lsgan to new data preprocessor

* adopt pggan and styleganv1 to new data preprocessor

* adopt pix2pix to new data preprocessor

* adopt cyclegan to new data preprocessor

* adopt conditional-datasets to new data preprocessor

* adopt sngan and sagan to new data preprocessor

* adopt biggan to new data preprocessor

* adopt stylegan2, singan and mspie to new data preprocessor

* adopt stylegan3 to new data preprocessor

* adopt eg3d to new data preprocessor

* revise transform pipelines

* revise unit test of EditDataSample

* adopt baseEditModel, vis_hook and visualizer for new data preprocessor

* some minor fix of edit data preprocessor and add unit test for model utils

* adopt metrics for new data preprocessor

* add env var for deterministic training

* refactor mattor data preprocessor based on edit data preprocessor

* fix lint error

* fix some unit tests

* update unit test of inpainting inferencer, sad and data preprocessor

* optimize the memory cost for AOT-GAN and BasicVSR's unit tests

* optimize the memory cost for IconVSR's unit tests

* skip ttsr unit test on windows CI
* support new loops

* refactor base sample wise metrics, FID and IS

* adopt configs to new loops

* refine EditLoops and add docstring and unit test for EditLoops

* rename GenEvaluator to EditEvaluator

* revise configs for new EditLoops and EditEvaluator

* remove unused imported modules

* revise unit test of BaseSampleWiseMetric

* remove GenDataPreprocessor, GenLoop from configs, docstrings and tutorials

* avoid raise duplicate conversion warning in EditDataprocessor

* revise channel order conversion in FID metric

* rename GenLogProcessor and GenIterTimeHook to EditLogProcessor and EditIterTimeHook

* rename some elements in default_runtime

* support non-scalar in get_log_after_epoch as MMEngine's LogProcessor

* save metainfo in Resize for outkeys

* complete prepare method for Matting metrics

* remove GenLoop, MutliLoop, GenDataPreprocessor

* remove PixelData
add more docstring to pass lint checking
* support stack and split in data sample

* support stack for EditDataPreprocessor

* support length in EditDataSample and revise stack and split operation

* adapt models for the stacked data samples

* support stack for MattorPreprocessor

* remove useless comments

* revise the return type of forward_inference to EditDataSample

* add security checking for EditDataSample.split

* revise inferencer unit tests

* revise inception utils

* revise conditional gan models

* revise unit test for base mattor

* revise unit test for twostage inpaintor and aot-inpaintor

* revise unit test for LIIF

* revise unit test for cyclegan and pix2pix

* revise unit test for pconv

* revise unit test for vis hook + fix bug in split

* revise more unit tests to pass CI and reduce the input resolution of wo-stage UI

* support video process for EditDataPreprocessor.process_image_tensor

* revise unit test of EDVR

* revise comment in EditDataSample.split

* remove more useless comments
* make forward logic more clear for GAN models

* revise eg3d inferencer unit test

* polish length calculate and split operation for EditDataSample

* revise forward pipeline for BaseGAN and BaseCondGAN

* revise forward pipeline for EG3D

* revise forward pipeline for PGGAN

* remove useless comments from SinGAN

* remove is_stacked property from EditDataSample
…processor

[Enhance] Merge EditVal/TestLoop and  EditPreprocessor to `dev-1.x`
use LongTensor in index_select for pt16
include niqe_pris_params.npz and fix deploy
* fix unit test for colorization

* fix GPU unit test for pix2pix and cycleGAN

* adapt EditDataPreprocessor for ADM and fix unit test for ADM

* revise CircleCI config
* [Fix] fix model_zoo script

* add pre-commit
* [Release] update v1.0.0rc6 info

* update date

* update changelog

* update readme

* fix comments

* update date

* update comments
@Z-Fran Z-Fran requested review from zengyh1900 and LeoXing1996 March 2, 2023 11:27
Copy link
Collaborator

@LeoXing1996 LeoXing1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LeoXing1996 LeoXing1996 merged commit 5163619 into 1.x Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.