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

update model index and metafile #1593

Merged
merged 5 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
502 changes: 197 additions & 305 deletions .dev_scripts/update_model_index.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions .dev_scripts/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .job_util import (filter_jobs, get_info_from_id, parse_job_list,
parse_job_list_from_file)
from .modelindex import (collate_metrics, dump_yaml_and_check_difference,
found_table, modelindex_to_dict)

__all__ = [
'modelindex_to_dict', 'found_table', 'dump_yaml_and_check_difference',
'collate_metrics', 'parse_job_list', 'parse_job_list_from_file',
'get_info_from_id', 'filter_jobs'
]
File renamed without changes.
88 changes: 88 additions & 0 deletions .dev_scripts/utils/modelindex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import os.path as osp

import mmengine
from modelindex.models.Collection import Collection
from modelindex.models.Model import Model


def dump_yaml_and_check_difference(obj, file):
"""Dump object to a yaml file, and check if the file content is different
from the original.

Args:
obj (any): The python object to be dumped.
file (str): YAML filename to dump the object to.
Returns:
Bool: If the target YAML file is different from the original.
"""

str_dump = mmengine.dump(
obj, None, file_format='yaml', sort_keys=True,
line_break='\n') # force use LF

if osp.isfile(file):
file_exists = True
# print(f' exist {file}')
with open(file, 'r', encoding='utf-8') as f:
str_orig = f.read()
else:
file_exists = False
str_orig = None

if file_exists and str_orig == str_dump:
is_different = False
else:
is_different = True
print(f' update {file}')
with open(file, 'w', encoding='utf-8') as f:
f.write(str_dump)

return is_different


def collate_metrics(keys):
"""Collect metrics from the first row of the table.

Args:
keys (List): Elements in the first row of the table.

Returns:
dict: A dict of metrics.
"""
used_metrics = dict()
for idx, key in enumerate(keys):
if key in ['Model', 'Dataset', 'Training Resources', 'Download']:
continue
used_metrics[key] = idx
return used_metrics


def found_table(lines, i):
if i + 1 >= len(lines):
return False
if i - 2 < 0 or 'SKIP THIS TABLE' in lines[i - 2]:
return False
if lines[i][0] != '|':
return False

for c in ['| :', '|:', '|-']:
if c in lines[i + 1]:
return True
return False


