【发布时间】:2019-03-23 14:05:55
【问题描述】:
我正在使用 Keras 2.1.3,我想将 MobileNet 转换为 CoreML:
from keras.applications import MobileNet
from keras.applications.mobilenet import relu6
from keras.applications.mobilenet import DepthwiseConv2D
import coremltools.converters.keras as k
def save_model():
model = MobileNet(input_shape=(128,128,3), include_top=False)
model.save('temp.h5')
def convert():
model = k.convert('temp.h5',
input_names=['input'],
output_names=['output'],
model_precision='float16',
custom_conversion_functions={'relu6': relu6, 'DepthwiseConv2D': DepthwiseConv2D})
model.save('temp.model')
save_model()
convert()
这给出了一个错误:ValueError: Unknown activation function:relu6
【问题讨论】:
标签: python keras coreml coremltools