{"record":{"id":"c966c0eefe69b573","repo":"tensorflow/models","slug":"currently-only-supports-retinanethead","errorCode":null,"errorMessage":"Currently only supports RetinaNetHead.","messagePattern":"Currently only supports RetinaNetHead\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/qat/vision/modeling/factory.py","lineNumber":185,"sourceCode":"    optimized_backbone = tfmot.quantization.keras.quantize_apply(\n        annotated_backbone,\n        scheme=schemes.Default8BitQuantizeScheme())\n    decoder = model.decoder\n    if quantization.quantize_detection_decoder:\n      if not isinstance(decoder, fpn.FPN):\n        raise ValueError('Currently only supports FPN.')\n\n      decoder = tf_keras.models.clone_model(\n          decoder,\n          clone_function=_clone_function_for_fpn,\n      )\n      decoder = tfmot.quantization.keras.quantize_apply(decoder)\n      decoder = tfmot.quantization.keras.remove_input_range(decoder)\n\n    head = model.head\n    if quantization.quantize_detection_head:\n      if not isinstance(head, dense_prediction_heads.RetinaNetHead):\n        raise ValueError('Currently only supports RetinaNetHead.')\n      head = (\n          dense_prediction_heads_qat.RetinaNetHeadQuantized.from_config(\n              head.get_config()))\n\n  optimized_model = retinanet_model.RetinaNetModel(\n      backbone=optimized_backbone,\n      decoder=decoder,\n      head=head,\n      detection_generator=model.detection_generator,\n      anchor_boxes=model.anchor_boxes,\n      min_level=model_config.min_level,\n      max_level=model_config.max_level,\n      num_scales=model_config.anchor.num_scales,\n      aspect_ratios=model_config.anchor.aspect_ratios,\n      anchor_size=model_config.anchor.anchor_size)\n\n  if quantization.quantize_detection_head:\n    # Call the model with dummy input to build the head part.","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/qat/vision/modeling/factory.py#L167-L203","documentation":"Error \"Currently only supports RetinaNetHead.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/qat/vision/modeling/factory.py:185 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"}