update file organization, fix bug: scale argument in RRDB

This commit is contained in:
Xintao
2021-07-23 17:52:05 +08:00
parent cc153d278a
commit 7fcc11f255
5 changed files with 31 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
name: Python Lint
name: PyLint
on: [push, pull_request]
@@ -26,5 +26,5 @@ jobs:
- name: Lint
run: |
flake8 .
isort --check-only --diff basicsr/ options/ scripts/ tests/ inference/ setup.py
yapf -r -d basicsr/ options/ scripts/ tests/ inference/ setup.py
isort --check-only --diff data/ models/ inference_realesrgan.py
yapf -r -d data/ models/ inference_realesrgan.py

View File

@@ -1,5 +1,10 @@
# Real-ESRGAN
[![download](https://img.shields.io/github/downloads/xinntao/Real-ESRGAN/total.svg)](https://github.com/xinntao/Real-ESRGAN/releases)
[![Open issue](https://isitmaintained.com/badge/open/xinntao/Real-ESRGAN.svg)](https://github.com/xinntao/Real-ESRGAN/issues)
[![LICENSE](https://img.shields.io/github/license/xinntao/Real-ESRGAN.svg)](https://github.com/xinntao/Real-ESRGAN/blob/master/LICENSE)
[![python lint](https://github.com/xinntao/Real-ESRGAN/actions/workflows/pylint.yml/badge.svg)](https://github.com/xinntao/Real-ESRGAN/blob/master/.github/workflows/pylint.yml)
[**Paper**](https://arxiv.org/abs/2107.10833)
### :book: Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data

10
data/__init__.py Normal file
View File

@@ -0,0 +1,10 @@
import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import dataset modules for registry
# scan all the files that end with '_dataset.py' under the data folder
data_folder = osp.dirname(osp.abspath(__file__))
dataset_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(data_folder) if v.endswith('_dataset.py')]
# import all the dataset modules
_dataset_modules = [importlib.import_module(f'data.{file_name}') for file_name in dataset_filenames]

View File

@@ -17,7 +17,9 @@ def main():
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# set up model
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=args.scale)
# FIXME: currenly RRDBNet in BasicSR does not support scale argument. Will update later
# model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=args.scale)
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
loadnet = torch.load(args.model_path)
model.load_state_dict(loadnet['params_ema'], strict=True)
model.eval()

10
models/__init__.py Normal file
View File

@@ -0,0 +1,10 @@
import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import model modules for registry
# scan all the files that end with '_model.py' under the model folder
model_folder = osp.dirname(osp.abspath(__file__))
model_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(model_folder) if v.endswith('_model.py')]
# import all the model modules
_model_modules = [importlib.import_module(f'models.{file_name}') for file_name in model_filenames]