Skip to content

Commit 6643098

Browse files
committed
initial branch from Restormer.
1 parent ffd4616 commit 6643098

File tree

114 files changed

+125571
-130
lines changed

Some content is hidden

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

114 files changed

+125571
-130
lines changed

.gitignore

+9-128
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,10 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
1+
.ipynb_checkpoints/
2+
*.pyc
3+
*.png
4+
*.tif
5+
*.jpg
6+
*.pth
7+
*.mat
8+
*.npy
9+
.DS_Store
510

6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
25-
*.egg-info/
26-
.installed.cfg
27-
*.egg
28-
MANIFEST
29-
30-
# PyInstaller
31-
# Usually these files are written by a python script from a template
32-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33-
*.manifest
34-
*.spec
35-
36-
# Installer logs
37-
pip-log.txt
38-
pip-delete-this-directory.txt
39-
40-
# Unit test / coverage reports
41-
htmlcov/
42-
.tox/
43-
.nox/
44-
.coverage
45-
.coverage.*
46-
.cache
47-
nosetests.xml
48-
coverage.xml
49-
*.cover
50-
*.py,cover
51-
.hypothesis/
52-
.pytest_cache/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
target/
76-
77-
# Jupyter Notebook
78-
.ipynb_checkpoints
79-
80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
104-
# Environments
105-
.env
106-
.venv
107-
env/
108-
venv/
109-
ENV/
110-
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
122-
123-
# mypy
124-
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
127-
128-
# Pyre type checker
129-
.pyre/

Defocus_Deblurring/Datasets/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
For training and testing, your directory structure should look like this
2+
3+
`Datasets` <br/>
4+
`├──train` <br/>
5+
     `└──DPDD` <br/>
6+
          `├──inputL_crops` <br/>
7+
          `├──inputR_crops` <br/>
8+
          `├──inputC_crops` <br/>
9+
          `└──target_crops` <br/>
10+
`├──val` <br/>
11+
     `└──DPDD` <br/>
12+
          `├──inputL_crops` <br/>
13+
          `├──inputR_crops` <br/>
14+
          `├──inputC_crops` <br/>
15+
          `└──target_crops` <br/>
16+
`└──test` <br/>
17+
     `└──DPDD` <br/>
18+
          `├──inputL` <br/>
19+
          `├──inputR` <br/>
20+
          `├──inputC` <br/>
21+
          `└──target`
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# general settings
2+
name: DefocusDeblur_DualPixel_16bit_Restormer
3+
model_type: ImageCleanModel
4+
scale: 1
5+
num_gpu: 8 # set num_gpu: 0 for cpu mode
6+
manual_seed: 100
7+
8+
# dataset and data loader settings
9+
datasets:
10+
train:
11+
name: TrainSet
12+
type: Dataset_DefocusDeblur_DualPixel_16bit
13+
dataroot_gt: ./Defocus_Deblurring/Datasets/train/DPDD/target_crops
14+
dataroot_lqL: ./Defocus_Deblurring/Datasets/train/DPDD/inputL_crops
15+
dataroot_lqR: ./Defocus_Deblurring/Datasets/train/DPDD/inputR_crops
16+
geometric_augs: true
17+
18+
filename_tmpl: '{}'
19+
io_backend:
20+
type: disk
21+
22+
# data loader
23+
use_shuffle: true
24+
num_worker_per_gpu: 8
25+
batch_size_per_gpu: 8
26+
27+
### -------------Progressive training--------------------------
28+
mini_batch_sizes: [8,5,4,2,1,1] # Batch size per gpu
29+
iters: [92000,64000,48000,36000,36000,24000]
30+
gt_size: 384 # Max patch size for progressive training
31+
gt_sizes: [128,160,192,256,320,384] # Patch sizes for progressive training.
32+
### ------------------------------------------------------------
33+
34+
### ------- Training on single fixed-patch size 128x128---------
35+
# mini_batch_sizes: [8]
36+
# iters: [300000]
37+
# gt_size: 128
38+
# gt_sizes: [128]
39+
### ------------------------------------------------------------
40+
41+
dataset_enlarge_ratio: 1
42+
prefetch_mode: ~
43+
44+
val:
45+
name: ValSet
46+
type: Dataset_DefocusDeblur_DualPixel_16bit
47+
dataroot_gt: ./Defocus_Deblurring/Datasets/val/DPDD/target_crops
48+
dataroot_lqL: ./Defocus_Deblurring/Datasets/val/DPDD/inputL_crops
49+
dataroot_lqR: ./Defocus_Deblurring/Datasets/val/DPDD/inputR_crops
50+
io_backend:
51+
type: disk
52+
53+
# network structures
54+
network_g:
55+
type: Restormer
56+
inp_channels: 6
57+
out_channels: 3
58+
dim: 48
59+
num_blocks: [4,6,6,8]
60+
num_refinement_blocks: 4
61+
heads: [1,2,4,8]
62+
ffn_expansion_factor: 2.66
63+
bias: False
64+
LayerNorm_type: WithBias
65+
dual_pixel_task: True
66+
67+
68+
# path
69+
path:
70+
pretrain_network_g: ~
71+
strict_load_g: true
72+
resume_state: ~
73+
74+
# training settings
75+
train:
76+
total_iter: 300000
77+
warmup_iter: -1 # no warm up
78+
use_grad_clip: true
79+
80+
# Split 300k iterations into two cycles.
81+
# 1st cycle: fixed 3e-4 LR for 92k iters.
82+
# 2nd cycle: cosine annealing (3e-4 to 1e-6) for 208k iters.
83+
scheduler:
84+
type: CosineAnnealingRestartCyclicLR
85+
periods: [92000, 208000]
86+
restart_weights: [1,1]
87+
eta_mins: [0.0003,0.000001]
88+
89+
mixing_augs:
90+
mixup: false
91+
mixup_beta: 1.2
92+
use_identity: true
93+
94+
optim_g:
95+
type: AdamW
96+
lr: !!float 3e-4
97+
weight_decay: !!float 1e-4
98+
betas: [0.9, 0.999]
99+
100+
# losses
101+
pixel_opt:
102+
type: L1Loss
103+
loss_weight: 1
104+
reduction: mean
105+
106+
# validation settings
107+
val:
108+
window_size: 8
109+
val_freq: !!float 4e3
110+
save_img: false
111+
rgb2bgr: true
112+
use_image: false
113+
max_minibatch: 8
114+
115+
metrics:
116+
psnr: # metric name, can be arbitrary
117+
type: calculate_psnr
118+
crop_border: 0
119+
test_y_channel: false
120+
121+
# logging settings
122+
logger:
123+
print_freq: 1000
124+
save_checkpoint_freq: !!float 4e3
125+
use_tb_logger: true
126+
wandb:
127+
project: ~
128+
resume_id: ~
129+
130+
# dist training settings
131+
dist_params:
132+
backend: nccl
133+
port: 29500

0 commit comments

Comments
 (0)