Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

value error 5d tensor error #50

Closed
taloot opened this issue Jul 31, 2021 · 3 comments
Closed

value error 5d tensor error #50

taloot opened this issue Jul 31, 2021 · 3 comments
Labels
YOLOv5 Read the README.

Comments

@taloot
Copy link

taloot commented Jul 31, 2021

im using the docker imagee

13. Issue Details

i have this errror
user@d082b4901cc4:~/workdir/Desktop/quanz/yolov5$ sudo openvino2tensorflow --model_path openvino/exp16.xml --model_output_path tf_tflite --output_full_integer_quant_tflite
TensorFlow/Keras model building process starts ======================================
ERROR: Cannot reshape a tensor with 6084 elements to shape [1,3,12,13,36] (16848 elements) for '{{node tf.reshape/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder, tf.reshape/Reshape/shape)' with input shapes: [1,13,13,36], [5] and with input tensors computed as partial shapes: input[1] = [1,3,12,13,36].
ERROR: model_path : openvino/exp16.xml
ERROR: weights_path: openvino/exp16.bin
ERROR: layer_id : 407
ERROR: input_layer0 layer_id=385: KerasTensor(type_spec=TensorSpec(shape=(1, 13, 13, 36), dtype=tf.float32, name=None), name='tf.math.add_66/Add:0', description="created by layer 'tf.math.add_66'")
ERROR: input_layer1 layer_id=406: tf.Tensor([ 1 3 12 13 36], shape=(5,), dtype=int64)
ERROR: The trace log is below.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/dispatch.py", line 206, in wrapper
return target(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/array_ops.py", line 196, in reshape
result = gen_array_ops.reshape(tensor, shape, name)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 8398, in reshape
return reshape_eager_fallback(
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 8419, in reshape_eager_fallback
_attr_T, (tensor,) = _execute.args_to_matching_eager([tensor], ctx, [])
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py", line 273, in args_to_matching_eager
tensor = ops.convert_to_tensor(
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/profiler/trace.py", line 163, in wrapped
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 1566, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py", line 346, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py", line 271, in constant
return _constant_impl(value, dtype, shape, name, verify_shape=False,
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py", line 283, in _constant_impl
return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py", line 308, in _constant_eager_impl
t = convert_to_eager_tensor(value, ctx, dtype)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/constant_op.py", line 106, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, dtype)
File "/usr/local/lib/python3.8/dist-packages/keras/engine/keras_tensor.py", line 244, in array
raise TypeError(
TypeError: Cannot convert a symbolic Keras input/output to a numpy array. This error may indicate that you're trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 1880, in _create_c_op
c_op = pywrap_tf_session.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot reshape a tensor with 6084 elements to shape [1,3,12,13,36] (16848 elements) for '{{node tf.reshape/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder, tf.reshape/Reshape/shape)' with input shapes: [1,13,13,36], [5] and with input tensors computed as partial shapes: input[1] = [1,3,12,13,36].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/openvino2tensorflow", line 1592, in convert
tf_layers_dict[layer_id] = tf.reshape(op1, shape)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/dispatch.py", line 210, in wrapper
result = dispatch(wrapper, args, kwargs)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/dispatch.py", line 126, in dispatch
result = dispatcher.handle(op, args, kwargs)
File "/usr/local/lib/python3.8/dist-packages/keras/layers/core.py", line 1473, in handle
return TFOpLambda(op)(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 976, in call
return self._functional_construction_call(inputs, args, kwargs,
File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 1114, in _functional_construction_call
outputs = self._keras_tensor_symbolic_call(
File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 848, in _keras_tensor_symbolic_call
return self._infer_output_signature(inputs, args, kwargs, input_masks)
File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 888, in _infer_output_signature
outputs = call_fn(inputs, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keras/layers/core.py", line 1350, in _call_wrapper
return self._call_wrapper(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keras/layers/core.py", line 1382, in _call_wrapper
result = self.function(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/dispatch.py", line 206, in wrapper
return target(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/array_ops.py", line 196, in reshape
result = gen_array_ops.reshape(tensor, shape, name)
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 8403, in reshape
_, _, _op, _outputs = _op_def_library._apply_op_helper(
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/op_def_library.py", line 748, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/func_graph.py", line 599, in _create_op_internal
return super(FuncGraph, self)._create_op_internal( # pylint: disable=protected-access
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 3561, in _create_op_internal
ret = Operation(
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 2041, in init
self._c_op = _create_c_op(self._graph, node_def, inputs,
File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/ops.py", line 1883, in _create_c_op
raise ValueError(str(e))
ValueError: Cannot reshape a tensor with 6084 elements to shape [1,3,12,13,36] (16848 elements) for '{{node tf.reshape/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder, tf.reshape/Reshape/shape)' with input shapes: [1,13,13,36], [5] and with input tensors computed as partial shapes: input[1] = [1,3,12,13,36].

@taloot
Copy link
Author

taloot commented Aug 1, 2021

See.
https://github.com/PINTO0309/openvino2tensorflow#6-7-replace-weights-or-constant-values-in-const-op

so whats the layer number that have problem, and how my json file written? based on my error

@taloot
Copy link
Author

taloot commented Aug 1, 2021

is it the 407?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
YOLOv5 Read the README.
Projects
None yet
Development

No branches or pull requests

2 participants