Use image type for CoreML input, reshape last layer to work with metal shader
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import coremltools as ct
|
import coremltools as ct
|
||||||
|
|
||||||
|
|
||||||
def convert_coreml(model_path, save_path='../mobilenet_nnconv5.mlmodel'):
|
def convert_coreml(model_path, save_path='mobilenet_nnconv5.mlmodel'):
|
||||||
mlmodel = ct.convert(model_path)
|
mlmodel = ct.convert(model_path, inputs=[ct.ImageType()])
|
||||||
mlmodel.save(save_path)
|
mlmodel.save(save_path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ def mobilenet_nnconv5(weights=None, shape=(224, 224, 3)):
|
|||||||
x = keras.layers.Conv2D(1, 1, padding='same')(x)
|
x = keras.layers.Conv2D(1, 1, padding='same')(x)
|
||||||
x = keras.layers.BatchNormalization()(x)
|
x = keras.layers.BatchNormalization()(x)
|
||||||
x = keras.layers.ReLU(6.)(x)
|
x = keras.layers.ReLU(6.)(x)
|
||||||
|
x = keras.layers.Reshape([shape[0], shape[1]])(x)
|
||||||
return keras.Model(inputs=input, outputs=x, name="fast_depth")
|
return keras.Model(inputs=input, outputs=x, name="fast_depth")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user