diff --git a/configs/inpainting/deepfillv1/README.md b/configs/inpainting/deepfillv1/README.md index 9a120c3406..4af7514580 100644 --- a/configs/inpainting/deepfillv1/README.md +++ b/configs/inpainting/deepfillv1/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{yu2018generative, title={Generative image inpainting with contextual attention}, author={Yu, Jiahui and Lin, Zhe and Yang, Jimei and Shen, Xiaohui and Lu, Xin and Huang, Thomas S}, @@ -14,15 +14,14 @@ } ``` - ## Results and models + ### Places365-Challenge | Method | Mask Type | Resolution | Train Iters | Test Set | l1 error | PSNR | SSIM | Download | | :--------------------------------------------------------------------------: | :---------: | :--------: | :---------: | :-----------: | :------: | :----: | :---: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | [DeepFillv1](/configs/inpainting/deepfillv1/deepfillv1_256x256_8x2_places.py) | square bbox | 256x256 | 3500k | Places365-val | 11.019 | 23.429 | 0.862 | [model](https://download.openmmlab.com/mmediting/inpainting/deepfillv1/deepfillv1_256x256_8x2_places_20200619-c00a0e21.pth) \| [log](https://download.openmmlab.com/mmediting/inpainting/deepfillv1/deepfillv1_256x256_8x2_places_20200619-c00a0e21.log.json) | - ### CelebA-HQ | Method | Mask Type | Resolution | Train Iters | Test Set | l1 error | PSNR | SSIM | Download | diff --git a/configs/inpainting/deepfillv2/README.md b/configs/inpainting/deepfillv2/README.md index 3673e47721..416694d536 100644 --- a/configs/inpainting/deepfillv2/README.md +++ b/configs/inpainting/deepfillv2/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{yu2019free, title={Free-form image inpainting with gated convolution}, author={Yu, Jiahui and Lin, Zhe and Yang, Jimei and Shen, Xiaohui and Lu, Xin and Huang, Thomas S}, diff --git a/configs/inpainting/global_local/README.md b/configs/inpainting/global_local/README.md index f7d7009c36..1fc32e8f96 100644 --- a/configs/inpainting/global_local/README.md +++ b/configs/inpainting/global_local/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @article{iizuka2017globally, title={Globally and locally consistent image completion}, author={Iizuka, Satoshi and Simo-Serra, Edgar and Ishikawa, Hiroshi}, diff --git a/configs/inpainting/partial_conv/README.md b/configs/inpainting/partial_conv/README.md index 881dcf9ceb..e65cecd417 100644 --- a/configs/inpainting/partial_conv/README.md +++ b/configs/inpainting/partial_conv/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{liu2018image, title={Image inpainting for irregular holes using partial convolutions}, author={Liu, Guilin and Reda, Fitsum A and Shih, Kevin J and Wang, Ting-Chun and Tao, Andrew and Catanzaro, Bryan}, diff --git a/configs/mattors/dim/README.md b/configs/mattors/dim/README.md index 01ad5cc5cb..08238d45b8 100644 --- a/configs/mattors/dim/README.md +++ b/configs/mattors/dim/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{xu2017deep, title={Deep image matting}, author={Xu, Ning and Price, Brian and Cohen, Scott and Huang, Thomas}, diff --git a/configs/mattors/gca/README.md b/configs/mattors/gca/README.md index fcdf01d41f..bf3021ab5d 100644 --- a/configs/mattors/gca/README.md +++ b/configs/mattors/gca/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{li2020natural, title={Natural Image Matting via Guided Contextual Attention}, author={Li, Yaoyi and Lu, Hongtao}, diff --git a/configs/mattors/indexnet/README.md b/configs/mattors/indexnet/README.md index 6a69e195c5..c699bf8d11 100644 --- a/configs/mattors/indexnet/README.md +++ b/configs/mattors/indexnet/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{hao2019indexnet, title={Indices Matter: Learning to Index for Deep Image Matting}, author={Lu, Hao and Dai, Yutong and Shen, Chunhua and Xu, Songcen}, diff --git a/configs/restorers/edsr/README.md b/configs/restorers/edsr/README.md index 2d6aabec18..488f5ef8d9 100644 --- a/configs/restorers/edsr/README.md +++ b/configs/restorers/edsr/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{lim2017enhanced, title={Enhanced deep residual networks for single image super-resolution}, author={Lim, Bee and Son, Sanghyun and Kim, Heewon and Nah, Seungjun and Mu Lee, Kyoung}, diff --git a/configs/restorers/edvr/README.md b/configs/restorers/edvr/README.md index 3f72419621..435cfc9d2c 100644 --- a/configs/restorers/edvr/README.md +++ b/configs/restorers/edvr/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @InProceedings{wang2019edvr, author = {Wang, Xintao and Chan, Kelvin C.K. and Yu, Ke and Dong, Chao and Loy, Chen Change}, title = {EDVR: Video restoration with enhanced deformable convolutional networks}, diff --git a/configs/restorers/esrgan/README.md b/configs/restorers/esrgan/README.md index 158f9a5a19..619b19b9de 100644 --- a/configs/restorers/esrgan/README.md +++ b/configs/restorers/esrgan/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{wang2018esrgan, title={Esrgan: Enhanced super-resolution generative adversarial networks}, author={Wang, Xintao and Yu, Ke and Wu, Shixiang and Gu, Jinjin and Liu, Yihao and Dong, Chao and Qiao, Yu and Change Loy, Chen}, diff --git a/configs/restorers/srcnn/README.md b/configs/restorers/srcnn/README.md index fa648986ee..dc5a688520 100644 --- a/configs/restorers/srcnn/README.md +++ b/configs/restorers/srcnn/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @article{dong2015image, title={Image super-resolution using deep convolutional networks}, author={Dong, Chao and Loy, Chen Change and He, Kaiming and Tang, Xiaoou}, diff --git a/configs/restorers/srresnet_srgan/README.md b/configs/restorers/srresnet_srgan/README.md index 5974543373..2a0c04605a 100644 --- a/configs/restorers/srresnet_srgan/README.md +++ b/configs/restorers/srresnet_srgan/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{ledig2016photo, title={Photo-realistic single image super-resolution using a generative adversarial network}, author={Ledig, Christian and Theis, Lucas and Husz{\'a}r, Ferenc and Caballero, Jose and Cunningham, Andrew and Acosta, Alejandro and Aitken, Andrew and Tejani, Alykhan and Totz, Johannes and Wang, Zehan}, diff --git a/configs/restorers/tof/README.md b/configs/restorers/tof/README.md index 95c5db2f48..26ca5cf730 100644 --- a/configs/restorers/tof/README.md +++ b/configs/restorers/tof/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @article{xue2019video, title={Video enhancement with task-oriented flow}, author={Xue, Tianfan and Chen, Baian and Wu, Jiajun and Wei, Donglai and Freeman, William T}, diff --git a/configs/synthesizers/cyclegan/README.md b/configs/synthesizers/cyclegan/README.md index df083bc048..ff0eeb2746 100644 --- a/configs/synthesizers/cyclegan/README.md +++ b/configs/synthesizers/cyclegan/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{zhu2017unpaired, title={Unpaired image-to-image translation using cycle-consistent adversarial networks}, author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A}, diff --git a/configs/synthesizers/pix2pix/README.md b/configs/synthesizers/pix2pix/README.md index 898a935bf1..36b0b5734e 100644 --- a/configs/synthesizers/pix2pix/README.md +++ b/configs/synthesizers/pix2pix/README.md @@ -4,7 +4,7 @@ [ALGORITHM] -```latex +```bibtex @inproceedings{isola2017image, title={Image-to-image translation with conditional adversarial networks}, author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A}, @@ -16,7 +16,7 @@ ## Results and Models -We use `FID` and `IS` metrics to evaluate the generation performance of pix2pix. +We use `FID` and `IS` metrics to evaluate the generation performance of pix2pix. `FID` evaluation: diff --git a/docs/datasets_generation.md b/docs/datasets_generation.md deleted file mode 100644 index 5256fa6236..0000000000 --- a/docs/datasets_generation.md +++ /dev/null @@ -1,29 +0,0 @@ -## Prepare Datasets for Generation - -It is recommended to symlink the dataset root of the paired dataset to `$MMEditing/data/paired`, and the dataset root of the unpaired dataset to `$MMEditing/data/unpaired`: - -``` -mmediting -├── mmedit -├── tools -├── configs -├── data -│ ├── paired -│ │ ├── facades -│ │ ├── maps -| | ├── edges2shoes -| | | ├── train -| | | ├── test -│ ├── unpaired -│ │ ├── facades -| | ├── horse2zebra -| | ├── summer2winter_yosemite -| | | ├── trainA -| | | ├── trainB -| | | ├── testA -| | | ├── testB -``` - -Currently, you can directly download paired datasets from [here](http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/), and unpaired datasets from [here](https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/). Then, you need to unzip and move corresponding datasets to follow the folder structure shown above. The datasets have been well-prepared by the original authors. - -As we only need images and the correct folder structure for generation task, further preparation is not necessary. For paired datasets, each sample should be paired images that are concatenated in the width dimension. For unpaired datasets, `trainA` and `testA` contain images from domain A, whereas `trainB` and `testB` contain images from domain B. We recommend you to download the well-prepared datasets directly and conduct experiments. Or you can just put your images in the right place. diff --git a/docs/datasets_matting.md b/docs/datasets_matting.md deleted file mode 100644 index 3aa56e474d..0000000000 --- a/docs/datasets_matting.md +++ /dev/null @@ -1,102 +0,0 @@ -## Prepare Datasets for Matting - -### Adobe Composition-1k Dataset - -It is recommended to symlink the Adobe Composition-1k (comp1k) dataset root, the [MS COCO dataset](http://cocodataset.org/#home) and the [PASCAL VOC dataset](http://host.robots.ox.ac.uk/pascal/VOC/) to `$MMEditing/data`: - -``` -mkdir data -ln -s $ADOBE_COMPOSITION_1K_ROOT data/adobe_composition-1k -ln -s $COCO_ROOT data/coco -ln -s $VOC_ROOT data/VOCdevkit -``` - -The result folder structure should look like: - -``` -mmediting -├── mmedit -├── tools -├── configs -├── data -│ ├── adobe_composition-1k -│ │ ├── Test_set -│ │ │ ├── Adobe-licensed images -│ │ │ │ ├── alpha -│ │ │ │ ├── fg -│ │ │ │ ├── trimaps -│ │ │ ├── merged (generated by tools/data/preprocess_comp1k_dataset.py) -│ │ │ ├── bg (generated by tools/data/preprocess_comp1k_dataset.py) -│ │ ├── Training_set -│ │ │ ├── Adobe-licensed images -│ │ │ │ ├── alpha -│ │ │ │ ├── fg -│ │ │ ├── Other -│ │ │ │ ├── alpha -│ │ │ │ ├── fg -│ │ │ ├── merged (generated by tools/data/preprocess_comp1k_dataset.py) -│ │ │ ├── bg (generated by tools/data/preprocess_comp1k_dataset.py) -│ ├── coco -│ │ ├── train2014 (or train2017) -│ ├── VOCdevkit -│ │ ├── VOC2012 -``` - -If your folder structure is different, you may need to change the corresponding paths in config files. - -The Adobe composition-1k dataset contains only `alpha` and `fg` (and `trimap` in test set). It is needed to merge `fg` with COCO data (training) or VOC data (test) before training or evaluation. A script is provided to perform image composition and generate annotation files for training or testing: - -```shell -python tools/data/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit --composite -``` - -The generated data is stored under `adobe_composition-1k/Training_set` and `adobe_composition-1k/Test_set` respectively. If you only want to composite test data (since compositing training data is time-consuming), you can remove the `--composite` option: - -```shell -python tools/data/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit -``` - -> Currently, only `GCA` supports online composition of training data. But you can modify the data pipeline of other models to perform online composition instead of loading composited images (we called it `merged` in our data pipeline). - -### Note - -We use the same function to save the generated images as the original script provided by Adobe which will generate png images with incorrect png profile. Thus, it's normal to observe the below warning when training model with single GPU: - -``` -libpng warning: iCCP: known incorrect sRGB profile -libpng warning: iCCP: profile 'ICC Profile': 'GRAY': Gray color space not permitted on RGB PNG -libpng warning: iCCP: profile 'ICC Profile': 1000000h: invalid rendering intent -libpng warning: iCCP: profile 'ICC Profile': 0h: PCS illuminant is not D50 -libpng warning: iCCP: profile 'ICC Profile': 'desc': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'wtpt': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'bkpt': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'rXYZ': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'gXYZ': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'bXYZ': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'dmnd': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'dmdd': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'vued': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'view': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'lumi': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'meas': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'tech': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'rTRC': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'gTRC': ICC profile tag start not a multiple of 4 -libpng warning: iCCP: profile 'ICC Profile': 'bTRC': ICC profile tag start not a multiple of 4 -``` - -Note that we are also putting effort to remove these warnings for better training experience. Thus, any suggestions or contributions are welcomed. - -If you find it hard to inspect the training process in CLI, it's recommended to use the `Tensorboard` to keep track on the training process. To do this, you can just simply uncomment the `TensorboardLoggerHook` in model config file. - -```python -log_config = dict( - interval=10, - hooks=[ - dict(type='TextLoggerHook', by_epoch=False), - dict(type='TensorboardLoggerHook'), - # dict(type='PaviLoggerHook', init_kwargs=dict(project='dim')) - ]) -``` - -Optionally, you can also view all the loss log in `work_dir/${EXP_NAME}/${EXP_CREATE_TIME}.log.json`. diff --git a/docs/index.rst b/docs/index.rst index a803639501..480ea6f090 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,12 +20,13 @@ Welcome to MMEditing's documentation! .. toctree:: :maxdepth: 2 - :caption: Dataset Preparation + :caption: Datasets - datasets_generation.md - datasets_inpainting.md - datasets_matting.md - datasets_restoration.md + datasets.md + inpainting_datasets.md + matting_datasets.md + sr_datasets.md + generation_datasets.md .. toctree:: :maxdepth: 2 diff --git a/docs/merge_docs.sh b/docs/merge_docs.sh index 1f65ff2bb7..f8f808d210 100755 --- a/docs/merge_docs.sh +++ b/docs/merge_docs.sh @@ -5,32 +5,29 @@ sed -i '$a\\n' ../configs/mattors/*/*.md sed -i '$a\\n' ../configs/restorers/*/*.md sed -i '$a\\n' ../configs/synthesizers/*/*.md -cat ../configs/inpainting/*/*.md >inpainting_models.md -cat ../configs/mattors/*/*.md >mattors_models.md -cat ../configs/restorers/*/*.md >restorers_models.md -cat ../configs/synthesizers/*/*.md >synthesizers_models.md +# gather models +cat ../configs/inpainting/*/*.md | sed "s/md###t/html#t/g" | sed "s/#/#&/" | sed '1i\# Inpainting Models' | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >inpainting_models.md +cat ../configs/mattors/*/*.md | sed "s/md###t/html#t/g" | sed "s/#/#&/" | sed '1i\# Matting Models' | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >mattors_models.md +cat ../configs/restorers/*/*.md | sed "s/md###t/html#t/g" | sed "s/#/#&/" | sed '1i\# Super-Resolution Models' | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >restorers_models.md +cat ../configs/synthesizers/*/*.md | sed "s/md###t/html#t/g" | sed "s/#/#&/" | sed '1i\# Generation Models' | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >synthesizers_models.md -sed -i "s/#/#&/" inpainting_models.md -sed -i "s/#/#&/" mattors_models.md -sed -i "s/#/#&/" restorers_models.md -sed -i "s/#/#&/" synthesizers_models.md +# gather datasets +cat ../tools/data/generation/*.md > generation_datasets.md +cat ../tools/data/inpainting/*.md > inpainting_datasets.md +cat ../tools/data/matting/*.md > matting_datasets.md +cat ../tools/data/super-resolution/*.md > sr_datasets.md -sed -i "s/md###t/html#t/g" inpainting_models.md -sed -i "s/md###t/html#t/g" mattors_models.md -sed -i "s/md###t/html#t/g" restorers_models.md -sed -i "s/md###t/html#t/g" synthesizers_models.md +sed -i 's=(paired-pix2pix/README.md)=(#paired-dataset-for-pix2pix)=g' generation_datasets.md +sed -i 's=(unpaired-cyclegan/README.md)=(#unpaired-dataset-for-cyclegan)=g' generation_datasets.md +sed -i 's=(paris-street-view/README.md)=(#paris-street-view-dataset)=g' inpainting_datasets.md +sed -i 's=(celeba-hq/README.md)=(#celeba-hq-dataset)=g' inpainting_datasets.md +sed -i 's=(places365/README.md)=(#places365-dataset)=g' inpainting_datasets.md +sed -i 's=(comp1k/README.md)=(#composition-1k-dataset)=g' matting_datasets.md +sed -i 's=(div2k/README.md)=(#div2k-dataset)=g' sr_datasets.md +sed -i 's=(reds/README.md)=(#reds-dataset)=g' sr_datasets.md +sed -i 's=(vimeo90k/README.md)=(#vimeo90k-dataset)=g' sr_datasets.md -sed -i '1i\# Inpainting Models' inpainting_models.md -sed -i '1i\# Matting Models' mattors_models.md -sed -i '1i\# Restoration Models' restorers_models.md -sed -i '1i\# Generation Models' synthesizers_models.md - -sed -i 's/](\/docs\//](/g' inpainting_models.md # remove /docs/ for link used in doc site -sed -i 's/](\/docs\//](/g' mattors_models.md -sed -i 's/](\/docs\//](/g' restorers_models.md -sed -i 's/](\/docs\//](/g' synthesizers_models.md - -sed -i 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' inpainting_models.md -sed -i 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' mattors_models.md -sed -i 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' restorers_models.md -sed -i 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' synthesizers_models.md +cat ../tools/data/generation/*/*.md | sed 's/# Preparing/# /g' | sed "s/#/#&/" | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >> generation_datasets.md +cat ../tools/data/inpainting/*/*.md | sed 's/# Preparing/# /g' | sed "s/#/#&/" | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >> inpainting_datasets.md +cat ../tools/data/matting/*/*.md | sed 's/# Preparing/# /g' | sed "s/#/#&/" | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >> matting_datasets.md +cat ../tools/data/super-resolution/*/*.md | sed 's/# Preparing/# /g' | sed "s/#/#&/" | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmediting/tree/master/=g' >> sr_datasets.md diff --git a/docs/stat.py b/docs/stat.py index 4d3d29fcf6..ab812f9e1f 100755 --- a/docs/stat.py +++ b/docs/stat.py @@ -86,9 +86,87 @@ def anchor(name): * Number of papers: {len(allpapers)} {countstr} +For supported datasets, see [datasets overview](datasets.md). + {msglist} """ with open('modelzoo.md', 'w') as f: f.write(modelzoo) + +# Count datasets + +files = sorted(glob.glob('*_datasets.md')) + +datastats = [] + +for f in files: + with open(f, 'r') as content_file: + content = content_file.read() + + # title + title = content.split('\n')[0].replace('#', '') + + # count papers + papers = set( + (papertype, titlecase.titlecase(paper.lower().strip())) + for (papertype, paper) in re.findall( + r'\[([A-Z]*?)\]\s*\n.*?\btitle\s*=\s*{(.*?)}', content, re.DOTALL)) + # paper links + revcontent = '\n'.join(list(reversed(content.splitlines()))) + paperlinks = {} + for _, p in papers: + print(p) + paperlinks[p] = ', '.join( + (f'[{p} ⇨]({splitext(basename(f))[0]}.html#{anchor(p)})' + for p in re.findall( + rf'\btitle\s*=\s*{{\s*{p}\s*}}.*?\n## (.*?)\s*[,;]?\s*\n', + revcontent, re.DOTALL | re.IGNORECASE))) + print(' ', paperlinks[p]) + paperlist = '\n'.join( + sorted(f' - [{t}] {x} ({paperlinks[x]})' for t, x in papers)) + # count configs + configs = set(x.lower().strip() + for x in re.findall(r'https.*configs/.*\.py', content)) + + # count ckpts + ckpts = set(x.lower().strip() + for x in re.findall(r'https://download.*\.pth', content) + if 'mmedit' in x) + + statsmsg = f""" +## [{title}]({f}) + +* Number of papers: {len(papers)} +{paperlist} + + """ + + datastats.append((papers, configs, ckpts, statsmsg)) + +alldatapapers = func.reduce(lambda a, b: a.union(b), + [p for p, _, _, _ in datastats]) + +# Summarize + +msglist = '\n'.join(x for _, _, _, x in stats) +datamsglist = '\n'.join(x for _, _, _, x in datastats) +papertypes, papercounts = np.unique([t for t, _ in alldatapapers], + return_counts=True) +countstr = '\n'.join( + [f' - {t}: {c}' for t, c in zip(papertypes, papercounts)]) + +modelzoo = f""" +# Overview + +* Number of papers: {len(alldatapapers)} +{countstr} + +For supported editing algorithms, see [modelzoo overview](modelzoo.md). + +{datamsglist} +""" + +with open('datasets.md', 'w') as f: + f.write(modelzoo) diff --git a/tools/data/generation/README.md b/tools/data/generation/README.md new file mode 100644 index 0000000000..f195e361c5 --- /dev/null +++ b/tools/data/generation/README.md @@ -0,0 +1,8 @@ +# Generation Datasets + +It is recommended to symlink the dataset root to `$MMEDITING/data`. If your folder structure is different, you may need to change the corresponding paths in config files. + +MMEditing supported generation datasets: + +- [Paired Dataset for Pix2pix](paired-pix2pix/README.md) \[ [Homepage](http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/) \] +- [Unpaired Dataset for CycleGAN](unpaired-cyclegan/README.md) \[ [Homepage](https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/) \] diff --git a/tools/data/generation/paired-pix2pix/README.md b/tools/data/generation/paired-pix2pix/README.md new file mode 100644 index 0000000000..e8b11b101f --- /dev/null +++ b/tools/data/generation/paired-pix2pix/README.md @@ -0,0 +1,30 @@ +# Preparing Paired Dataset for Pix2pix + +[DATASET] + +```bibtex +@inproceedings{isola2017image, + title={Image-to-image translation with conditional adversarial networks}, + author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A}, + booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, + pages={1125--1134}, + year={2017} +} +``` + +You can download paired datasets from [here](http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/). +Then, you need to unzip and move corresponding datasets to follow the folder structure shown above. The datasets have been well-prepared by the original authors. + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── paired +│ │ ├── facades +│ │ ├── maps +| | ├── edges2shoes +| | | ├── train +| | | ├── test +``` diff --git a/tools/data/generation/unpaired-cyclegan/README.md b/tools/data/generation/unpaired-cyclegan/README.md new file mode 100644 index 0000000000..b802fa680c --- /dev/null +++ b/tools/data/generation/unpaired-cyclegan/README.md @@ -0,0 +1,32 @@ +# Preparing Unpaired Dataset for CycleGAN + +[DATASET] + +```bibtex +@inproceedings{zhu2017unpaired, + title={Unpaired image-to-image translation using cycle-consistent adversarial networks}, + author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A}, + booktitle={Proceedings of the IEEE international conference on computer vision}, + pages={2223--2232}, + year={2017} +} +``` + +You can download unpaired datasets from [here](https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/). +Then, you need to unzip and move corresponding datasets to follow the folder structure shown above. The datasets have been well-prepared by the original authors. + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── unpaired +│ │ ├── facades +| | ├── horse2zebra +| | ├── summer2winter_yosemite +| | | ├── trainA +| | | ├── trainB +| | | ├── testA +| | | ├── testB +``` diff --git a/docs/datasets_inpainting.md b/tools/data/inpainting/README.md similarity index 52% rename from docs/datasets_inpainting.md rename to tools/data/inpainting/README.md index 2366fa3496..289b62972e 100644 --- a/docs/datasets_inpainting.md +++ b/tools/data/inpainting/README.md @@ -1,27 +1,12 @@ -## Prepare Datasets for Inpainting +# Inpainting Datasets -It is recommended to symlink the [Places365](https://github.com/CSAILVision/places365) dataset root, the [CelebA-HQ](https://arxiv.org/abs/1710.10196?context=cs.LG) and the [ParisStreedView](https://github.com/pathak22/context-encoder/issues/24) to `$MMEditing/data`: +It is recommended to symlink the dataset root to `$MMEDITING/data`. If your folder structure is different, you may need to change the corresponding paths in config files. -``` -mmediting -├── mmedit -├── tools -├── configs -├── data -│ ├── places -│ │ ├── test_set -│ │ ├── train_set -| | ├── meta -| | | ├── Places365_train.txt -| | | ├── Places365_val.txt -│ ├── celeba -│ │ ├── train -| | ├── val -│ ├── paris_street_view -│ │ ├── train -| | ├── val +MMEditing supported inpainting datasets: -``` +- [Paris Street View](paris-street-view/README.md) \[ [Homepage](https://github.com/pathak22/context-encoder/issues/24) \] +- [CelebA-HQ](celeba-hq/README.md) \[ [Homepage](https://github.com/tkarras/progressive_growing_of_gans#preparing-datasets-for-training) \] +- [Places365](places365/README.md) \[ [Homepage](http://places2.csail.mit.edu/) \] As we only need images for inpainting task, further preparation is not necessary and the folder structure can be different from the example. You can utilize the information provided by the original dataset like `Place365` (e.g. `meta`). Also, you can easily scan the data set and list all of the images to a specific `txt` file. Here is an example for the `Places365_val.txt` from Places365 and we will only use the image name information in inpainting. diff --git a/tools/data/inpainting/celeba-hq/README.md b/tools/data/inpainting/celeba-hq/README.md new file mode 100644 index 0000000000..fd018da468 --- /dev/null +++ b/tools/data/inpainting/celeba-hq/README.md @@ -0,0 +1,26 @@ +# Preparing CelebA-HQ Dataset + +[DATASET] + +```bibtex +@article{karras2017progressive, + title={Progressive growing of gans for improved quality, stability, and variation}, + author={Karras, Tero and Aila, Timo and Laine, Samuli and Lehtinen, Jaakko}, + journal={arXiv preprint arXiv:1710.10196}, + year={2017} +} +``` + +Follow the instructions [here](https://github.com/tkarras/progressive_growing_of_gans#preparing-datasets-for-training) to prepare the dataset. + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── celeba-hq +│ │ ├── train +| | ├── val + +``` diff --git a/tools/data/inpainting/paris-street-view/README.md b/tools/data/inpainting/paris-street-view/README.md new file mode 100644 index 0000000000..27010f7521 --- /dev/null +++ b/tools/data/inpainting/paris-street-view/README.md @@ -0,0 +1,27 @@ +# Preparing Paris Street View Dataset + +[DATASET] + +```bibtex +@inproceedings{pathak2016context, + title={Context encoders: Feature learning by inpainting}, + author={Pathak, Deepak and Krahenbuhl, Philipp and Donahue, Jeff and Darrell, Trevor and Efros, Alexei A}, + booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, + pages={2536--2544}, + year={2016} +} +``` + +Obtain the dataset [here](https://github.com/pathak22/context-encoder/issues/24). + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── paris_street_view +│ │ ├── train +| | ├── val + +``` diff --git a/tools/data/inpainting/places365/README.md b/tools/data/inpainting/places365/README.md new file mode 100644 index 0000000000..84419c2178 --- /dev/null +++ b/tools/data/inpainting/places365/README.md @@ -0,0 +1,30 @@ +# Preparing Places365 Dataset + +[DATASET] + +```bibtex + @article{zhou2017places, + title={Places: A 10 million Image Database for Scene Recognition}, + author={Zhou, Bolei and Lapedriza, Agata and Khosla, Aditya and Oliva, Aude and Torralba, Antonio}, + journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, + year={2017}, + publisher={IEEE} + } + +``` + +Prepare the data from [Places365](http://places2.csail.mit.edu/download.html). + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── places +│ │ ├── test_set +│ │ ├── train_set +| | ├── meta +| | | ├── Places365_train.txt +| | | ├── Places365_val.txt +``` diff --git a/tools/data/matting/README.md b/tools/data/matting/README.md new file mode 100644 index 0000000000..8cb9183d13 --- /dev/null +++ b/tools/data/matting/README.md @@ -0,0 +1,7 @@ +# Matting Datasets + +It is recommended to symlink the dataset root to `$MMEDITING/data`. If your folder structure is different, you may need to change the corresponding paths in config files. + +MMEditing supported matting datasets: + +- [Composition-1k](comp1k/README.md) \[ [Homepage](https://sites.google.com/view/deepimagematting) \] diff --git a/tools/data/preprocess_bgm_dataset.py b/tools/data/matting/bgm/preprocess_bgm_dataset.py similarity index 100% rename from tools/data/preprocess_bgm_dataset.py rename to tools/data/matting/bgm/preprocess_bgm_dataset.py diff --git a/tools/data/matting/comp1k/README.md b/tools/data/matting/comp1k/README.md new file mode 100644 index 0000000000..7d83d5e092 --- /dev/null +++ b/tools/data/matting/comp1k/README.md @@ -0,0 +1,76 @@ +# Preparing Composition-1k Dataset + +## Introduction + +[DATASET] + +```bibtex +@inproceedings{xu2017deep, + title={Deep image matting}, + author={Xu, Ning and Price, Brian and Cohen, Scott and Huang, Thomas}, + booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, + pages={2970--2979}, + year={2017} +} +``` + +The Adobe Composition-1k dataset consists of foreground images and their corresponding alpha images. +To get the full dataset, one need to composite the foregrounds with selected backgrounds from the COCO dataset and the Pascal VOC dataset. + +## Obtain and Extract + +Please follow the instructions of [paper authors](https://sites.google.com/view/deepimagematting) to obtain the Composition-1k (comp1k) dataset. + +## Composite the full dataset + +The Adobe composition-1k dataset contains only `alpha` and `fg` (and `trimap` in test set). +It is needed to merge `fg` with COCO data (training) or VOC data (test) before training or evaluation. +Use the following script to perform image composition and generate annotation files for training or testing: + +```shell +# The script is run under the root folder of MMEditing +python tools/data/matting/comp1k/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit --composite +``` + +The generated data is stored under `adobe_composition-1k/Training_set` and `adobe_composition-1k/Test_set` respectively. +If you only want to composite test data (since compositing training data is time-consuming), you can skip compositing the training set by removing the `--composite` option: + +```shell +# skip compositing training set +python tools/data/matting/comp1k/preprocess_comp1k_dataset.py data/adobe_composition-1k data/coco data/VOCdevkit +``` + +> Currently, only `GCA` supports online composition of training data. But you can modify the data pipeline of other models to perform online composition instead of loading composited images (we called it `merged` in our data pipeline). + +## Check Directory Structure + +The result folder structure should look like: + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── adobe_composition-1k +│ │ ├── Test_set +│ │ │ ├── Adobe-licensed images +│ │ │ │ ├── alpha +│ │ │ │ ├── fg +│ │ │ │ ├── trimaps +│ │ │ ├── merged (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py) +│ │ │ ├── bg (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py) +│ │ ├── Training_set +│ │ │ ├── Adobe-licensed images +│ │ │ │ ├── alpha +│ │ │ │ ├── fg +│ │ │ ├── Other +│ │ │ │ ├── alpha +│ │ │ │ ├── fg +│ │ │ ├── merged (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py) +│ │ │ ├── bg (generated by tools/data/matting/comp1k/preprocess_comp1k_dataset.py) +│ ├── coco +│ │ ├── train2014 (or train2017) +│ ├── VOCdevkit +│ │ ├── VOC2012 +``` diff --git a/tools/filter_comp1k_anno.py b/tools/data/matting/comp1k/filter_comp1k_anno.py similarity index 100% rename from tools/filter_comp1k_anno.py rename to tools/data/matting/comp1k/filter_comp1k_anno.py diff --git a/tools/data/preprocess_comp1k_dataset.py b/tools/data/matting/comp1k/preprocess_comp1k_dataset.py similarity index 100% rename from tools/data/preprocess_comp1k_dataset.py rename to tools/data/matting/comp1k/preprocess_comp1k_dataset.py diff --git a/tools/data/super-resolution/README.md b/tools/data/super-resolution/README.md new file mode 100644 index 0000000000..6ad1e74f08 --- /dev/null +++ b/tools/data/super-resolution/README.md @@ -0,0 +1,11 @@ +# Super-Resolution Datasets + +It is recommended to symlink the dataset root to `$MMEDITING/data`. If your folder structure is different, you may need to change the corresponding paths in config files. + +MMEditing supported super-resolution datasets: + +- Image Super-Resolution + - [DIV2K](div2k/README.md) \[ [Homepage](https://data.vision.ee.ethz.ch/cvl/DIV2K/) \] +- Video Super-Resolution + - [REDS](reds/README.md) \[ [Homepage](https://seungjunnah.github.io/Datasets/reds.html) \] + - [Vimeo90K](vimeo90k/README.md) \[ [Homepage](http://toflow.csail.mit.edu) \] diff --git a/docs/datasets_restoration.md b/tools/data/super-resolution/div2k/README.md similarity index 53% rename from docs/datasets_restoration.md rename to tools/data/super-resolution/div2k/README.md index 4209810714..ba8b789722 100644 --- a/docs/datasets_restoration.md +++ b/tools/data/super-resolution/div2k/README.md @@ -1,13 +1,21 @@ -## Prepare Datasets for Restoration - -### Image Super-Resolution +# Preparing DIV2K Dataset + +[DATASET] + +```bibtex +@InProceedings{Agustsson_2017_CVPR_Workshops, + author = {Agustsson, Eirikur and Timofte, Radu}, + title = {NTIRE 2017 Challenge on Single Image Super-Resolution: Dataset and Study}, + booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops}, + month = {July}, + year = {2017} +} +``` - Training dataset: [DIV2K dataset](https://data.vision.ee.ethz.ch/cvl/DIV2K/). - Validation dataset: Set5 and Set14. -It is recommended to symlink the dataset root to `$MMEditing/data`: - -``` +```text mmediting ├── mmedit ├── tools @@ -34,16 +42,17 @@ mmediting │ │ ├── Set14_bicLRx4 ``` -If your folder structure is different, you may need to change the corresponding paths in config files. +## Crop sub-images -#### Crop sub-images For faster IO, we recommend to crop the DIV2K images to sub-images. We provide such a script: + ```shell -python tools/data/preprocess_div2k_dataset.py --data-root ./data/DIV2K +python tools/data/super-resolution/div2k/preprocess_div2k_dataset.py --data-root ./data/DIV2K ``` The generated data is stored under `DIV2K` and the data structure is as follows, where `_sub` indicates the sub-images. -``` + +```text mmediting ├── mmedit ├── tools @@ -64,56 +73,23 @@ mmediting ... ``` -#### Prepare annotation list +## Prepare annotation list + If you use the annotation mode for the dataset, you first need to prepare a specific `txt` file. Each line in the annotation file contains the image names and image shape (usually for the ground-truth images), separated by a white space. Example of an annotation file: -``` + +```text 0001_s001.png (480,480,3) 0001_s002.png (480,480,3) ``` -### Video Super-Resolution -- Training dataset: [REDS dataset](https://seungjunnah.github.io/Datasets/reds.html). -- Validation dataset: [REDS dataset](https://seungjunnah.github.io/Datasets/reds.html) and Vid4. - -Note that we merge train and val datasets in REDS for easy switching between REDS4 partition (used in EDVR) and the official validation partition.
-The original val dataset (clip names from 000 to 029) are modified to avoid conflicts with training dataset (total 240 clips). Specifically, the clip names are changed to 240, 241, ... 269. - -You can prepare the REDS dataset by running: -```shell -python tools/data/preprocess_reds_dataset.py ./data/REDS -``` - -It is also recommended to symlink the dataset root to `$MMEditing/data`: - -``` -mmediting -├── mmedit -├── tools -├── configs -├── data -│ ├── REDS -│ │ ├── train_sharp -│ │ │ ├── 000 -│ │ │ ├── 001 -│ │ │ ├── ... -│ │ ├── train_sharp_bicubic -│ │ │ ├── 000 -│ │ │ ├── 001 -│ │ │ ├── ... -│ ├── REDS4 -│ │ ├── GT -│ │ ├── sharp_bicubic -``` +## Prepare LMDB dataset for DIV2K -### Prepare LMDB dataset If you want to use LMDB datasets for faster IO speed, you can make LMDB files by: + ```shell -# DIV2K -python tools/data/preprocess_div2k_dataset.py --data-root ./data/DIV2K --make-lmdb -# REDS -python tools/data/preprocess_reds_dataset.py --root-path ./data/REDS --make-lmdb +python tools/data/super-resolution/div2k/preprocess_div2k_dataset.py --data-root ./data/DIV2K --make-lmdb ``` diff --git a/tools/data/preprocess_div2k_dataset.py b/tools/data/super-resolution/div2k/preprocess_div2k_dataset.py similarity index 100% rename from tools/data/preprocess_div2k_dataset.py rename to tools/data/super-resolution/div2k/preprocess_div2k_dataset.py diff --git a/tools/data/super-resolution/reds/README.md b/tools/data/super-resolution/reds/README.md new file mode 100644 index 0000000000..362a3ce060 --- /dev/null +++ b/tools/data/super-resolution/reds/README.md @@ -0,0 +1,53 @@ +# Preparing REDS Dataset + +[DATASET] + +```bibtex +@InProceedings{Nah_2019_CVPR_Workshops_REDS, + author = {Nah, Seungjun and Baik, Sungyong and Hong, Seokil and Moon, Gyeongsik and Son, Sanghyun and Timofte, Radu and Lee, Kyoung Mu}, + title = {NTIRE 2019 Challenge on Video Deblurring and Super-Resolution: Dataset and Study}, + booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops}, + month = {June}, + year = {2019} +} +``` + +- Training dataset: [REDS dataset](https://seungjunnah.github.io/Datasets/reds.html). +- Validation dataset: [REDS dataset](https://seungjunnah.github.io/Datasets/reds.html) and Vid4. + +Note that we merge train and val datasets in REDS for easy switching between REDS4 partition (used in EDVR) and the official validation partition. +The original val dataset (clip names from 000 to 029) are modified to avoid conflicts with training dataset (total 240 clips). Specifically, the clip names are changed to 240, 241, ... 269. + +You can prepare the REDS dataset by running: + +```shell +python tools/data/super-resolution/reds/preprocess_reds_dataset.py ./data/REDS +``` + +```text +mmediting +├── mmedit +├── tools +├── configs +├── data +│ ├── REDS +│ │ ├── train_sharp +│ │ │ ├── 000 +│ │ │ ├── 001 +│ │ │ ├── ... +│ │ ├── train_sharp_bicubic +│ │ │ ├── 000 +│ │ │ ├── 001 +│ │ │ ├── ... +│ ├── REDS4 +│ │ ├── GT +│ │ ├── sharp_bicubic +``` + +## Prepare LMDB dataset for REDS + +If you want to use LMDB datasets for faster IO speed, you can make LMDB files by: + +```shell +python tools/data/super-resolution/reds/preprocess_reds_dataset.py --root-path ./data/REDS --make-lmdb +``` diff --git a/tools/data/preprocess_reds_dataset.py b/tools/data/super-resolution/reds/preprocess_reds_dataset.py similarity index 100% rename from tools/data/preprocess_reds_dataset.py rename to tools/data/super-resolution/reds/preprocess_reds_dataset.py diff --git a/tools/data/super-resolution/vimeo90k/README.md b/tools/data/super-resolution/vimeo90k/README.md new file mode 100644 index 0000000000..cd6f679043 --- /dev/null +++ b/tools/data/super-resolution/vimeo90k/README.md @@ -0,0 +1,18 @@ +# Preparing Vimeo90K Dataset + +[DATASET] + +```bibtex +@article{xue2019video, + title={Video Enhancement with Task-Oriented Flow}, + author={Xue, Tianfan and Chen, Baian and Wu, Jiajun and Wei, Donglai and Freeman, William T}, + journal={International Journal of Computer Vision (IJCV)}, + volume={127}, + number={8}, + pages={1106--1125}, + year={2019}, + publisher={Springer} +} +``` + +Download from [here](http://toflow.csail.mit.edu/) diff --git a/tools/data/preprocess_vimeo90k_dataset.py b/tools/data/super-resolution/vimeo90k/preprocess_vimeo90k_dataset.py similarity index 100% rename from tools/data/preprocess_vimeo90k_dataset.py rename to tools/data/super-resolution/vimeo90k/preprocess_vimeo90k_dataset.py