This repository has been archived by the owner on Sep 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
ValueError: expected 5D input (got 4D input) #27
Comments
The CoreML model can be generated after you reshape (N,C,H,W) to (N,C,1,H,W), but the result was terrible, at last I used 'Batch Normalization' instead of 'Instance Normalization' and it worked well. |
Hello!Thank you for your reply,’'Batch Normalization' instead of 'Instance Normalization' ‘,how to do that?Can you explain it in detail or show it with pictures,thank you very much!
发自我的 iPhone
… 在 2018年8月23日,上午12:05,GordonRen ***@***.***> 写道:
'Batch Normalization' instead of 'Instance Normalization'
|
1.find 'train.lua' |
Ok, thank you very much! I try it now.
发自我的 iPhone
在 2018年8月23日,上午12:19,GordonRen <notifications@github.com<mailto:notifications@github.com>> 写道:
1.find 'train.lua'
2.set cmd:option('-use_instance_norm', 1) to cmd:option('-use_instance_norm', 0)
3.train
Notice:the trained model uses 'Instance Normalization' which has something wrong when converting it to CoreML model, but you can trian your model using ‘Batch Normalization' and Convert it to CoreML model successfully.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#27 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFb83Z469sVIrbNJneckQtG1R38Pzpl3ks5uTYR6gaJpZM4VNXFc>.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello!,how to solve this problem,thank you very much!
Preparing models for conversion
Converting models to CoreML
Converting prepared_models/candy.t7
Traceback (most recent call last):
File "convert-fast-neural-style.py", line 176, in
main()
File "convert-fast-neural-style.py", line 162, in main
unknown_layer_converter_fn=convert_instance_norm
File "/home/sharp/.local/lib/python2.7/site-packages/torch2coreml/_torch_converter.py", line 211, in convert
input_shapes
File "/home/sharp/.local/lib/python2.7/site-packages/torch2coreml/_torch_converter.py", line 67, in _infer_torch_output_shapes
is_batch=True
File "/home/sharp/.local/lib/python2.7/site-packages/torch2coreml/_torch_converter.py", line 30, in _forward_torch_random_input
result = torch_model.forward(input_tensors[0])
File "/home/sharp/.local/lib/python2.7/site-packages/torch/legacy/nn/Module.py", line 33, in forward
return self.updateOutput(input)
File "/home/sharp/.local/lib/python2.7/site-packages/torch/legacy/nn/Sequential.py", line 36, in updateOutput
currentOutput = module.updateOutput(currentOutput)
File "convert-fast-neural-style.py", line 45, in updateOutput
return self._instance_norm.forward(Variable(input)).data
File "/home/sharp/.local/lib/python2.7/site-packages/torch/nn/modules/instancenorm.py", line 46, in forward
self._check_input_dim(input)
File "/home/sharp/.local/lib/python2.7/site-packages/torch/nn/modules/instancenorm.py", line 242, in _check_input_dim
.format(input.dim()))
ValueError: expected 5D input (got 4D input)
The text was updated successfully, but these errors were encountered: