Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ValueError: input tensor must have rank 5 at least #8

Open
Keepbright opened this issue Sep 5, 2019 · 2 comments
Open

ValueError: input tensor must have rank 5 at least #8

Keepbright opened this issue Sep 5, 2019 · 2 comments

Comments

@Keepbright
Copy link

@Tamuel Hi,Tamuel, I try to run the code but something went wrong.
Just like the title , the Spyder positioned it in the following :
logits = segmentation.network(inputs=input_image, is_training=False) --prediction.py
decoded = slim_decoder(... output_depth=256) --lane_segmentator.segmentation.network
net = depthwise_conv2d_layer(inputs, 3) --tf_module.slim_decoder
output = depthwise_conv2d(inputs, kernel, bias, strides, padding, dilations, to_batch_norm, batch_norm_decay,is_training, activation_fn, name='conv') --tf_util.depthwise_conv2d_layer
output = tf.nn.depthwise_conv2d(
input=inputs,
filter=filters,
strides=strides,
padding=padding,
rate=dilations,
name=name
) --tf_util.depthwise_conv2d

I convert each frame of the original video into an image.The datafile is:
1

I did this for the first time.Could you please tell me what I missed?

@schutera
Copy link

Have you been able to solve this?

@jay746
Copy link

jay746 commented Dec 3, 2020

@Keepbright,
Issue is coming from:
if data_format is not None and data_format.startswith("NC"):
expected_input_rank = spatial_dims[-1]
else:
expected_input_rank = spatial_dims[-1] + 1

try:
  input_shape.with_rank_at_least(expected_input_rank)
except ValueError:
  **raise ValueError(
      "input tensor must have rank %d at least" % (expected_input_rank))**

I think issue is due to dilation argument, by default we assume in a format like [1, dh, dw, 1], but you should be feeding as [dh, dw]

it is mentioned but not noticed
https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants