Skip to content

Commit

Permalink
[Improvement] Update download link (#1554)
Browse files Browse the repository at this point in the history
* fix ckpt path

* fix ckpt_path

* rebase dev-1.x

* relative path for configs

* update link

* fix link

* -

* update model index

* fix bug in doc_link_checker

* fix bug in doc_link_checker

* fix link

* fix link

* fix link

* fix link

Co-authored-by: willaty <[email protected]>
  • Loading branch information
zengyh1900 and willaty authored Dec 26, 2022
1 parent e296dd0 commit c1faa1e
Show file tree
Hide file tree
Showing 114 changed files with 706 additions and 681 deletions.
9 changes: 9 additions & 0 deletions .dev_scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [7. Train failed or canceled jobs](#7-train-failed-or-canceled-jobs)
- [8. Deterministic training](#8-deterministic-training)
- [9. Automatically check links](#9-automatically-check-links)
- [10. Calculate flops](#10-calculate-flops)

## 1. Check UT

Expand Down Expand Up @@ -235,3 +236,11 @@ python .dev_scripts/doc_link_checker.py --target README.md
You can specify the `--target` by a file or a directory.

**Notes:** DO NOT use it in CI, because requiring too many http requirements by CI will cause 503 and CI will propabaly fail.

10. Calculate flops

To summarize the flops of different models, you can run the following commands:

```bash
python .dev_scripts/benchmark_valid_flop.py --flops --flops-str
```
46 changes: 37 additions & 9 deletions .dev_scripts/doc_link_checker.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
# Copyright (c) MegFlow. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
# /bin/python3

import argparse
import os
import re

import requests
from tqdm import tqdm


def make_parser():
parser = argparse.ArgumentParser('Doc link checker')
parser.add_argument(
'--http', default=False, type=bool, help='check http or not ')
parser.add_argument(
'--target',
default='./docs',
type=str,
help='the directory or file to check')
parser.add_argument(
'--ignore', type=str, nargs='+', default=[], help='input image size')
return parser


pattern = re.compile(r'\[.*?\]\(.*?\)')


def analyze_doc(home, path):
print('analyze {}'.format(path))
problem_list = []
code_block = 0
with open(path) as f:
Expand Down Expand Up @@ -51,11 +54,31 @@ def analyze_doc(home, path):
end = item.find(')')
ref = item[start + 1:end]

if ref.startswith('http') or ref.startswith('#'):
if ref.startswith('http'):
if ref.startswith(
'https://download.openmmlab.com/'
) or ref.startswith('http://download.openmmlab.com/'):
resp = requests.head(ref)
if resp.status_code == 200:
continue
else:
problem_list.append(ref)
else:
continue

if ref.startswith('#'):
continue

if ref == '<>':
continue

if '.md#' in ref:
ref = ref[ref.find('#'):]
fullpath = os.path.join(home, ref)
ref = ref[:ref.find('#')]
if ref.startswith('/'):
fullpath = os.path.join(
os.path.dirname(__file__), '../', ref[1:])
else:
fullpath = os.path.join(home, ref)
if not os.path.exists(fullpath):
problem_list.append(ref)
else:
Expand All @@ -68,11 +91,16 @@ def analyze_doc(home, path):
raise Exception('found link error')


def traverse(target):
def traverse(args):
target = args.target
if os.path.isfile(target):
analyze_doc(os.path.dirname(target), target)
return
for home, dirs, files in os.walk(target):
target_files = list(os.walk(target))
target_files.sort()
for home, dirs, files in tqdm(target_files):
if home in args.ignore:
continue
for filename in files:
if filename.endswith('.md'):
path = os.path.join(home, filename)
Expand All @@ -82,4 +110,4 @@ def traverse(target):

if __name__ == '__main__':
args = make_parser().parse_args()
traverse(args.target)
traverse(args)
8 changes: 1 addition & 7 deletions .dev_scripts/download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def download(args):
model_index.build_models_with_collections()
models = OrderedDict({model.name: model for model in model_index.models})

http_prefix_long = 'https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/' # noqa
http_prefix_short = 'https://download.openmmlab.com/mmediting/'
http_prefix_gen = 'https://download.openmmlab.com/mmgen/'

# load model list
if args.model_list:
Expand Down Expand Up @@ -109,12 +107,8 @@ def download(args):

model_weight_url = model_info.weights

if model_weight_url.startswith(http_prefix_long):
model_name = model_weight_url[len(http_prefix_long):]
elif model_weight_url.startswith(http_prefix_short):
if model_weight_url.startswith(http_prefix_short):
model_name = model_weight_url[len(http_prefix_short):]
elif model_weight_url.startswith(http_prefix_gen):
model_name = model_weight_url[len(http_prefix_gen):]
elif model_weight_url == '':
print(f'{model_info.Name} weight is missing')
return None
Expand Down
8 changes: 1 addition & 7 deletions .dev_scripts/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,10 @@ def create_test_job_batch(commands, model_info, args, port, script_name):
assert config.exists(), f'{fname}: {config} not found.'

http_prefix_short = 'https://download.openmmlab.com/mmediting/'
http_prefix_long = 'https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/' # noqa
http_prefix_gen = 'https://download.openmmlab.com/mmgen/'
model_weight_url = model_info.weights

if model_weight_url.startswith(http_prefix_long):
model_name = model_weight_url[len(http_prefix_long):]
elif model_weight_url.startswith(http_prefix_short):
if model_weight_url.startswith(http_prefix_short):
model_name = model_weight_url[len(http_prefix_short):]
elif model_weight_url.startswith(http_prefix_gen):
model_name = model_weight_url[len(http_prefix_gen):]
elif model_weight_url == '':
print(f'{fname} weight is missing')
return None
Expand Down
12 changes: 6 additions & 6 deletions configs/aot_gan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ State-of-the-art image inpainting approaches can suffer from generating distorte

**Places365-Challenge**

| Method | Mask Type | Resolution | Train Iters | Test Set | l1 error | PSNR | SSIM | GPU Info | Download |
| :--------------------------------------------------: | :----------------: | :--------: | :---------: | :-----------: | :------: | :---: | :---: | :---------------------: | :-----------------------------------------------------: |
| [AOT-GAN](/configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py) | free-form (50-60%) | 512x512 | 500k | Places365-val | 7.07 | 19.01 | 0.682 | 4 (GeForce GTX 1080 Ti) | [model](https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth) \| [log](https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.json) |
| Method | Mask Type | Resolution | Train Iters | Test Set | l1 error | PSNR | SSIM | GPU Info | Download |
| :------------------------------------------------: | :----------------: | :--------: | :---------: | :-----------: | :------: | :---: | :---: | :---------------------: | :-------------------------------------------------------: |
| [AOT-GAN](./aot-gan_smpgan_4xb4_places-512x512.py) | free-form (50-60%) | 512x512 | 500k | Places365-val | 7.07 | 19.01 | 0.682 | 4 (GeForce GTX 1080 Ti) | [model](https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth) \| [log](https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.json) |

More results for different mask area:

Expand Down Expand Up @@ -84,13 +84,13 @@ You can use the following commands to test a model with cpu or single/multiple G

```shell
# cpu test
CUDA_VISIBLE_DEVICES=-1 python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
CUDA_VISIBLE_DEVICES=-1 python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth

# single-gpu test
python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth

# multi-gpu test
./tools/dist_test.sh configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth 8
./tools/dist_test.sh configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth 8
```

For more details, you can refer to **Test a pre-trained model** part in [train_test.md](/docs/en/user_guides/train_test.md#Test-a-pre-trained-model-in-MMEditing).
Expand Down
12 changes: 6 additions & 6 deletions configs/aot_gan/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

**Places365-Challenge**

| 算法 | 掩膜类型 | 分辨率 | 训练集容量 | 测试集 | l1 损失 | PSNR | SSIM | GPU 信息 | 下载 |
| :------------------------------------------------------: | :----------------: | :-----: | :--------: | :-----------: | :-----: | :---: | :---: | :---------------------: | :------------------------------------------------------: |
| [AOT-GAN](/configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py) | free-form (50-60%) | 512x512 | 500k | Places365-val | 7.07 | 19.01 | 0.682 | 4 (GeForce GTX 1080 Ti) | [模型](https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth) \| [日志](https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.json) |
| 算法 | 掩膜类型 | 分辨率 | 训练集容量 | 测试集 | l1 损失 | PSNR | SSIM | GPU 信息 | 下载 |
| :------------------------------------------------: | :----------------: | :-----: | :--------: | :-----------: | :-----: | :---: | :---: | :---------------------: | :------------------------------------------------------------: |
| [AOT-GAN](./aot-gan_smpgan_4xb4_places-512x512.py) | free-form (50-60%) | 512x512 | 500k | Places365-val | 7.07 | 19.01 | 0.682 | 4 (GeForce GTX 1080 Ti) | [模型](https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth) \| [日志](https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.json) |

<!-- SKIP THIS TABLE -->

Expand Down Expand Up @@ -80,13 +80,13 @@ python tools/train.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py

```shell
# CPU上测试
CUDA_VISIBLE_DEVICES=-1 python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
CUDA_VISIBLE_DEVICES=-1 python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth

# 单个GPU上测试
python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
python tools/test.py configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth

# 多个GPU上测试
./tools/dist_test.sh configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth 8
./tools/dist_test.sh configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth 8
```

更多细节可以参考 [train_test.md](/docs/zh_cn/user_guides/train_test.md) 中的 **Test a pre-trained model** 部分。
Expand Down
2 changes: 1 addition & 1 deletion configs/aot_gan/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Models:
SSIM: 0.682
l1 error: 7.07
Task: Inpainting
Weights: https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
Weights: https://download.openmmlab.com/mmediting/inpainting/aot_gan/AOT-GAN_512x512_4x12_places_20220509-6641441b.pth
10 changes: 5 additions & 5 deletions configs/basicvsr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Video super-resolution (VSR) approaches tend to have more components than the im
Evaluated on RGB channels for REDS4 and Y channel for others. The metrics are `PSNR` / `SSIM` .
The pretrained weights of SPyNet can be found [here](https://download.openmmlab.com/mmediting/restorers/basicvsr/spynet_20210409-c6c1bd09.pth).

| Method | REDS4 (BIx4) PSNR (RGB) | Vimeo-90K-T (BIx4) PSNR (Y) | Vid4 (BIx4) PSNR (Y) | UDM10 (BDx4) PSNR (Y) | Vimeo-90K-T (BDx4) PSNR (Y) | Vid4 (BDx4) PSNR (Y) | REDS4 (BIx4) SSIM (RGB) | Vimeo-90K-T (BIx4) SSIM (Y) | Vid4 (BIx4) SSIM (Y) | UDM10 (BDx4) SSIM (Y) | Vimeo-90K-T (BDx4) SSIM (Y) | Vid4 (BDx4) SSIM (Y) | GPU Info | Download |
| :--------------------------------------------------------------------: | :---------------------: | :-------------------------: | :------------------: | :-------------------: | :-------------------------: | :------------------: | :---------------------: | :-------------------------: | :------------------: | :-------------------: | :-------------------------: | :------------------: | :----------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| [basicvsr_reds4](/configs/basicvsr/basicvsr_2xb4_reds4.py) | **31.4170** | 36.2848 | 27.2694 | 33.4478 | 34.4700 | 24.4541 | **0.8909** | 0.9395 | 0.8318 | 0.9306 | 0.9286 | 0.7455 | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_reds4_20120409-0e599677.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_reds4_20210409_092646.log.json) |
| [basicvsr_vimeo90k_bi](/configs/basicvsr/basicvsr_2xb4_vimeo90k-bi.py) | 30.3128 | **37.2026** | **27.2755** | 34.5554 | 34.8097 | 25.0517 | 0.8660 | **0.9451** | **0.8248** | 0.9434 | 0.9316 | 0.7636 | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bi_20210409-d2d8f760.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bi_20210409_132702.log.json) |
| [basicvsr_vimeo90k_bd](/configs/basicvsr/basicvsr_2xb4_vimeo90k-bd.py) | 29.0376 | 34.6427 | 26.2708 | **39.9953** | **37.5501** | **27.9791** | 0.8481 | 0.9335 | 0.8022 | **0.9695** | **0.9499** | **0.8556** | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bd_20210409-0154dd64.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bd_20210409_132740.log.json) |
| Method | REDS4 (BIx4) PSNR (RGB) | Vimeo-90K-T (BIx4) PSNR (Y) | Vid4 (BIx4) PSNR (Y) | UDM10 (BDx4) PSNR (Y) | Vimeo-90K-T (BDx4) PSNR (Y) | Vid4 (BDx4) PSNR (Y) | REDS4 (BIx4) SSIM (RGB) | Vimeo-90K-T (BIx4) SSIM (Y) | Vid4 (BIx4) SSIM (Y) | UDM10 (BDx4) SSIM (Y) | Vimeo-90K-T (BDx4) SSIM (Y) | Vid4 (BDx4) SSIM (Y) | GPU Info | Download |
| :----------------------------------------------------: | :---------------------: | :-------------------------: | :------------------: | :-------------------: | :-------------------------: | :------------------: | :---------------------: | :-------------------------: | :------------------: | :-------------------: | :-------------------------: | :------------------: | :----------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| [basicvsr_reds4](./basicvsr_2xb4_reds4.py) | **31.4170** | 36.2848 | 27.2694 | 33.4478 | 34.4700 | 24.4541 | **0.8909** | 0.9395 | 0.8318 | 0.9306 | 0.9286 | 0.7455 | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_reds4_20120409-0e599677.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_reds4_20210409_092646.log.json) |
| [basicvsr_vimeo90k_bi](./basicvsr_2xb4_vimeo90k-bi.py) | 30.3128 | **37.2026** | **27.2755** | 34.5554 | 34.8097 | 25.0517 | 0.8660 | **0.9451** | **0.8248** | 0.9434 | 0.9316 | 0.7636 | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bi_20210409-d2d8f760.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bi_20210409_132702.log.json) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | 29.0376 | 34.6427 | 26.2708 | **39.9953** | **37.5501** | **27.9791** | 0.8481 | 0.9335 | 0.8022 | **0.9695** | **0.9499** | **0.8556** | 2 (Tesla V100-PCIE-32GB) | [model](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bd_20210409-0154dd64.pth) \| [log](https://download.openmmlab.com/mmediting/restorers/basicvsr/basicvsr_vimeo90k_bd_20210409_132740.log.json) |

## Quick Start

Expand Down
Loading

0 comments on commit c1faa1e

Please sign in to comment.