Skip to content

Commit a19aac6

Browse files
authored
Update v1.0
1 parent 35ac620 commit a19aac6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1103
-319
lines changed

.flake8

-7
This file was deleted.

.github/workflows/pylint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
- name: Lint
2626
run: |
2727
flake8 .
28-
isort --check-only --diff basicsr/ scripts/ tests/
29-
yapf -r -d basicsr/ options/ scripts/ tests/
28+
isort --check-only --diff basicsr/ options/ scripts/ tests/ setup.py
29+
yapf -r -d basicsr/ options/ scripts/ tests/ setup.py

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ experiments/*
22
results/*
33
tb_logger/*
44
datasets/*
5-
wandb
5+
wandb/*
6+
67
.vscode
78

89
version.py
@@ -12,9 +13,7 @@ version.py
1213
*.jpg
1314
*.gif
1415
*.pth
15-
*.pytorch
1616
*.zip
17-
*.npz
1817

1918
# template
2019

.isort.cfg

-2
This file was deleted.

.pre-commit-config.yaml

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,40 @@
11
repos:
2+
# flake8
23
- repo: https://github.com/PyCQA/flake8
3-
rev: 3.7.9
4+
rev: 3.8.3
45
hooks:
56
- id: flake8
6-
args: ['--config=.flake8', '--ignore=W504, W503']
7+
args: ["--config=setup.cfg", "--ignore=W504, W503"]
8+
9+
# modify known_third_party
710
- repo: https://github.com/asottile/seed-isort-config
8-
rev: v2.1.0
11+
rev: v2.2.0
912
hooks:
1013
- id: seed-isort-config
14+
15+
# isort
1116
- repo: https://github.com/timothycrosley/isort
12-
rev: 5.0.3
17+
rev: 5.1.4
1318
hooks:
1419
- id: isort
20+
21+
# yapf
1522
- repo: https://github.com/pre-commit/mirrors-yapf
16-
rev: v0.29.0
23+
rev: v0.30.0
1724
hooks:
1825
- id: yapf
26+
27+
# pre-commit-hooks
1928
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v2.5.0
29+
rev: v3.1.0
2130
hooks:
22-
- id: trailing-whitespace
23-
- id: check-yaml
24-
- id: end-of-file-fixer
25-
- id: requirements-txt-fixer
26-
- id: double-quote-string-fixer
27-
- id: fix-encoding-pragma
31+
- id: trailing-whitespace # Trim trailing whitespace
32+
- id: check-yaml # Attempt to load all yaml files to verify syntax
33+
- id: check-merge-conflict # Check for files that contain merge conflict strings
34+
- id: double-quote-string-fixer # Replace double quoted strings with single quoted strings
35+
- id: end-of-file-fixer # Make sure files end in a newline and only a newline
36+
- id: requirements-txt-fixer # Sort entries in requirements.txt and remove incorrect entry for pkg-resources==0.0.0
37+
- id: fix-encoding-pragma # Remove the coding pragma: # -*- coding: utf-8 -*-
2838
args: ["--remove"]
39+
- id: mixed-line-ending # Replace or check mixed line ending
40+
args: ["--fix=lf"]

.style.yapf

-4
This file was deleted.

LICENSE LICENSE/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2018-2020 BasicSR Authors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

LICENSE/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# License
2+
3+
4+
NIQE metrics: the codes are transfered from the official MATLAB codes downloaded from http://live.ece.utexas.edu/research/quality/niqe_release.zip
5+
6+
A. Mittal, R. Soundararajan and A. C. Bovik, "Making a Completely Blind Image Quality Analyzer", IEEE Signal Processing Letters, 2012.

README.md

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
# BasicSR
22

3-
[GitHub](https://github.com/xinntao/BasicSR) | [Gitee码云](https://gitee.com/xinntao/BasicSR); [English](https://github.com/xinntao/BasicSR) | [简体中文](https://github.com/xinntao/BasicSR/blob/master/README_CN.md)
3+
[GitHub](https://github.com/xinntao/BasicSR) | [Gitee码云](https://gitee.com/xinntao/BasicSR) <br>
4+
[English](README.md) | [简体中文](README_CN.md)
45

5-
BasicSR is an open source image and video super-resolution toolbox based on PyTorch.<br>
6-
([ESRGAN](https://github.com/xinntao/ESRGAN), [EDVR](https://github.com/xinntao/EDVR), [DNI](https://github.com/xinntao/DNI), [SFTGAN](https://github.com/xinntao/SFTGAN))
6+
BasicSR is an open source image and video super-resolution toolbox based on PyTorch (may extend to more restoration tasks in the future).<br>
7+
<sub>([ESRGAN](https://github.com/xinntao/ESRGAN), [EDVR](https://github.com/xinntao/EDVR), [DNI](https://github.com/xinntao/DNI), [SFTGAN](https://github.com/xinntao/SFTGAN))</sub>
78

89
## Dependencies and Installation
9-
10-
- Python 3 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux))
10+
- Python >= 3.7 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html))
1111
- [PyTorch >= 1.3](https://pytorch.org/)
1212
- NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
1313

14-
Please run the following cmds to install BasicSR.
14+
Please run the following commands in the BasicSR root path to install BasicSR:
1515
```bash
1616
python setup.py develop
17-
pip install requirements.txt
17+
pip install -r requirements.txt
1818
```
1919

20+
Note that BasicSR is only tested in Ubuntu, and may be not suitable for Windows. You may try [Windows WSL with CUDA supports](https://docs.microsoft.com/en-us/windows/win32/direct3d12/gpu-cuda-in-wsl) :-) (It is now only available for insider build with Fast ring).
21+
2022
## TODO List
2123
Please see [project boards](https://github.com/xinntao/BasicSR/projects).
2224

2325
## Dataset Preparation
24-
Please refer to [DATASETS.md](docs/DATASETS.md) for more details.
26+
Please refer to [Datasets.md](docs/Datasets.md) for more details.
2527

26-
## Training and Testing
27-
Please see [TrainingTesting.md](docs/TrainingTesting.md) for the basic usage, *i.e.,* training and testing.
28+
## Train and Test
29+
Please see [TrainTest.md](docs/TrainTest.md) for the basic usage, *i.e.,* training and testing.
2830

2931
## Model Zoo and Baselines
30-
Results and pre-trained models are available in the [ModelZoo.md](docs/ModelZoo.md).
32+
Results and pre-trained models are available in [ModelZoo.md](docs/ModelZoo.md).
33+
34+
## Codebase Designs and Conventions
35+
Please see [DesignConvention.md](docs/DesignConvention.md) for the designs and convetions of the BasicSR codebase.
3136

3237
## License
3338
This project is released under the Apache 2.0 license.
39+
More details are in [LICENSE](LICENSE/README.md).
3440

3541
#### Contact
36-
If you have any question, please email `xintao.alpha@gmail.com`.
42+
If you have any question, please email `xintao.wang@outlook.com`.
3743

3844
<sub><sup>[BasicSR-private](https://github.com/xinntao/BasicSR-private)</sup></sub>

README_CN.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# BasicSR
2+
3+
[GitHub](https://github.com/xinntao/BasicSR) | [Gitee码云](https://gitee.com/xinntao/BasicSR) <br>
4+
[English](README.md) | [简体中文](README_CN.md)
5+
6+
BasicSR 是一个基于 PyTorch 的开源图像视频超分辨率 (Super-Resolution) 工具箱 (之后或许会支持更多的 Restoration 任务).<br>
7+
<sub>([ESRGAN](https://github.com/xinntao/ESRGAN), [EDVR](https://github.com/xinntao/EDVR), [DNI](https://github.com/xinntao/DNI), [SFTGAN](https://github.com/xinntao/SFTGAN))</sub>
8+
9+
## 依赖和安装
10+
- Python >= 3.7 (推荐使用 [Anaconda](https://www.anaconda.com/download/#linux)[Miniconda](https://docs.conda.io/en/latest/miniconda.html))
11+
- [PyTorch >= 1.3](https://pytorch.org/)
12+
- NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)
13+
14+
在BasicSR的根目录下运行以下命令:
15+
```bash
16+
python setup.py develop
17+
pip install -r requirements.txt
18+
```
19+
20+
注意: BasicSR 仅在 Ubuntu 下进行测试,或许不支持Windows. 可以在Windows下尝试[支持CUDA的Windows WSL](https://docs.microsoft.com/en-us/windows/win32/direct3d12/gpu-cuda-in-wsl) :-) (目前只有Fast ring的预览版系统可以安装).
21+
22+
## TODO 清单
23+
参见 [project boards](https://github.com/xinntao/BasicSR/projects).
24+
25+
## 数据准备
26+
参见 [Datasets_CN.md](docs/Datasets_CN.md).
27+
28+
## 训练和测试
29+
参见 [TrainTest_CN.md](docs/TrainTest_CN.md).
30+
31+
## 模型库和基准
32+
结果和预训练的模型在 [ModelZoo_CN.md](docs/ModelZoo_CN.md).
33+
34+
## 代码库的设计和约定
35+
参见 [DesignConvention_CN.md](docs/DesignConvention_CN.md).
36+
37+
## 许可
38+
本项目使用 Apache 2.0 license.
39+
更多细节参见 [LICENSE](LICENSE/README.md).
40+
41+
#### 联系
42+
若有任何问题, 请电邮 `xintao.wang@outlook.com`.
43+
44+
<sub><sup>[BasicSR-private](https://github.com/xinntao/BasicSR-private)</sup></sub>
45+

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

basicsr/data/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import importlib
2-
from os import path as osp
3-
42
import mmcv
53
import torch
64
import torch.utils.data
5+
from os import path as osp
76

87
from basicsr.utils import get_root_logger
98

basicsr/data/data_sampler.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import math
2-
32
import torch
43
from torch import distributed as dist
54
from torch.utils.data.sampler import Sampler
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
240 100 (720,1280,3)
2+
241 100 (720,1280,3)
3+
246 100 (720,1280,3)
4+
257 100 (720,1280,3)

basicsr/data/reds_dataset.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import random
2-
from pathlib import Path
3-
41
import mmcv
52
import numpy as np
3+
import random
64
import torch
5+
from pathlib import Path
76
from torch.utils import data as data
87

98
from basicsr.data.transforms import augment, paired_random_crop, totensor
@@ -121,7 +120,8 @@ def __getitem__(self, index):
121120
end_frame_idx = center_frame_idx + self.num_half_frames * interval
122121
while (start_frame_idx < 0) or (end_frame_idx > 99):
123122
center_frame_idx = random.randint(0, 99)
124-
start_frame_idx = center_frame_idx - self.num_half_frames * interval
123+
start_frame_idx = (
124+
center_frame_idx - self.num_half_frames * interval)
125125
end_frame_idx = center_frame_idx + self.num_half_frames * interval
126126
frame_name = f'{center_frame_idx:08d}'
127127
neighbor_list = list(

basicsr/data/single_image_dataset.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from os import path as osp
2-
31
import mmcv
42
import numpy as np
3+
from os import path as osp
54
from torch.utils import data as data
65

76
from basicsr.data.transforms import totensor

basicsr/data/transforms.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import random
2-
31
import mmcv
2+
import random
43
import torch
54

65

basicsr/data/util.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from os import path as osp
2-
31
import mmcv
42
import numpy as np
53
import torch
4+
from os import path as osp
65
from torch.nn import functional as F
76

87
from basicsr.data.transforms import mod_crop, totensor

basicsr/data/video_test_dataset.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import glob
2-
from os import path as osp
3-
42
import mmcv
53
import torch
4+
from os import path as osp
65
from torch.utils import data as data
76

87
from basicsr.data import util as util
@@ -13,7 +12,7 @@
1312
class VideoTestDataset(data.Dataset):
1413
"""Video test dataset.
1514
16-
Supported datasets: Vid4, REDS4, REDS-official.
15+
Supported datasets: Vid4, REDS4, REDSofficial.
1716
More generally, it supports testing dataset with following structures:
1817
1918
dataroot
@@ -77,7 +76,7 @@ def __init__(self, opt):
7776
subfolders_lq = sorted(glob.glob(osp.join(self.lq_root, '*')))
7877
subfolders_gt = sorted(glob.glob(osp.join(self.gt_root, '*')))
7978

80-
if opt['name'].lower() in ['vid4', 'reds4', 'reds-official']:
79+
if opt['name'].lower() in ['vid4', 'reds4', 'redsofficial']:
8180
for subfolder_lq, subfolder_gt in zip(subfolders_lq,
8281
subfolders_gt):
8382
# get frame list for lq and gt

basicsr/data/vimeo90k_dataset.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import random
2-
from pathlib import Path
3-
41
import mmcv
52
import numpy as np
3+
import random
64
import torch
5+
from pathlib import Path
76
from torch.utils import data as data
87

98
from basicsr.data.transforms import augment, paired_random_crop, totensor

basicsr/metrics/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .niqe import calculate_niqe
12
from .psnr_ssim import calculate_psnr, calculate_ssim
23

3-
__all__ = ['calculate_psnr', 'calculate_ssim']
4+
__all__ = ['calculate_psnr', 'calculate_ssim', 'calculate_niqe']

0 commit comments

Comments
 (0)