coremltools

CoreML model: Convert imageType model input to multiArray

安稳与你 提交于 2020-06-16 17:54:07
问题 Using PyTorch, I have trained a simple multiclass classifier and I want to convert it to CoreML model format. It is converted, but there's an issue. I've searched quite exhaustively but most frequent questions, pertaining to mlmodel's inputs, are only about how to change the format of the input of mlmodel from MLMultiArray to UIImage because they must be working with images. But if my model expects a UIImage as input whereas I have multiarray type data, how can I change the model's input so

Errors converting PyTorch Unet (“tiramisu”) into coreml, via onnx

半世苍凉 提交于 2019-12-23 04:06:42
问题 I'm trying to convert a pytorch "tiramisu" UNet (from: https://github.com/bfortuner/pytorch_tiramisu) to coreml, via onnx, and I'm getting this error in onnx-coreml's _operators.py : TypeError: Error while converting op of type: Concat. Error message: Unsupported axis 1 in input of shape Any thoughts about how I might work around this? The layers file is here, for reference: https://github.com/bfortuner/pytorch_tiramisu/blob/master/models/layers.py UPDATE 1: So, digging down further into this

Convert MobileNet from Keras to CoreML

给你一囗甜甜゛ 提交于 2019-12-13 03:54:29
问题 I'm using Keras 2.1.3 and I want to convert MobileNet to 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

Keras how to preprocess input signal

折月煮酒 提交于 2019-12-11 17:31:46
问题 I want to preprocess the input of my Keras model with certain signal processing functions as below. I want these to be part of my model because I will (hopefully) convert these to tf-lite or coreml. So I dont have to re-write these functionality on mobile app again. Although I couldn't figure out how and where I should add these to my model so inputs are preprocessed? #method to preprocess the model input, when called def getMfcss(); stfts = tf.contrib.signal.stft(signals, frame_length=frame