{"record":{"id":"bda8b124910943d1","repo":"tensorflow/models","slug":"can-t-evaluate-using-annotation-file-when-tfds-is","errorCode":null,"errorMessage":"Can't evaluate using annotation file when TFDS is used.","messagePattern":"Can't evaluate using annotation file when TFDS is used\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/centernet/tasks/centernet.py","lineNumber":313,"sourceCode":"                  loss_weights.scale_weight * scale_loss +\n                  loss_weights.offset_weight * offset_loss)\n\n    if aux_losses:\n      total_loss += tf.add_n(aux_losses)\n\n    losses['total_loss'] = total_loss\n    return losses\n\n  def build_metrics(self, training=True):\n    metrics = []\n    metric_names = ['total_loss', 'ct_loss', 'scale_loss', 'ct_offset_loss']\n    for name in metric_names:\n      metrics.append(tf_keras.metrics.Mean(name, dtype=tf.float32))\n\n    if not training:\n      if (self.task_config.validation_data.tfds_name\n          and self.task_config.annotation_file):\n        raise ValueError(\n            \"Can't evaluate using annotation file when TFDS is used.\")\n      self.coco_metric = coco_evaluator.COCOEvaluator(\n          annotation_file=self.task_config.annotation_file,\n          include_mask=False,\n          per_category_metrics=self.task_config.per_category_metrics)\n\n    return metrics\n\n  def train_step(self,\n                 inputs: Tuple[Any, Any],\n                 model: tf_keras.Model,\n                 optimizer: tf_keras.optimizers.Optimizer,\n                 metrics: Optional[List[Any]] = None):\n    \"\"\"Does forward and backward.\n\n    Args:\n      inputs: a dictionary of input tensors.\n      model: the model, forward pass definition.","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/centernet/tasks/centernet.py#L295-L331","documentation":"Error \"Can't evaluate using annotation file when TFDS is used.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/centernet/tasks/centernet.py:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}