From 67771ec7bd8cc759e9f28ca78a14c39ce64468df Mon Sep 17 00:00:00 2001 From: jaewon-lee-b <jaewon.lee.b@gmail.com> Date: Wed, 1 Jun 2022 07:39:16 +0000 Subject: [PATCH] initial commit --- README.md | 4 ++-- train_ltew.py | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 092af29..26482bb 100644 --- a/README.md +++ b/README.md @@ -111,13 +111,13 @@ LTEW-RCAN|[Google Drive](https://drive.google.com/file/d/1XPxwop6Q5EZGi9pM392VC5 ### **Asymmetric-scale SR** -**Train**: `python train_lte.py --config configs/train-div2k/train_rcan-lte.yaml --gpu 0` +**Train**: `CUDA_VISIBLE_DEVICES=0 python train_lte.py --config configs/train-div2k/train_rcan-lte.yaml --gpu 0` **Test**: `bash ./scripts/test-benchmark-asym.sh save/_train_rcan-lte/epoch-last.pth 0` ### **Homography transformation** -**Train**: `python train_ltew.py --config configs/train-div2k/train_rrdb-lte-warp.yaml --gpu 0,1` +**Train**: `CUDA_VISIBLE_DEVICES=0,1 python train_ltew.py --config configs/train-div2k/train_rrdb-lte-warp.yaml --gpu 0,1` **Test**: `bash ./scripts/test-benchmark-warp.sh ./save/_train_rrdb-lte-warp/epoch-last.pth 0` diff --git a/train_ltew.py b/train_ltew.py index a948cbe..d217a06 100644 --- a/train_ltew.py +++ b/train_ltew.py @@ -119,7 +119,6 @@ def train(train_loader, model, optimizer, \ ) lr_crop = utils.quantize(lr_crop) m = transform.compensate_offset(m, ix, iy) - ################################################################################## ############### backward map (coord, cell) from Y space to X space ############### gridx, mask = utils.gridy2gridx_homography(batch['coord'][0], \ @@ -127,7 +126,6 @@ def train(train_loader, model, optimizer, \ cell = utils.celly2cellx_homography(batch['cell'][0], \ hr.shape[-2], hr.shape[-1], lr_crop.shape[-2], lr_crop.shape[-1], m.cuda(), cpu=False) # backward map cell from Y to X - ################################################################################## ######################## sample query point to train LTEW ######################## num_samples = lr_crop.shape[-2] * lr_crop.shape[-1] @@ -137,7 +135,6 @@ def train(train_loader, model, optimizer, \ gridx = gridx[sample_lst].unsqueeze(0).expand(hr.shape[0], -1, -1) # coord sample cell = cell[sample_lst].unsqueeze(0).expand(hr.shape[0], -1, -1) # cell sample gt = (batch['gt'][:, sample_lst].cuda() - gt_sub) / gt_div # gt sample - ################################################################################## pred = model(lr_crop, gridx, cell) loss = loss_fn(pred, gt)