如何将对象检测模型转换为Coreml

发布于 2025-02-10 03:34:25 字数 633 浏览 1 评论 0原文

我有使用对象检测API训练的SSD MobilenetV2模型(TensorFlow版本2.8.2)。如何将其转换为Coreml?尝试使用Coremltools(版本5.2),但失败了。

我做了以下操作:

  1. 使用exporter_main_v2.py将检查点转换为saved_model.pb
  2. 使用exporter_main_v2.py使用tf.saved_model.load(model_path)
  3. 运行coremltools.convert(modal,source,source,source =“ tensorflow”), 。

在步骤3上,我收到以下错误:

NotImplementedError: Expected model format: [SavedModel | [concrete_function] | tf.keras.Model | .h5], got <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject object at 0x7fab1a41cd90>

I have SSD MobilenetV2 model trained using object detection API (tensorflow version 2.8.2). How can I convert it to coreml? Tried to use coremltools (version 5.2), but failed.

I did the following:

  1. Converted checkpoints to saved_model.pb using exporter_main_v2.py
  2. Loaded the model using tf.saved_model.load(model_path)
  3. Run coremltools.convert(model, source="tensorflow")

On step 3 I got the following error:

NotImplementedError: Expected model format: [SavedModel | [concrete_function] | tf.keras.Model | .h5], got <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject object at 0x7fab1a41cd90>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老娘不死你永远是小三 2025-02-17 03:34:25

Coremltools期望keras .H5型号,但您正在提供检查站。

您将需要实例化检查点来自相同的类模型,加载检查点,然后将模型提供给Coreml。

Coremltools is expecting a Keras .h5 model but you are providing a checkpoint.

You will need to instantiate the same class model the checkpoint came from, load the checkpoint, then provide the model to CoreML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文