tensorflow/models · error · ValueError
Image_shape should not be None for evaluation.
Error message
Image_shape should not be None for evaluation.
What it means
Guard in generate_outputs during evaluation: converting raw predictions into final detections requires the real point-cloud/image shape to decode box coordinates; when image_shape is None (allowed only in training mode where generate_detections is off) this ValueError fires.
Solutions
- Pass image_shape to the model call when running evaluation
- Verify the eval loop forwards the shape from the input parser
- Ensure inference/eval mode is not accidentally calling with image_shape omitted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/pointpillars/modeling/models.py:88 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/b2c746b021c605ab.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/pointpillars/modeling/models.py:88
generate_detections: bool = False) -> Mapping[str, Any]:
if not raw_attributes:
raise ValueError('PointPillars model needs attribute heads.')
# Clap heading to [-pi, pi]
if 'heading' in raw_attributes:
raw_attributes['heading'] = utils.clip_heading(raw_attributes['heading'])
outputs = {
'cls_outputs': raw_scores,
'box_outputs': raw_boxes,
'attribute_outputs': raw_attributes,
}
# Cast raw prediction to float32 for loss calculation.
outputs = tf.nest.map_structure(lambda x: tf.cast(x, tf.float32), outputs)
if not generate_detections:
return outputs
if image_shape is None:
raise ValueError('Image_shape should not be None for evaluation.')
if anchor_boxes is None:
# Generate anchors if needed.
anchor_boxes = utils.generate_anchors(
self._min_level,
self._max_level,
self._image_size,
self._anchor_sizes,
)
for l in anchor_boxes:
anchor_boxes[l] = tf.tile(
tf.expand_dims(anchor_boxes[l], axis=0),
[tf.shape(image_shape)[0], 1, 1, 1])
# Generate detected boxes.
if not self._detection_generator.get_config()['apply_nms']:
raise ValueError('An NMS algorithm is required for detection generator')
detections = self._detection_generator(raw_boxes, raw_scores,
anchor_boxes, image_shape,View on GitHub (pinned to e006f5f0d5)