如何使用coremltools 4.0更改MLMultiArray数据类型?

问题描述

我在使用.h5mlmodel转换为coremltools 4.0时遇到了问题,我希望将MLMultiArray数据类型作为171元素向量的双精度数组,而不是Flot32多维浮点数组

在这里,我使用coremltools 4.0将.h5转换为ml模型的脚本

from tensorflow import keras 
import coremltools as ct


keras_model = keras.models.load_model('v1.h5')

with open("obj.names") as f:    str1 =  f.read()

class_labels = [i for i in str1.split('\n')]

class_labels.pop()


image_input = ct.ImageType(shape=(1,416,3,),bias=[-1,-1,-1],scale=1/255)

classifier_config = ct.ClassifierConfig(class_labels)

model = ct.convert(
    keras_model,inputs=[image_input] )


model.save("v1.mlmodel")

使用python3运行上述脚本,这是我的模型生成输出为MLMultiArray,数据类型为Flot32浮点数多维数组。

MLMultiArray with Flot32

这是我的工作模型输出MLMultiArray,数据类型为double的171元素向量。

MLMultiArray with Double 171

如何将Float更新为两倍的MLMultiArray

任何帮助将不胜感激

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)