Closed MBocchi closed 6 years ago
Hi,
I currently don't have a computer at hand so I couldn't verify it. But could you verify that you're using the latest nightly build and the shape of the "img" variable is (1, 3, 224, 224)?
Additionally, is
img_batch = DataBatch(mx.nd.array(img), 0)
the same as
img_batch = DataBatch([mx.nd.array(img)])
? I use the later one in my code.
If so, could you try other models to test whether the problem happens only on the RCAN model?
I think the modification on JSON is unnecessary.
Thank you for your answer @WolframRhodium!
Actually a transposition matrix before the DataBatch fixed the issue:
img = mx.image.imread(fname)
img = img.transpose()
img_batch = DataBatch(mx.nd.array(img), 0)
I should train the RCAN model to obtain significant result. Do you have any ideas or scripts allowing to do it?
The pre-trained model targets inference only and I'm not sure whether training the model in MXNet directly will lead to desirable result.
An option could be training on PyTorch and inference in MXNet, since the author has provided complete workaround for training.
Hi,
I try to run the Super Resolution with RCAN method with RCAN_BDX3-0000 params and json. My input image has a 224x224 dimension. I load the model as following:
symbol, arg_params, aux_params = mx.model.load_checkpoint('RCAN_BDX3', 0)
model = mx.mod.Module(symbol=symbol, label_names=None)
model.bind(data_shapes=[('data', (1, 3, 224, 224))], for_training=False)
model.init_params(arg_params=arg_params, aux_params=aux_params, allow_missing=False, allow_extra=False)
Then I load the image:
img = mx.image.imread(fname)
img_batch = DataBatch(mx.nd.array(img), 0)
And forward the model:
model.forward(img_batch)
The forward method generates the following error:
MXNetError: Error in operator pre_mean_shift: [14:55:42] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./elemwise_binary_broadcast_op.h:68: Check failed: l == 1 || r == 1 operands could not be broadcast together with shapes [224,224,3] [1,3,1,1]
Does there is any modification to do inside JSON file (
"attr": {"__shape__": "(1, 3, 1, 1)"}
for instance) to run the model?Thank you