tensorflow/models · error · ValueError
" " is missing in outputs, requried found
Error message
"%s" is missing in outputs, requried %s found %s
What it means
Post-processing guard in MaskrcnnModel: the model outputs dict is missing 'class_outputs' or 'box_outputs', which the loss/post-processing path requires. It typically fires in eval/predict mode when the model was built without those output keys (e.g. wrong mode or a modified model_outputs).
Solutions
- Ensure the model was built with is_training semantics that emit class_outputs and box_outputs
- Check that the outputs passed to post_processing come from the correct model forward pass
- Avoid stripping or renaming required output keys in custom model_outputs overrides
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/legacy/detection/modeling/maskrcnn_model.py:309 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/338b5ae4b2640240.
Report an issue: GitHub.
Appendix: source
Thrown at official/legacy/detection/modeling/maskrcnn_model.py:309
def build_model(self, params, mode):
if self._keras_model is None:
input_layers = self.build_input_layers(self._params, mode)
outputs = self.model_outputs(input_layers, mode)
model = tf_keras.models.Model(
inputs=input_layers, outputs=outputs, name='maskrcnn')
assert model is not None, 'Fail to build tf_keras.Model.'
model.optimizer = self.build_optimizer()
self._keras_model = model
return self._keras_model
def post_processing(self, labels, outputs):
required_output_fields = ['class_outputs', 'box_outputs']
for field in required_output_fields:
if field not in outputs:
raise ValueError('"%s" is missing in outputs, requried %s found %s' %
(field, required_output_fields, outputs.keys()))
predictions = {
'image_info': labels['image_info'],
'num_detections': outputs['num_detections'],
'detection_boxes': outputs['detection_boxes'],
'detection_classes': outputs['detection_classes'],
'detection_scores': outputs['detection_scores'],
}
if self._include_mask:
predictions.update({
'detection_masks': outputs['detection_masks'],
})
if 'groundtruths' in labels:
predictions['source_id'] = labels['groundtruths']['source_id']
predictions['gt_source_id'] = labels['groundtruths']['source_id']
predictions['gt_height'] = labels['groundtruths']['height']
predictions['gt_width'] = labels['groundtruths']['width']View on GitHub (pinned to e006f5f0d5)