Open srathbone opened 3 years ago
Hello! Since our network needs the shadowed image ( train_A) and the shadow mask (train_B), currently it cannot be used to just a single image.
Thanks @fl82hope. Now I'm getting "RuntimeError: Given groups=1, weight of size [64, 4, 7, 7], expected input[1, 6, 1024, 1024] to have 4 channels, but got 6 channels instead" error, do you know why I'd get that?
Could you provide more details about where this error happens?
Stacktrace
[Network M] Total number of parameters : 55.420 M
-----------------------------------------------
switching to testing mode
latest
loading the model from /opt/shadow-remove/exposure-fusion-shadow-removal/shadow_removal/checkpoint/MFusion_expo_param_b8_lr0.0001_L110_n5_ks3_vfixed5-1-loss-mse_adam_lambda_10.0_TV0G0.1PG0.0/latest_net_G.pth
loading the model from /opt/shadow-remove/exposure-fusion-shadow-removal/shadow_removal/checkpoint/MFusion_expo_param_b8_lr0.0001_L110_n5_ks3_vfixed5-1-loss-mse_adam_lambda_10.0_TV0G0.1PG0.0/latest_net_M.pth
Traceback (most recent call last):
File "./OE_eval.py", line 100, in <module>
model.forward()
File "/opt/shadow-remove/exposure-fusion-shadow-removal/models/Fusion_model.py", line 180, in forward
shadow_param_pred = self.netG(inputG)
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
return self.module(*inputs[0], **kwargs[0])
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/models/resnet.py", line 236, in forward
return self._forward_impl(x)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/models/resnet.py", line 219, in _forward_impl
x = self.conv1(x)
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 423, in forward
return self._conv_forward(input, self.weight)
File "/opt/anaconda3/envs/exposure-fusion-shadow-removal/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 420, in _conv_forward
self.padding, self.dilation, self.groups)
I'm running bash OE_eval.py
I'm testing on a single image and mask, Directory is
test
└── train
├── train_A
│ └── 1.jpg
└── train_B
└── 1.jpg
For the model path, you can choose a local path to put latest_net_G.pth for model loading, and modify the loading path in the code.
For the test, the directory should be
ISTD
└── test_A
│ └── 1.jpg
└── test_B
└── 1.jpg
Hi @fl82hope ,
Without train directory I get "not a directory error" saying it doesn't exist.
/opt/shadow-remove/exposure-fusion-shadow-removal/ISTD/train/train_B
/opt/shadow-remove/exposure-fusion-shadow-removal/ISTD/train/train_A
Traceback (most recent call last):
File "./OE_eval.py", line 23, in <module>
train_data_loader = CreateDataLoader(opt)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/data/__init__.py", line 46, in CreateDataLoader
data_loader.initialize(opt)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/data/__init__.py", line 58, in initialize
self.dataset = create_dataset(opt)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/data/__init__.py", line 39, in create_dataset
instance.initialize(opt)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/data/expo_param_dataset.py", line 31, in initialize
self.A_paths, self.imname = make_dataset(self.dir_A)
File "/opt/shadow-remove/exposure-fusion-shadow-removal/data/image_folder.py", line 26, in make_dataset
assert os.path.isdir(dir), '%s is not a valid directory' % dir
AssertionError: /opt/shadow-remove/exposure-fusion-shadow-removal/ISTD/train/train_A is not a valid directory
If I create that directory I then get
ValueError: num_samples should be a positive integer value, but got num_samples=0
The new error, num_samples=0 also means it doesn't find the images. When read data, you can print the path out to see whether it exists or not.
Script seems to require train/train_{A,B} in image directory. Is it possible to run against a single image?