Load a caffe model. You must be able to ``import caffe`` to use this function. Args: model_desc (str): path to caffe model description file (.prototxt). model_file (str): path to caffe model parameter file (.caffemodel). Returns: dict: the parameters.
(model_desc, model_file)
| 94 | |
| 95 | |
| 96 | def load_caffe(model_desc, model_file): |
| 97 | """ |
| 98 | Load a caffe model. You must be able to ``import caffe`` to use this |
| 99 | function. |
| 100 | |
| 101 | Args: |
| 102 | model_desc (str): path to caffe model description file (.prototxt). |
| 103 | model_file (str): path to caffe model parameter file (.caffemodel). |
| 104 | Returns: |
| 105 | dict: the parameters. |
| 106 | """ |
| 107 | with change_env('GLOG_minloglevel', '2'): |
| 108 | import caffe |
| 109 | caffe.set_mode_cpu() |
| 110 | net = caffe.Net(model_desc, model_file, caffe.TEST) |
| 111 | param_dict = CaffeLayerProcessor(net).process() |
| 112 | logger.info("Model loaded from caffe. Params: " + |
| 113 | ", ".join(sorted(param_dict.keys()))) |
| 114 | return param_dict |
| 115 | |
| 116 | |
| 117 | def get_caffe_pb(): |
no test coverage detected