update file organization, fix bug: scale argument in RRDB
This commit is contained in:
6
.github/workflows/pylint.yml
vendored
6
.github/workflows/pylint.yml
vendored
@@ -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
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Real-ESRGAN
|
||||
|
||||
[](https://github.com/xinntao/Real-ESRGAN/releases)
|
||||
[](https://github.com/xinntao/Real-ESRGAN/issues)
|
||||
[](https://github.com/xinntao/Real-ESRGAN/blob/master/LICENSE)
|
||||
[](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
10
data/__init__.py
Normal 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]
|
||||
@@ -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
10
models/__init__.py
Normal 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]
|
||||
Reference in New Issue
Block a user