Zheng222 / IMDN

Lightweight Image Super-Resolution with Information Multi-distillation Network (ACM MM 2019, Winner Award of ICCVW AIM 2019 Constrained SR Track1&Track2)
418 stars 69 forks source link

Cannot run train_IMDN.py #10

Closed mangoerya closed 4 years ago

mangoerya commented 4 years ago

Shouldn't the Line 8 in train_IMDN.py be "import utils" instead of "from utils import utils"? And where does the function "utils.adjust_learning_rate()" used in Line 123 in train_IMDN.py first defined? Thank you.

Zheng222 commented 4 years ago

@mangoerya Hello, I have updated the utils.py. The new utils.py contains adjust_learning_rate().

chensiyu1120 commented 2 years ago

Hello, I would like to ask why there is such a mistake?Hello, Thank you. File "train_IMDN.py", line 8, in from utils import utils ImportError: cannot import name 'utils'

Zheng222 commented 2 years ago

Hello, I would like to ask why there is such a mistake?Hello, Thank you. File "train_IMDN.py", line 8, in from utils import utils ImportError: cannot import name 'utils'

将from utils import utils 改为 import utils

chensiyu1120 commented 2 years ago

好的,感谢您的回复,请问您这个python用的是3.5~3.7版本,还是2.7版本的呢?

------------------ 原始邮件 ------------------ 发件人: "Zheng222/IMDN" @.>; 发送时间: 2021年11月11日(星期四) 下午5:56 @.>; @.**@.>; 主题: Re: [Zheng222/IMDN] Cannot run train_IMDN.py (#10)

Hello, I would like to ask why there is such a mistake?Hello, Thank you. File "train_IMDN.py", line 8, in from utils import utils ImportError: cannot import name 'utils'

将from utils import utils 改为 import utils

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

chensiyu1120 commented 2 years ago

你好,冒昧打扰您,我在运行train_IMDN.py时出现了这样的错误,

===> Loading datasets Traceback (most recent call last):   File "train_IMDN.py", line 74, in <module>     trainset = DIV2K.div2k(args)   File "/data1/home/chensiyu/IMDN-master/data/DIV2K.py", line 41, in init     self.images_hr, self.images_lr = self._scan()   File "/data1/home/chensiyu/IMDN-master/data/DIV2K.py", line 78, in _scan     list_hr = sorted(make_dataset(self.dir_hr))   File "/data1/home/chensiyu/IMDN-master/data/DIV2K.py", line 22, in make_dataset     assert os.path.isdir(dir), '%s is not a valid directory' % dir AssertionError: /data1/home/chensiyu/IMDN-master/training_data//DIV2K_decoded/DIV2K_HR is not a valid directory

       def _set_filesystem(self, dir_data):         self.root = dir_data + '/DIV2K_decoded'         self.dir_hr = os.path.join(self.root, 'DIV2K_HR')         self.dir_lr = os.path.join(self.root, 'DIV2K_LR_bicubic/x' + str(self.scale))

但是我将DIV2K.py文件里面的43~46行中的/DIV2K_decoded, 'DIV2K_HR' 'DIV2K_LR_bicubic/x'去掉,他就可以正常运行了,但是后面还是会出现这样的错误,还麻烦您帮我看一下,是因为什么原因。

===> Valid. psnr: 37.9105, ssim: 0.9594 epoch = 1 lr =  0.0002 Traceback (most recent call last):   File "train_IMDN.py", line 192, in <module>     train(epoch)   File "train_IMDN.py", line 125, in train     for iteration, (lr_tensor, hr_tensor) in enumerate(training_data_loader, 1):   File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 582, in next     return self._process_next_batch(batch)   File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch     raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last):   File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop     samples = collate_fn([dataset[i] for i in batch_indices])   File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp>     samples = collate_fn([dataset[i] for i in batch_indices])   File "/data1/home/chensiyu/IMDN-master/data/DIV2K.py", line 55, in getitem     lr_tensor, hr_tensor = common.np2Tensor(lr, hr, rgb_range=self.opt.rgb_range)   File "/data1/home/chensiyu/IMDN-master/data/common.py", line 48, in np2Tensor     return [_np2Tensor(a) for a in args]   File "/data1/home/chensiyu/IMDN-master/data/common.py", line 48, in <listcomp>     return [_np2Tensor(a) for a in args]   File "/data1/home/chensiyu/IMDN-master/data/common.py", line 43, in _np2Tensor     tensor = torch.from_numpy(np_transpose).float() ValueError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

祝好! 再次感谢您,期待您的回信。 陈思雨

------------------ 原始邮件 ------------------ 发件人: "Zheng222/IMDN" @.>; 发送时间: 2021年11月11日(星期四) 下午5:56 @.>; @.**@.>; 主题: Re: [Zheng222/IMDN] Cannot run train_IMDN.py (#10)

Hello, I would like to ask why there is such a mistake?Hello, Thank you. File "train_IMDN.py", line 8, in from utils import utils ImportError: cannot import name 'utils'

将from utils import utils 改为 import utils

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.