Yolo到keras到coreml:获得信心和坐标作为输出 ❓问题

Yolo到keras到coreml:获得信心和坐标作为输出 ❓问题,keras,yolo,coreml,coremltools,Keras,Yolo,Coreml,Coremltools,嗨, 采取了以下步骤 我用一个类对yolo tiny进行了定制数据集的培训 已将.weights(暗色)转换为.h5(keras)(已验证,keras模型运行良好) 现在,当我将Keras转换为coreml模型时,我并没有得到坐标和置信度作为输出 用于转换为核心ml的命令 coremltools.converters.keras.convert( 'model_data/yolo.h5', input_names='image', class_labels=output_labels, i

嗨, 采取了以下步骤

  • 我用一个类对yolo tiny进行了定制数据集的培训

  • 已将.weights(暗色)转换为.h5(keras)(已验证,keras模型运行良好)

  • 现在,当我将Keras转换为coreml模型时,我并没有得到坐标和置信度作为输出

  • 用于转换为核心ml的命令

    coremltools.converters.keras.convert(
    'model_data/yolo.h5',
     input_names='image',
     class_labels=output_labels,
     image_input_names='image',
     input_name_shape_dict={'image': [None, 416, 416, 3]}
     )
    
    尽管我已经检查了第三方Yolo模型,该模型转换为core ml,提供了坐标和信心

    请参阅屏幕截图:

    第三方Yolo型号转换为core ml

    coremltools.converters.keras.convert(
    'model_data/yolo.h5',
     input_names='image',
     class_labels=output_labels,
     image_input_names='image',
     input_name_shape_dict={'image': [None, 416, 416, 3]}
     )
    

    my Yolo模型转换为core ml

    coremltools.converters.keras.convert(
    'model_data/yolo.h5',
     input_names='image',
     class_labels=output_labels,
     image_input_names='image',
     input_name_shape_dict={'image': [None, 416, 416, 3]}
     )
    

    系统信息
    • Keras==2.1.5

    • coremltools==3.3


    不要添加此项:
    class\u labels=output\u labels
    ——它将使您的核心ML模型成为一个分类器,在核心ML中对其进行特殊处理。因为您的模型是一个对象检测器,所以您不希望这样

    其余的请看这里:


    基本上,您需要自己用Swift或Obj-C代码解码边界框坐标。您也可以将其添加到模型中,但根据我的经验,这要慢一些。(这里有一个演示如何对SSD执行此操作的示例,它与YOLO类似,但并不完全相同。)

    因此我尝试了博客文章中提到的步骤,坦率地说,这对初学者来说是压倒性的2个问题:1)有没有一条捷径2)如何为YOLO执行此操作?捷径是使用我提到的YOLO CoreML MPSNNGraph repo中的代码。这也是最好的方法。