6 Replies
      Latest reply on Sep 21, 2017 12:58 PM by fucklol123123
      Flowinger Level 1 Level 1 (0 points)

        Hey,

         

        I am trying to convert a keras model into a CoreML model.:

        scale = 1./255
        coreml_model = coremltools.converters.keras.convert(model,
                                                            input_names=['image'],
                                                            #output_names=['probs'],
                                                            image_input_names='image',
                                                            class_labels='classes.txt',
                                                            #predicted_feature_name='class',
                                                            image_scale=scale,
                                                            red_bias=-1,
                                                            green_bias=-1,
                                                            blue_bias=-1)
        
        
        
        

         

        I get the following error:

        429 blue_bias = blue_bias
        430 gray_bias = gray_bias
        431 image_scale = image_scale)
        432
        433 # Return the protobuf spec /usr/local/lib/python2.7/dist-packages/coremltools/models/neural_network.pyc in set_pre_processing_parameters(self, image_input_names, is_bgr, red_bias, green_bias, blue_bias, gray_bias, image_scale)
        
        1661 if input_.type.WhichOneof('Type') == 'multiArrayType':
        1662 array_shape = tuple(input_.type.multiArrayType.shape)
        -> 1663 channels, height, width = array_shape 
        1664 if channels == 1: 
        1665 input_.type.imageType.colorSpace = _FeatureTypes_pb2.ImageFeatureType.ColorSpace.Value('GRAYSCALE') 
        ValueError: need more than 1 value to unpack
        


        I can't manage to get my model into Xcode the right way. It always shows MultiArray as input type instead of Image<RGB,224,224>.

        The shape is right I guess (channel, height, width):

        Neural Network compiler 315: 175 , name = dense_25__activation__, output shape : (C,H,W) = (468, 1, 1)
        
        
        

         

        Any ideas/suggestions? Thanks in advance!