首页 > 解决方案 > 将 MoveNet 转换为 CoreML

问题描述

我正在尝试将 MoveNet(PoseNet https://tfhub.dev/google/movenet/singlepose/thunder/4的演变)转换为 CoreML,但我不能。.pb 文件似乎不包含元数据。

我一直在关注这个(https://coremltools.readme.io/docs/tensorflow-2#convert-a-pre-trained-model)但没有成功。

import tensorflow as tf
import tensorflow_hub as hub
import coremltools as ct

url = 'https://tfhub.dev/google/movenet/singlepose/thunder/4'
model = hub.KerasLayer(url, signature='serving_default', signature_outputs_as_dict=True)
input = tf.keras.layers.InputLayer(input_shape=(256, 256, 3))
kmodel = tf.keras.Sequential( [ input, model ] )
kmodel.build([1,256, 256, 3])
coreml = ct.convert(kmodel, source='tensorflow')

但它不起作用......请问有什么想法吗?我正在使用 TensorFlow 2.7.0 和 CoreMLTools 5.0b3。Tflite 模型也可用,因此如果可以从中进行转换,那将是一种选择。

谢谢!

标签: coremltoolsopenpose

解决方案


推荐阅读