def modelindex_to_dict(model):
if isinstance(model, Collection):
result = model.data
if model.metadata is not None:
result['Metadata'] = model.metadata.data
elif isinstance(model, Model):
result = model.data
if model.metadata is not None:
result['Metadata'] = model.metadata.data
if model.results is not None:
results_list = []
for r in model.results:
results_list.append(r.data)
result['Results'] = results_list
return result
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
name: update-model-index
description: Collect model information and update model-index.yml
entry: .dev_scripts/update_model_index.py
additional_dependencies: [mmengine]
additional_dependencies: [mmengine, modelindex, tqdm, rich]
language: python
files: ^configs/.*\.md$
require_serial: true
Expand Down
10 changes: 4 additions & 6 deletions configs/aot_gan/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AOT-GAN (TVCG'2021)

> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://arxiv.org/pdf/2104.01431.pdf)
> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://arxiv.org/abs/2104.01431.pdf)

> **Task**: Inpainting

Expand All @@ -20,11 +20,9 @@ State-of-the-art image inpainting approaches can suffer from generating distorte

## Results and models

**Places365-Challenge**

| 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) |
| Model | Dataset | Mask Type | Resolution | Train Iters | Test Set | l1 error | PSNR | SSIM | Training Resources | Download |
| :----------------------------------------: | :-----------------: | :----------------: | :--------: | :---------: | :-----------: | :------: | :---: | :---: | :---------------------: | :--------------------------------------------: |
| [AOT-GAN](./aot-gan_smpgan_4xb4_places-512x512.py) | Places365-Challenge | 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
2 changes: 1 addition & 1 deletion configs/aot_gan/README_zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AOT-GAN (TVCG'2021)

> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://arxiv.org/pdf/2104.01431.pdf)
> [AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting](https://arxiv.org/abs/2104.01431.pdf)

> **任务**: 图像修复

Expand Down
14 changes: 5 additions & 9 deletions configs/aot_gan/metafile.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
Collections:
- Metadata:
Architecture:
- AOT-GAN
Name: AOT-GAN
- Name: AOT-GAN
Paper:
- https://arxiv.org/pdf/2104.01431.pdf
Title: 'AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image
Inpainting'
URL: https://arxiv.org/abs/2104.01431.pdf
README: configs/aot_gan/README.md
Task:
- inpainting
Year: 2021
Models:
- Config: configs/aot_gan/aot-gan_smpgan_4xb4_places-512x512.py
In Collection: AOT-GAN
Metadata:
GPUs: 4 (GeForce GTX 1080 Ti)
Training Data: PLACES
Name: aot-gan_smpgan_4xb4_places-512x512
Results:
- Dataset: PLACES
- Dataset: Places365-Challenge
Metrics:
PSNR: 19.01
SSIM: 0.682
Expand Down
25 changes: 20 additions & 5 deletions configs/basicvsr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,26 @@ 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](./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) |
| Model | Dataset | PSNR (RGB) | SSIM (RGB) | PSNR (Y) | SSIM (Y) | Training Resources | Download |
| :----------------------------------------------------: | :----------------: | :---------: | :--------: | :---------: | :--------: | :----------------------: | :------------------------------------------------------------: |
| [basicvsr_reds4](./basicvsr_2xb4_reds4.py) | REDS4 (BIx4) | **31.4170** | **0.8909** | - | - | 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_reds4](./basicvsr_2xb4_reds4.py) | UDM10 (BDx4) | - | - | 33.4478 | 0.9306 | 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_reds4](./basicvsr_2xb4_reds4.py) | Vimeo-90K-T (BIx4) | - | - | 36.2848 | 0.9395 | 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_reds4](./basicvsr_2xb4_reds4.py) | Vimeo-90K-T (BDx4) | - | - | 34.4700 | 0.9286 | 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_reds4](./basicvsr_2xb4_reds4.py) | Vid4 (BIx4) | - | - | 27.2694 | 0.8318 | 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_reds4](./basicvsr_2xb4_reds4.py) | Vid4 (BDx4) | - | - | 24.4541 | 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) | REDS4 (BIx4) | 30.3128 | 0.8660 | - | - | 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_bi](./basicvsr_2xb4_vimeo90k-bi.py) | UDM10 (BDx4) | - | - | 34.5554 | **0.9451** | 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](./basicvsr_2xb4_vimeo90k-bi.py) | Vimeo-90K-T (BIx4) | - | - | **37.2026** | 0.9434 | 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](./basicvsr_2xb4_vimeo90k-bi.py) | Vimeo-90K-T (BDx4) | - | - | 34.8097 | 0.9316 | 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](./basicvsr_2xb4_vimeo90k-bi.py) | Vid4 (BIx4) | - | - | **27.2755** | **0.8248** | 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](./basicvsr_2xb4_vimeo90k-bi.py) | Vid4 (BDx4) | - | - | 25.0517 | 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_bd](./basicvsr_2xb4_vimeo90k-bd.py) | REDS4 (BIx4) | 29.0376 | 0.8481 | - | - | 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) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | UDM10 (BDx4) | - | - | **39.9953** | **0.9695** | 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) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | Vimeo-90K-T (BIx4) | - | - | 34.6427 | 0.9335 | 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) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | Vimeo-90K-T (BDx4) | - | - | **37.5501** | **0.9499** | 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) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | Vid4 (BIx4) | - | - | 26.2708 | 0.8022 | 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) |
| [basicvsr_vimeo90k_bd](./basicvsr_2xb4_vimeo90k-bd.py) | Vid4 (BDx4) | - | - | **27.9791** | **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