想试下apple的对象识别的coreml的效果,下了如下的demo,跑起来效果挺好。
https://developer.apple.com/documentation/vision/recognizing_objects_in_live_capture
就是这个demo里的模型,是yolo训练好的mlmodel文件,想试一下自己训练文件,看了apple的文档,要么用turicreate python库,要么用create ml工具来实现,但两者都涉及到标注文件的格式问题。
要识别的对象,我们需要用labelimg库来标注出区域和label名称。但是labelimg标注好的xml格式,apple的二个方式都不识别,看了半天文档,apple也没说他能识别的json格式具体是怎么样的。找了半天,在Stack Overflow里找到了。
具体json格式如下,还要注意个点是x,y是中心点位置,不是左上角
[
{"path":"/Users/wenxing/Downloads/test/8.png","name":"8.png","width":254,"height":183,"label":"heimao","annotations":[{"coordinates":{"x":147.5,"width":93,"y":62,"height":94},"label":"heimao"}]}
,{"path":"/Users/wenxing/Downloads/test/1.jpg","name":"1.jpg","width":298,"height":300,"label":"heimao","annotations":[{"coordinates":{"x":143,"width":156,"y":64,"height":126},"label":"heimao"}]}
]