LaneSegmentationNetwork icon indicating copy to clipboard operation
LaneSegmentationNetwork copied to clipboard

ValueError: input tensor must have rank 5 at least

Open Keepbright opened this issue 6 years ago • 2 comments

@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?

Keepbright avatar Sep 05 '19 09:09 Keepbright

Have you been able to solve this?

schutera avatar Sep 17 '20 11:09 schutera

@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

jay746 avatar Dec 03 '20 11:12 jay746