Zeqiang-Lai / Crossnet-PyTorch

Unofficial implementation of CrossNet and CrossNet++.
4 stars 3 forks source link

About torchlight #1

Open stdinR opened 1 year ago

stdinR commented 1 year ago

How to install torchlight? I used pip install torchlight (0.0.1) or pip install torchlights but none of them seemed to work. I wondered what's your version of torchlight

Zeqiang-Lai commented 1 year ago

You could try this version

https://github.com/Zeqiang-Lai/torchlight/tree/90305e52599a037f36e77c4b5a23d196408c798a

stdinR commented 1 year ago

You could try this version

https://github.com/Zeqiang-Lai/torchlight/tree/90305e52599a037f36e77c4b5a23d196408c798a

thanks a lot. But a new issue occurs, it seems like my configuration of crossnet.yaml is somewhat wrong? The issues are like : ================Epoch[1]=================== Iters Elapsed Time Speed
0/64 - -
0.0% |
Traceback (most recent call last): File "run.py", line 24, in run(args, cfg, module, train_loader, test_loader, test_loader) File "/home/name/Crossnet-PyTorch-master-original/torchlight/entry.py", line 33, in run engine.train(train_loader, valid_loader=valid_loader) File "/home/name/Crossnet-PyTorch-master-original/torchlight/core/engine.py", line 89, in train self._train(train_loader, epoch, valid_loader) File "/home/name/Crossnet-PyTorch-master-original/torchlight/core/engine.py", line 107, in _train result = self._train_epoch(epoch, train_loader) File "/home/name/Crossnet-PyTorch-master-original/torchlight/core/engine.py", line 178, in _train_epoch results = self.module.step(data, train=True, epoch=epoch, step=gstep) File "/home/name/Crossnet-PyTorch-master-original/source/module.py", line 28, in step loss, result = self._step(data, train, epoch, step) File "/home/name/Crossnet-PyTorch-master-original/source/module.py", line 60, in _step output = self.model(img1_SR, img2_HR, img1_flow, img2_flow) File "/home/name/anaconda3/envs/RRSGAN37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, *kwargs) File "/home/name/Crossnet-PyTorch-master-original/source/model/core.py", line 16, in forward flow = self.flownet(img1_flow, img2_flow) File "/home/name/anaconda3/envs/RRSGAN37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, **kwargs) File "/home/name/Crossnet-PyTorch-master-original/source/model/block.py", line 104, in forward concat5 = torch.cat((conv5_1, deconv5, flow6_up), 1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 15 but got size 16 for tensor number 1 in the list.

stdinR commented 1 year ago

The size of my image is 480*480. What should I modify. Thank you.

stdinR commented 1 year ago

My crossnet.yaml: =train: ===img1_keys: ['HR','LR_UX4'] # which denotes img1 HR(GT) and img1 (Bicubic) ===img2_keys: ['HR'] #which denotes img2 (Ref)

=test: same keys config as train

=module: ==input_mode: ===input:LR_UX4 # which denotes input is Bicubic image ===flow:['LR_UX4', 'HR']

The rest is same as default

stdinR commented 1 year ago

I have found the problem, which is the size of input image. It cannot be divided by a continuous of 2. (16/2=7, 7*2=15, 15!=16) I have solved this by changing dataset. Thank you for your code.