Mobilenet v3 large ssd cannot build model do_quantization=True

Hi,

I am able to build a mobilenet v3 larget ssd model from pytorch using rknn.build as below:

ret = rknn.build(do_quantization=False, dataset=’./dataset.txt’)

But when I turn on the do_quantization=True, as below:

ret = rknn.build(do_quantization=True, dataset=’./dataset.txt’)

I am encountering the following error message:

–> Building model
W The target_platform is not set in config, using default target platform rk1808.
W The channel_mean_value is deprecated. Please use mean_values and std_values to replace it.
E Catch exception when building RKNN model!
E Traceback (most recent call last):
E File “/home/paul/rknn1/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py”, line 510, in _apply_op_helper
E preferred_dtype=default_dtype)
E File “/home/paul/rknn1/lib/python3.5/site-packages/tensorflow/python/framework/ops.py”, line 1144, in internal_convert_to_tensor
E ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
E File “/home/paul/rknn1/lib/python3.5/site-packages/tensorflow/python/framework/ops.py”, line 981, in _TensorTensorConversionFunction
E (dtype.name, t.dtype.name, str(t)))
E ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int32: ‘Tensor(“var_at_input.19_3_4_1/cond/Merge:0”, shape=(1, 1, 1, 1), dtype=int32, device=/device:CPU:0)’
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E File “rknn/api/rknn_base.py”, line 578, in rknn.api.rknn_base.RKNNBase.build
E File “rknn/api/rknn_base.py”, line 1509, in rknn.api.rknn_base.RKNNBase._quantize2
E File “rknn/base/RKNNlib/RK_nn.py”, line 546, in rknn.base.RKNNlib.RK_nn.RKnn.quantize
E File “rknn/base/RKNNlib/app/medusa/quantization.py”, line 129, in rknn.base.RKNNlib.app.medusa.quantization.Quantization.run
E File “rknn/base/RKNNlib/app/medusa/quantization.py”, line 54, in rknn.base.RKNNlib.app.medusa.quantization.Quantization._run_quantization
E File “rknn/base/RKNNlib/app/medusa/workspace.py”, line 150, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.run
E File “rknn/base/RKNNlib/app/medusa/workspace.py”, line 120, in rknn.base.RKNNlib.app.medusa.workspace.Workspace._setup_graph
E File “rknn/base/RKNNlib/app/medusa/workspace.py”, line 121, in rknn.base.RKNNlib.app.medusa.workspace.Workspace._setup_graph
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 310, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 314, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 346, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 375, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/RKNNnetbuilder.py”, line 380, in rknn.base.RKNNlib.RKNNnetbuilder.RKNNNetBuilder.build_layer
E File “rknn/base/RKNNlib/layer/RKNNlayer.py”, line 290, in rknn.base.RKNNlib.layer.RKNNlayer.RKNNLayer.compute_tensor
E File “rknn/base/RKNNlib/layer/add.py”, line 36, in rknn.base.RKNNlib.layer.add.Add.compute_out_tensor
E File “/home/paul/rknn1/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py”, line 301, in add
E “Add”, x=x, y=y, name=name)
E File “/home/paul/rknn1/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py”, line 546, in _apply_op_helper
E inferred_from[input_arg.type_attr]))
E TypeError: Input ‘y’ of ‘Add’ Op has type int32 that does not match type float32 of argument ‘x’.
Build pytorch failed!

Can anyone share your experience on how to fix this issue?

Thanks a lot for your help.