Open rajasekhar6057 opened 4 years ago
I haven't tried to convert to CoreML model format, but it seems like the TF OP "ResizeNearestNeighbor" is incompatible, which is involved by keras UpSampling2D layer with default "interpolation='nearest'" option. Maybe you can try to change the interpolation method to 'bilinear' to see if it's ok for the CoreML convert tool
Hi David, Thank you so much for the reply. i will try this and update you the result.
Hi @david8862 , I have changed the interpolation method to bilinear. Below is the output for the conversion. The error happened at the same layer(173) again. Any help from you would be really appreciated.
SSAConverter] [169/203] Converting op type: 'Transpose', name: 'model/leaky_re_lu_7/LeakyRelu_to_nhwc', output_shape: (-1, -1, -1, 128).
[SSAConverter] [170/203] Converting op type: 'Shape', name: 'model/up_sampling2d_1/Shape', output_shape: (4,).
[SSAConverter] [171/203] Converting op type: 'StridedSlice', name: 'model/up_sampling2d_1/strided_slice', output_shape: (2,).
[SSAConverter] [172/203] Converting op type: 'Mul', name: 'model/up_sampling2d_1/mul', output_shape: (2,).
[SSAConverter] [173/203] Converting op type: 'ResizeBilinear', name: 'model/up_sampling2d_1/resize/ResizeBilinear', output_shape: (-1, 128, -1, -1).
Traceback (most recent call last):
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "
then it's a little weired since you have specified the input shape. UpSampling2D is a mandatory layer for YOLOv3 head, so maybe need to contact the author of convert tool
Hi David, Thank you for suggestion. I will check with the author of the convert tool!
Hi @david8862 ,
I have followed your git hub repo to train a model using Mobilenet as a back bone and Yolov3 lite as head. Can you please try on your end to convert the .h5 or .pb model for the same to coreml model. I have tried all the possible ways but couldn't find a solution for this. Even i have raised an issue on coremltools github page. Any sort of help would be grateful.
@rajasekhar6057 I tried the .h5 and .pb model to convert to CoreML and it seems the YOLOv2 & Tiny YOLOv3 families with .pb format could work, but need to manually specify the input/output tensor names. I've commit a script tensorflow_to_coreml.py for that and maybe you can have a try.
Hi @david8862 , Thank you so much for your help. I will try to train the model with head as Tiny YOLOV3 and will try to convert the .pb model to core ml model and will post you the updates.
Hi @david8862 , Yayy!!! Finally we were able to convert .pb model to mlmodel. We used Tiny YOLOV3 for our use case. Thank you!
Hi David,
I have trained the tf.keras model on my new images and trying to convert the trained model to coreml model. Till 172/203 are converting fine. But at 173 layer i am getting the below issue at "ValueError: [SSAConverter] Unable to determine target size for ResizeNearestNeighbor"
Below is the code i have used for the conversion.
import tensorflow as tf import numpy as np import tfcoreml import keras
model_path = '../Desktop/saved_model/saved_model.h5' keras_model = tf.keras.models.load_model(model_path, compile=False, custom_objects=None) input_name = keras_model.inputs[0].name.split(':')[0] graph_output_node_name = ['Identity']
convert this model to Core ML format
model = tfcoreml.convert(tf_model_path=model_path, image_input_names=input_name, input_name_shape_dict={input_name: (1, 416, 416,3)}, output_feature_names=graph_output_node_name, minimum_ios_deployment_target='13') model.save('./mnist_fashion_model.mlmodel')
------
Compilation
------
WARNING:root:TensorFlow version 2.2.0 detected. Last version known to be fully compatible is 1.14.0 . 2020-05-18 21:35:03.921783: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2020-05-18 21:35:03.932868: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fa2455b5420 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-05-18 21:35:03.932879: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually. WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually. 2020-05-18 21:35:07.897911: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support) 2020-05-18 21:35:07.897989: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session 2020-05-18 21:35:07.910058: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:797] Optimization results for grappler item: graph_to_optimize 2020-05-18 21:35:07.910070: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:799] function_optimizer: function_optimizer did nothing. time = 0.001ms. 2020-05-18 21:35:07.910073: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:799] function_optimizer: function_optimizer did nothing. time = 0ms. 0 assert nodes deleted 295 nodes deleted 174 nodes deleted 0 nodes deleted [Op Fusion] fuse_bias_add() deleted 16 nodes. 2 identity nodes deleted 33 disconnected nodes deleted [Op Fusion] Fused 312 nodes into BatchNorms. [Op Fusion] Fused 1 Pad nodes into Conv2D. [SSAConverter] Converting function main ... [SSAConverter] [1/203] Converting op type: 'Placeholder', name: 'image_input', output_shape: (1, 416, 416, 3). [SSAConverter] [2/203] Converting op type: 'Const', name: 'model/conv_dw_1/depthwise/ReadVariableOp', output_shape: (3, 3, 32, 1). [SSAConverter] [3/203] Converting op type: 'Const', name: 'model/conv_pad_2/Pad/paddings', output_shape: (4, 2). [SSAConverter] [4/203] Converting op type: 'Const', name: 'model/conv_dw_2/depthwise/ReadVariableOp', output_shape: (3, 3, 64, 1). [SSAConverter] [5/203] Converting op type: 'Const', name: 'model/conv_dw_3/depthwise/ReadVariableOp', output_shape: (3, 3, 128, 1). [SSAConverter] [6/203] Converting op type: 'Const', name: 'model/conv_pad_4/Pad/paddings', output_shape: (4, 2). [SSAConverter] [7/203] Converting op type: 'Const', name: 'model/conv_dw_4/depthwise/ReadVariableOp', output_shape: (3, 3, 128, 1). [SSAConverter] [8/203] Converting op type: 'Const', name: 'model/conv_dw_5/depthwise/ReadVariableOp', output_shape: (3, 3, 256, 1). [SSAConverter] [9/203] Converting op type: 'Const', name: 'model/conv_pad_6/Pad/paddings', output_shape: (4, 2). [SSAConverter] [10/203] Converting op type: 'Const', name: 'model/conv_dw_6/depthwise/ReadVariableOp', output_shape: (3, 3, 256, 1). [SSAConverter] [11/203] Converting op type: 'Const', name: 'model/conv_dw_7/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [12/203] Converting op type: 'Const', name: 'model/conv_dw_8/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [13/203] Converting op type: 'Const', name: 'model/conv_dw_9/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [14/203] Converting op type: 'Const', name: 'model/conv_dw_10/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [15/203] Converting op type: 'Const', name: 'model/conv_dw_11/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [16/203] Converting op type: 'Const', name: 'model/conv_pad_12/Pad/paddings', output_shape: (4, 2). [SSAConverter] [17/203] Converting op type: 'Const', name: 'model/conv_dw_12/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [18/203] Converting op type: 'Const', name: 'model/conv_dw_13/depthwise/ReadVariableOp', output_shape: (3, 3, 1024, 1). [SSAConverter] [19/203] Converting op type: 'Const', name: 'model/conv_dw_14_1/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [20/203] Converting op type: 'Const', name: 'model/conv_dw_14_2/depthwise/ReadVariableOp', output_shape: (3, 3, 512, 1). [SSAConverter] [21/203] Converting op type: 'Const', name: 'model/up_sampling2d/mul', output_shape: (2,). [SSAConverter] [22/203] Converting op type: 'Const', name: 'model/concatenate/concat/axis'. [SSAConverter] [23/203] Converting op type: 'Const', name: 'model/conv_dw_15_1/depthwise/ReadVariableOp', output_shape: (3, 3, 256, 1). [SSAConverter] [24/203] Converting op type: 'Const', name: 'model/conv_dw_15_2/depthwise/ReadVariableOp', output_shape: (3, 3, 256, 1). [SSAConverter] [25/203] Converting op type: 'Const', name: 'model/up_sampling2d_1/strided_slice/stack', output_shape: (1,). [SSAConverter] [26/203] Converting op type: 'Const', name: 'model/up_sampling2d_1/strided_slice/stack_1', output_shape: (1,). [SSAConverter] [27/203] Converting op type: 'Const', name: 'model/up_sampling2d_1/strided_slice/stack_2', output_shape: (1,). [SSAConverter] [28/203] Converting op type: 'Const', name: 'model/up_sampling2d_1/Const', output_shape: (2,). [SSAConverter] [29/203] Converting op type: 'Const', name: 'model/concatenate_1/concat/axis'. [SSAConverter] [30/203] Converting op type: 'Const', name: 'model/conv_dw_16_1/depthwise/ReadVariableOp', output_shape: (3, 3, 128, 1). [SSAConverter] [31/203] Converting op type: 'Const', name: 'model/conv_dw_16_2/depthwise/ReadVariableOp', output_shape: (3, 3, 128, 1). [SSAConverter] [32/203] Converting op type: 'Const', name: 'model/conv_dw_16_3/depthwise/ReadVariableOp', output_shape: (3, 3, 128, 1). [SSAConverter] [33/203] Converting op type: 'Transpose', name: 'image_input_to_nchw', output_shape: (1, 3, 416, 416). [SSAConverter] [34/203] Converting op type: 'Conv2D', name: 'model/conv1/Conv2D', output_shape: (1, 32, 208, 208). [SSAConverter] [35/203] Converting op type: 'BatchNorm', name: 'model/conv1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 32, 208, 208). [SSAConverter] [36/203] Converting op type: 'Relu6', name: 'model/conv1_relu/Relu6', output_shape: (1, 32, 208, 208). [SSAConverter] [37/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_1/depthwise', output_shape: (1, 32, 208, 208). [SSAConverter] [38/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 32, 208, 208). [SSAConverter] [39/203] Converting op type: 'Relu6', name: 'model/conv_dw_1_relu/Relu6', output_shape: (1, 32, 208, 208). [SSAConverter] [40/203] Converting op type: 'Conv2D', name: 'model/conv_pw_1/Conv2D', output_shape: (1, 64, 208, 208). [SSAConverter] [41/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 64, 208, 208). [SSAConverter] [42/203] Converting op type: 'Relu6', name: 'model/conv_pw_1_relu/Relu6', output_shape: (1, 64, 208, 208). [SSAConverter] [43/203] Converting op type: 'Pad', name: 'model/conv_pad_2/Pad', output_shape: (1, 64, 209, 209). [SSAConverter] [44/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_2/depthwise', output_shape: (1, 64, 104, 104). [SSAConverter] [45/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 64, 104, 104). [SSAConverter] [46/203] Converting op type: 'Relu6', name: 'model/conv_dw_2_relu/Relu6', output_shape: (1, 64, 104, 104). [SSAConverter] [47/203] Converting op type: 'Conv2D', name: 'model/conv_pw_2/Conv2D', output_shape: (1, 128, 104, 104). [SSAConverter] [48/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 128, 104, 104). [SSAConverter] [49/203] Converting op type: 'Relu6', name: 'model/conv_pw_2_relu/Relu6', output_shape: (1, 128, 104, 104). [SSAConverter] [50/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_3/depthwise', output_shape: (1, 128, 104, 104). [SSAConverter] [51/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_3_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 128, 104, 104). [SSAConverter] [52/203] Converting op type: 'Relu6', name: 'model/conv_dw_3_relu/Relu6', output_shape: (1, 128, 104, 104). [SSAConverter] [53/203] Converting op type: 'Conv2D', name: 'model/conv_pw_3/Conv2D', output_shape: (1, 128, 104, 104). [SSAConverter] [54/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_3_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 128, 104, 104). [SSAConverter] [55/203] Converting op type: 'Relu6', name: 'model/conv_pw_3_relu/Relu6', output_shape: (1, 128, 104, 104). [SSAConverter] [56/203] Converting op type: 'Pad', name: 'model/conv_pad_4/Pad', output_shape: (1, 128, 105, 105). [SSAConverter] [57/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_4/depthwise', output_shape: (1, 128, 52, 52). [SSAConverter] [58/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_4_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 128, 52, 52). [SSAConverter] [59/203] Converting op type: 'Relu6', name: 'model/conv_dw_4_relu/Relu6', output_shape: (1, 128, 52, 52). [SSAConverter] [60/203] Converting op type: 'Conv2D', name: 'model/conv_pw_4/Conv2D', output_shape: (1, 256, 52, 52). [SSAConverter] [61/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_4_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 256, 52, 52). [SSAConverter] [62/203] Converting op type: 'Relu6', name: 'model/conv_pw_4_relu/Relu6', output_shape: (1, 256, 52, 52). [SSAConverter] [63/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_5/depthwise', output_shape: (1, 256, 52, 52). [SSAConverter] [64/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_5_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 256, 52, 52). [SSAConverter] [65/203] Converting op type: 'Relu6', name: 'model/conv_dw_5_relu/Relu6', output_shape: (1, 256, 52, 52). [SSAConverter] [66/203] Converting op type: 'Conv2D', name: 'model/conv_pw_5/Conv2D', output_shape: (1, 256, 52, 52). [SSAConverter] [67/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_5_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 256, 52, 52). [SSAConverter] [68/203] Converting op type: 'Relu6', name: 'model/conv_pw_5_relu/Relu6', output_shape: (1, 256, 52, 52). [SSAConverter] [69/203] Converting op type: 'Pad', name: 'model/conv_pad_6/Pad', output_shape: (1, 256, 53, 53). [SSAConverter] [70/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_6/depthwise', output_shape: (1, 256, 26, 26). [SSAConverter] [71/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_6_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 256, 26, 26). [SSAConverter] [72/203] Converting op type: 'Relu6', name: 'model/conv_dw_6_relu/Relu6', output_shape: (1, 256, 26, 26). [SSAConverter] [73/203] Converting op type: 'Conv2D', name: 'model/conv_pw_6/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [74/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_6_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [75/203] Converting op type: 'Relu6', name: 'model/conv_pw_6_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [76/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_7/depthwise', output_shape: (1, 512, 26, 26). [SSAConverter] [77/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_7_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [78/203] Converting op type: 'Relu6', name: 'model/conv_dw_7_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [79/203] Converting op type: 'Conv2D', name: 'model/conv_pw_7/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [80/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_7_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [81/203] Converting op type: 'Relu6', name: 'model/conv_pw_7_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [82/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_8/depthwise', output_shape: (1, 512, 26, 26). [SSAConverter] [83/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_8_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [84/203] Converting op type: 'Relu6', name: 'model/conv_dw_8_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [85/203] Converting op type: 'Conv2D', name: 'model/conv_pw_8/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [86/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_8_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [87/203] Converting op type: 'Relu6', name: 'model/conv_pw_8_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [88/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_9/depthwise', output_shape: (1, 512, 26, 26). [SSAConverter] [89/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_9_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [90/203] Converting op type: 'Relu6', name: 'model/conv_dw_9_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [91/203] Converting op type: 'Conv2D', name: 'model/conv_pw_9/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [92/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_9_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [93/203] Converting op type: 'Relu6', name: 'model/conv_pw_9_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [94/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_10/depthwise', output_shape: (1, 512, 26, 26). [SSAConverter] [95/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_10_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [96/203] Converting op type: 'Relu6', name: 'model/conv_dw_10_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [97/203] Converting op type: 'Conv2D', name: 'model/conv_pw_10/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [98/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_10_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [99/203] Converting op type: 'Relu6', name: 'model/conv_pw_10_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [100/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_11/depthwise', output_shape: (1, 512, 26, 26). [SSAConverter] [101/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_11_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [102/203] Converting op type: 'Relu6', name: 'model/conv_dw_11_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [103/203] Converting op type: 'Conv2D', name: 'model/conv_pw_11/Conv2D', output_shape: (1, 512, 26, 26). [SSAConverter] [104/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_11_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 26, 26). [SSAConverter] [105/203] Converting op type: 'Relu6', name: 'model/conv_pw_11_relu/Relu6', output_shape: (1, 512, 26, 26). [SSAConverter] [106/203] Converting op type: 'Pad', name: 'model/conv_pad_12/Pad', output_shape: (1, 512, 27, 27). [SSAConverter] [107/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_12/depthwise', output_shape: (1, 512, 13, 13). [SSAConverter] [108/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_12_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [109/203] Converting op type: 'Relu6', name: 'model/conv_dw_12_relu/Relu6', output_shape: (1, 512, 13, 13). [SSAConverter] [110/203] Converting op type: 'Conv2D', name: 'model/conv_pw_12/Conv2D', output_shape: (1, 1024, 13, 13). [SSAConverter] [111/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_12_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 1024, 13, 13). [SSAConverter] [112/203] Converting op type: 'Relu6', name: 'model/conv_pw_12_relu/Relu6', output_shape: (1, 1024, 13, 13). [SSAConverter] [113/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_13/depthwise', output_shape: (1, 1024, 13, 13). [SSAConverter] [114/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_13_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 1024, 13, 13). [SSAConverter] [115/203] Converting op type: 'Relu6', name: 'model/conv_dw_13_relu/Relu6', output_shape: (1, 1024, 13, 13). [SSAConverter] [116/203] Converting op type: 'Conv2D', name: 'model/conv_pw_13/Conv2D', output_shape: (1, 1024, 13, 13). [SSAConverter] [117/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_13_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 1024, 13, 13). [SSAConverter] [118/203] Converting op type: 'Relu6', name: 'model/conv_pw_13_relu/Relu6', output_shape: (1, 1024, 13, 13). [SSAConverter] [119/203] Converting op type: 'Conv2D', name: 'model/conv2d/Conv2D', output_shape: (1, 512, 13, 13). [SSAConverter] [120/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [121/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu/LeakyRelu', output_shape: (1, 512, 13, 13). [SSAConverter] [122/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_14_1/depthwise', output_shape: (1, 512, 13, 13). [SSAConverter] [123/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_14_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [124/203] Converting op type: 'LeakyRelu', name: 'model/conv_dw_14_1_leaky_relu/LeakyRelu', output_shape: (1, 512, 13, 13). [SSAConverter] [125/203] Converting op type: 'Conv2D', name: 'model/conv_pw_14_1/Conv2D', output_shape: (1, 1024, 13, 13). [SSAConverter] [126/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_14_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 1024, 13, 13). [SSAConverter] [127/203] Converting op type: 'LeakyRelu', name: 'model/conv_pw_14_1_leaky_relu/LeakyRelu', output_shape: (1, 1024, 13, 13). [SSAConverter] [128/203] Converting op type: 'Conv2D', name: 'model/conv2d_1/Conv2D', output_shape: (1, 512, 13, 13). [SSAConverter] [129/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_1/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [130/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_1/LeakyRelu', output_shape: (1, 512, 13, 13). [SSAConverter] [131/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_14_2/depthwise', output_shape: (1, 512, 13, 13). [SSAConverter] [132/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_14_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [133/203] Converting op type: 'LeakyRelu', name: 'model/conv_dw_14_2_leaky_relu/LeakyRelu', output_shape: (1, 512, 13, 13). [SSAConverter] [134/203] Converting op type: 'Conv2D', name: 'model/conv_pw_14_2/Conv2D', output_shape: (1, 1024, 13, 13). [SSAConverter] [135/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_14_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 1024, 13, 13). [SSAConverter] [136/203] Converting op type: 'LeakyRelu', name: 'model/conv_pw_14_2_leaky_relu/LeakyRelu', output_shape: (1, 1024, 13, 13). [SSAConverter] [137/203] Converting op type: 'Conv2D', name: 'model/conv2d_2/Conv2D', output_shape: (1, 512, 13, 13). [SSAConverter] [138/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_2/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 512, 13, 13). [SSAConverter] [139/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_2/LeakyRelu', output_shape: (1, 512, 13, 13). [SSAConverter] [140/203] Converting op type: 'Conv2D', name: 'model/conv2d_4/Conv2D', output_shape: (1, 256, 13, 13). [SSAConverter] [141/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_3/FusedBatchNormV3/Add_batch_norm', output_shape: (1, 256, 13, 13). [SSAConverter] [142/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_3/LeakyRelu', output_shape: (1, 256, 13, 13). [SSAConverter] [143/203] Converting op type: 'ResizeNearestNeighbor', name: 'model/up_sampling2d/resize/ResizeNearestNeighbor', output_shape: (-1, 256, -1, -1). [SSAConverter] [144/203] Converting op type: 'ConcatV2', name: 'model/concatenate/concat', output_shape: (-1, 768, -1, -1). [SSAConverter] [145/203] Converting op type: 'Conv2D', name: 'model/conv2d_5/Conv2D', output_shape: (-1, 256, -1, -1). [SSAConverter] [146/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_4/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 256, -1, -1). [SSAConverter] [147/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_4/LeakyRelu', output_shape: (-1, 256, -1, -1). [SSAConverter] [148/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_15_1/depthwise', output_shape: (-1, 256, -1, -1). [SSAConverter] [149/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_15_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 256, -1, -1). [SSAConverter] [150/203] Converting op type: 'LeakyRelu', name: 'model/conv_dw_15_1_leaky_relu/LeakyRelu', output_shape: (-1, 256, -1, -1). [SSAConverter] [151/203] Converting op type: 'Conv2D', name: 'model/conv_pw_15_1/Conv2D', output_shape: (-1, 512, -1, -1). [SSAConverter] [152/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_15_1_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 512, -1, -1). [SSAConverter] [153/203] Converting op type: 'LeakyRelu', name: 'model/conv_pw_15_1_leaky_relu/LeakyRelu', output_shape: (-1, 512, -1, -1). [SSAConverter] [154/203] Converting op type: 'Conv2D', name: 'model/conv2d_6/Conv2D', output_shape: (-1, 256, -1, -1). [SSAConverter] [155/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_5/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 256, -1, -1). [SSAConverter] [156/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_5/LeakyRelu', output_shape: (-1, 256, -1, -1). [SSAConverter] [157/203] Converting op type: 'DepthwiseConv2dNative', name: 'model/conv_dw_15_2/depthwise', output_shape: (-1, 256, -1, -1). [SSAConverter] [158/203] Converting op type: 'BatchNorm', name: 'model/conv_dw_15_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 256, -1, -1). [SSAConverter] [159/203] Converting op type: 'LeakyRelu', name: 'model/conv_dw_15_2_leaky_relu/LeakyRelu', output_shape: (-1, 256, -1, -1). [SSAConverter] [160/203] Converting op type: 'Conv2D', name: 'model/conv_pw_15_2/Conv2D', output_shape: (-1, 512, -1, -1). [SSAConverter] [161/203] Converting op type: 'BatchNorm', name: 'model/conv_pw_15_2_bn/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 512, -1, -1). [SSAConverter] [162/203] Converting op type: 'LeakyRelu', name: 'model/conv_pw_15_2_leaky_relu/LeakyRelu', output_shape: (-1, 512, -1, -1). [SSAConverter] [163/203] Converting op type: 'Conv2D', name: 'model/conv2d_7/Conv2D', output_shape: (-1, 256, -1, -1). [SSAConverter] [164/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_6/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 256, -1, -1). [SSAConverter] [165/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_6/LeakyRelu', output_shape: (-1, 256, -1, -1). [SSAConverter] [166/203] Converting op type: 'Conv2D', name: 'model/conv2d_9/Conv2D', output_shape: (-1, 128, -1, -1). [SSAConverter] [167/203] Converting op type: 'BatchNorm', name: 'model/batch_normalization_7/FusedBatchNormV3/Add_batch_norm', output_shape: (-1, 128, -1, -1). [SSAConverter] [168/203] Converting op type: 'LeakyRelu', name: 'model/leaky_re_lu_7/LeakyRelu', output_shape: (-1, 128, -1, -1). [SSAConverter] [169/203] Converting op type: 'Transpose', name: 'model/leaky_re_lu_7/LeakyRelu_to_nhwc', output_shape: (-1, -1, -1, 128). [SSAConverter] [170/203] Converting op type: 'Shape', name: 'model/up_sampling2d_1/Shape', output_shape: (4,). [SSAConverter] [171/203] Converting op type: 'StridedSlice', name: 'model/up_sampling2d_1/strided_slice', output_shape: (2,). [SSAConverter] [172/203] Converting op type: 'Mul', name: 'model/up_sampling2d_1/mul', output_shape: (2,). [SSAConverter] [173/203] Converting op type: 'ResizeNearestNeighbor', name: 'model/up_sampling2d_1/resize/ResizeNearestNeighbor', output_shape: (-1, 128, -1, -1). Traceback (most recent call last): File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 25, in
minimum_ios_deployment_target='13')
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/tfcoreml/_tf_coreml_converter.py", line 691, in convert
custom_shape_functions=custom_shape_functions)
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/coremltools/converters/tensorflow/_tf_converter.py", line 193, in convert
optional_inputs=optional_inputs)
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/coremltools/converters/nnssa/coreml/ssa_converter.py", line 154, in ssa_convert
converter.convert()
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/coremltools/converters/nnssa/coreml/ssa_converter.py", line 581, in convert
convert_func(node)
File "Users/opt/anaconda3/envs/py_374/lib/python3.7/site-packages/coremltools/converters/nnssa/coreml/ssa_converter.py", line 2223, in _convert_resize_nearest_neighbor
raise ValueError('[SSAConverter] Unable to determine target size'
ValueError: [SSAConverter] Unable to determine target size for ResizeNearestNeighbor