tensorflow/models · error · ValueError
max_num_eval_detections must be an integer.
Error message
max_num_eval_detections must be an integer.
What it means
Error "max_num_eval_detections must be an integer." thrown in tensorflow/models.
Source
Thrown at official/vision/evaluation/coco_evaluator.py:98
if annotation_file:
if annotation_file.startswith('gs://'):
_, local_val_json = tempfile.mkstemp(suffix='.json')
tf.io.gfile.remove(local_val_json)
tf.io.gfile.copy(annotation_file, local_val_json)
atexit.register(tf.io.gfile.remove, local_val_json)
else:
local_val_json = annotation_file
self._coco_gt = coco_utils.COCOWrapper(
eval_type=('mask' if include_mask else 'box'),
annotation_file=local_val_json)
self._annotation_file = annotation_file
self._include_mask = include_mask
self._include_keypoint = include_keypoint
self._per_category_metrics = per_category_metrics
if max_num_eval_detections is None or not isinstance(
max_num_eval_detections, int):
raise ValueError('max_num_eval_detections must be an integer.')
self._metric_names = [
'AP', 'AP50', 'AP75', 'APs', 'APm', 'APl', 'ARmax1', 'ARmax10',
f'ARmax{max_num_eval_detections}', 'ARs', 'ARm', 'ARl'
]
self.max_num_eval_detections = max_num_eval_detections
self._required_prediction_fields = [
'source_id', 'num_detections', 'detection_classes', 'detection_scores',
'detection_boxes'
]
self._need_rescale_bboxes = need_rescale_bboxes
self._need_rescale_keypoints = need_rescale_keypoints
if self._need_rescale_bboxes or self._need_rescale_keypoints:
self._required_prediction_fields.append('image_info')
self._required_groundtruth_fields = [
'source_id', 'height', 'width', 'classes', 'boxes'
]
if self._include_mask:
mask_metric_names = ['mask_' + x for x in self._metric_names]View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/vision/evaluation/coco_evaluator.py:98 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/0609a92a3232328d.
Report an issue: GitHub.