Hi, I am trying to convert the resnet50 model. I am loading the model with the command
keras_resnet50 = load_model(weights_path)
The weights here are downloaded from “https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5”
However, I get the dimension conflict error as shown below
Traceback (most recent call last):
[bt] (7) /usr/tvm/build/libtvm.so(TVMFuncCall+0x61) [0x7f50ce7359b1]
[bt] (6) /usr/tvm/build/libtvm.so(+0xa412a1) [0x7f50ce6062a1]
[bt] (5) /usr/tvm/build/libtvm.so(tvm::relay::ModuleNode::FromExpr(tvm::relay::Expr const&, tvm::Map<tvm::relay::GlobalVar, tvm::relay::Function, void, void> const&, tvm::Map<tvm::relay::GlobalTypeVar, tvm::relay::TypeData, void, void> const&)+0x1d5) [0x7f50ce605225]
[bt] (4) /usr/tvm/build/libtvm.so(tvm::relay::ModuleNode::Add(tvm::relay::GlobalVar const&, tvm::relay::Function const&, bool)+0x28c) [0x7f50ce602dac]
[bt] (3) /usr/tvm/build/libtvm.so(tvm::relay::InferType(tvm::relay::Function const&, tvm::relay::Module const&, tvm::relay::GlobalVar const&)+0x1d7) [0x7f50ce4f06d7]
[bt] (2) /usr/tvm/build/libtvm.so(tvm::relay::TypeInferencer::Infer(tvm::relay::Expr)+0x86) [0x7f50ce4eff56]
[bt] (1) /usr/tvm/build/libtvm.so(tvm::relay::ErrorReporter::RenderErrors(tvm::relay::Module const&, bool)+0x230c) [0x7f50ce60e61c]
[bt] (0) /usr/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x32) [0x7f50cdf435f2] File “/usr/tvm/src/relay/ir/error.cc”, line 133 TVMError: Error(s) have occurred. The program has been annotated with them:
%0 = nn.pad(%input_1, pad_width=[[0, 0], [0, 0], [3, 3], [3, 3]]);
%1 = nn.conv2d(%0, %v_param_1, strides=[2, 2], channels=64, kernel_size=[7, 7]) in particular dimension 1 conflicts 224 does not match 3; unable to unify: `Tensor[(64, 224, 7, 7), float32]` and `Tensor[(64, 3, 7, 7), float32]`; ;
The conversion code is -
func, params = relay.frontend.from_keras(model, shape_dict)
with relay.build_config(opt_level=opt_level):
graph, lib, params = relay.build_module.build(
func, target, params=params)
I am able to convert other models through the same code. Any help would be appreciated