def load_caffe(model_desc, model_file):
    param_dict = {}
    param_processors = get_processor()

    with change_env('GLOG_minloglevel', '2'):
        import caffe
        caffe.set_mode_cpu()
        net = caffe.Net(model_desc, model_file, caffe.TEST)
    layer_names = net._layer_names
    blob_names = net.blobs.keys()
    for layername, layer in zip(layer_names, net.layers):
        try:
            prev_blob_name = blob_names[blob_names.index(layername)-1]
            prev_data_shape = net.blobs[prev_blob_name].data.shape[1:]
        except ValueError:
            prev_data_shape = None
        if layer.type in param_processors:
            param_dict.update(param_processors[layer.type](
                layername, layer.blobs, prev_data_shape))
        else:
            assert len(layer.blobs) == 0, len(layer.blobs)
    logger.info("Model loaded from caffe. Params: " + \
                " ".join(sorted(param_dict.keys())))
    return param_dict
return a dict of params
dataset/ETHPy150Open ppwwyyxx/tensorpack/tensorpack/utils/loadcaffe.py/load_caffe