ValueError: Cannot use the given session to evaluate tensor: the tensor's graph is different from the session's graph
在一段代码中运行多个模型到时graph中的tensor混乱,需在模型定义及模型predict 过程开始指定graph 与 session
with self.session.as_default(): with self.graph.as_default(): model = models.load_model(self.model_path, self.backbone_name)
with self.graph.as_default(): with self.session.as_default(): boxes, scores, labels = self.loaded_model.predict_on_batch(np.expand_dims(image, axis=0))