{"record":{"id":"15ecdeb0cfb6bcf5","repo":"tensorflow/models","slug":"model-has-to-be-mobilenet-edgetpu-model-or-searche","errorCode":null,"errorMessage":"Model has to be mobilenet-edgetpu model or searchedmodel with given saved model path.","messagePattern":"Model has to be mobilenet-edgetpu model or searchedmodel with given saved model path\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/edgetpu/vision/tasks/image_classification.py","lineNumber":113,"sourceCode":"  def build_model(self):\n    \"\"\"Builds model for MobileNet-EdgeTPU Task.\"\"\"\n    model_config = self.task_config.model\n    model_params = model_config.model_params.as_dict()\n    model_name = model_params['model_name']\n    registered_models = get_models()\n    if model_name in registered_models:\n      logging.info('Load MobileNet-EdgeTPU-V1/V2 model.')\n      logging.info(model_params)\n      model = registered_models[model_name](**model_params)\n    elif model_name == 'mobilenet_edgetpu_search':\n      if self.task_config.saved_model_path is None:\n        raise ValueError('If using MobileNet-EdgeTPU-Search model, please'\n                         'specify the saved model path via the'\n                         '--params_override flag.')\n      logging.info('Load saved model (model from search) directly.')\n      model = load_searched_model(self.task_config.saved_model_path)\n    else:\n      raise ValueError('Model has to be mobilenet-edgetpu model or searched'\n                       'model with given saved model path.')\n\n    return model\n\n  def initialize(self, model: tf_keras.Model):\n    \"\"\"Loads pretrained checkpoint.\"\"\"\n    if not self.task_config.init_checkpoint:\n      return\n\n    ckpt_dir_or_file = self.task_config.init_checkpoint\n    if tf.io.gfile.isdir(ckpt_dir_or_file):\n      ckpt_dir_or_file = tf.train.latest_checkpoint(ckpt_dir_or_file)\n\n    # Restoring checkpoint.\n    if self.task_config.init_checkpoint_modules == 'all':\n      ckpt = tf.train.Checkpoint(**model.checkpoint_items)\n      status = ckpt.read(ckpt_dir_or_file)\n      status.expect_partial().assert_existing_objects_matched()","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/edgetpu/vision/tasks/image_classification.py#L95-L131","documentation":"Error \"Model has to be mobilenet-edgetpu model or searchedmodel with given saved model path.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/edgetpu/vision/tasks/image_classification.py:113 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"}