Comments (12)
我也是刚刚运行的时候发现了这个问题,他使用的inf_batch是训练用的函数所以有O(有雨图)和B(去雨图),测试因为是测试图,所以没有B,所以这个地方报错了,我在试图更改。。。改完回复你
from rescan.
但是我改了还是报错NameError: name 'patch_size' is not defined,我猜应该是数据集test文件下的图片的问题,有些是321481的,有些是481321的。。。
from rescan.
大概在142行
还有就是关于执行python main.py -a test 的时候报错
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 481 and 321 in dimension 2
后来发现运行dataset.py文件显示的测试数据集大小为(3,64,64) 训练数据集大小为(3,481,321)(ps:测试图像是我自己选的)在这里给大家说一下。。。。
解决方法是在第99行sample{‘O’:O}前一行加上
O=cv2.resize(O,(patch_size,patch_size))
就可以了
Please replace TrainValDataset with TestDataset in main.py when you run testing.
Sorry for not refering that in README.md
from rescan.
class TestDataset(Dataset):
def __init__(self, name):
super().__init__()
self.rand_state = RandomState(66)
self.root_dir = os.path.join(settings.data_dir, name)
self.mat_files = os.listdir(self.root_dir)
self.patch_size = settings.patch_size
self.file_num = len(self.mat_files)
def __len__(self):
return self.file_num
def __getitem__(self, idx):
patch_size = self.patch_size
file_name = self.mat_files[idx % self.file_num]
img_file = os.path.join(self.root_dir, file_name)
img_pair = cv2.imread(img_file).astype(np.float32) / 255
img_pair = cv2.resize(img_pair, (patch_size, patch_size))
O = np.transpose(img_pair, (2, 0, 1))
sample = {'O': O}
return sample
很抱歉提供了错误的修改方式,我又重新改了一次
from rescan.
刚才我自己跑的时候报错之后就把patch_size = self.patch_size了,但是还是出现了
2018-09-05 20:23:58,584 - INFO - set log dir as ../logdir
2018-09-05 20:23:58,584 - INFO - set model dir as ../models
Traceback (most recent call last):
File "main.py", line 229, in
run_test(args.model)
File "main.py", line 206, in run_test
pred, loss, losses = sess.inf_batch('test', batch)
File "main.py", line 105, in inf_batch
O, B = batch['O'], batch['B']
KeyError: 'B'
这个错,楼主你有这个情况吗
from rescan.
楼主,你最终把这个论文的代码跑通了吗?我怎么总感觉有问题,看到了望尽快回复,谢谢
from rescan.
@SherlockSunset 我发现他的测试代码有问题,所以只跑了show.py 和train.py 最后效果出来一张测试图片有4张输出图片,可能是因为我只训练了4800多步所以实际效果并不怎么好,只去掉了大部分的雨
from rescan.
大概在142行
还有就是关于执行python main.py -a test 的时候报错
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 481 and 321 in dimension 2
后来发现运行dataset.py文件显示的测试数据集大小为(3,64,64) 训练数据集大小为(3,481,321)(ps:测试图像是我自己选的)在这里给大家说一下。。。。
解决方法是在第99行sample{‘O’:O}前一行加上
O=cv2.resize(O,(patch_size,patch_size))
就可以了Please replace TrainValDataset with TestDataset in main.py when you run testing.
Sorry for not refering that in README.md
think you
from rescan.
@SherlockSunset 我发现他的测试代码有问题,所以只跑了show.py 和train.py 最后效果出来一张测试图片有4张输出图片,可能是因为我只训练了4800多步所以实际效果并不怎么好,只去掉了大部分的雨
为什么我跑不了4800步,这个步数不是和训练图片多少有关的么?700张图片我只能跑600多步
from rescan.
@SherlockSunset 我发现他的测试代码有问题,所以只跑了show.py 和train.py 最后效果出来一张测试图片有4张输出图片,可能是因为我只训练了4800多步所以实际效果并不怎么好,只去掉了大部分的雨
为什么我跑不了4800步,这个步数不是和训练图片多少有关的么?700张图片我只能跑600多步
This problem lies on the usage of iter, and I have fixed all the problems.
Please refer the newest commit.
Hope it can help you!
from rescan.
pred, loss, losses = sess.inf_batch('test', batch)
File "main.py", line 105, in inf_batch
O, B = batch['O'], batch['B']
KeyError: 'B'
这个错,楼主你有这个情况吗
I fix this problem today, please refer to the latest commit
from rescan.
from rescan.
Related Issues (20)
- about params HOT 1
- 使用show.py测试时放入网络的是没有雨的图的问题? HOT 4
- RuntimeError: The size of tensor a (241) must match the size of tensor b (240) at non-singleton dimension 3 HOT 5
- Where can I find a Pretrained Model? HOT 6
- test数据集效果甚微 HOT 3
- 问一个rain100h数据集的问题 HOT 1
- Problems encountered during retraining HOT 5
- problem encountered during running eval.py HOT 3
- our_net_G.t7 HOT 1
- Understanding ssim HOT 1
- Can you give me Rain800 dataset? HOT 2
- need trained model,thanks!
- When I try to do test, I got 'cuda out of memory' HOT 1
- Can't access the Rain800 dataset
- 关于代码运行的部分疑惑
- 你们不提供其他训练模型吗? HOT 2
- about data setting
- sess.step += 1 ?
- 关于论文第三章的rain models
- Pytorch>=4.1.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rescan.