Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.05 KB

CaffeToMLModel.md

File metadata and controls

39 lines (29 loc) · 1.05 KB

Convert from OpenPose Caffe-Model to MLModel

Get Caffe-model and prototxt.

Edit pose_deploy_linevec.prototxt

edit input_dim of pose_deploy_linevec.prototxt.
input_dim: 368

input: "image"
input_dim: 1
input_dim: 3
input_dim: 368 # This value will be defined at runtime
input_dim: 368 # This value will be defined at runtime

Convert from OpenPose Caffe-Model to MLModel.

import coremltools

#proto_file = 'pose_deploy.prototxt'
proto_file = 'pose_deploy_linevec.prototxt'
caffe_model = 'pose_iter_440000.caffemodel'

coreml_model = coremltools.converters.caffe.convert((caffe_model, proto_file)
, image_input_names='image'
, image_scale=1/255.
)

coreml_model.save('coco_pose_368.mlmodel')