caffe2 笔记

版权声明:本文为博主原创文章,转载请附上博文链接! https://blog.csdn.net/m0_37263345/article/details/81110503

1、Caffe中LMDB的使用   https://blog.csdn.net/haluoluo211/article/details/54427421

2、Protubuf   Google Protocol Buffer( 简称 Protobuf) 是一种轻便高效的结构化数据存储格式
https://www.ibm.com/developerworks/cn/linux/l-cn-gpb/index.html

3、caffe2编译

error while loading shared libraries: xxx.so.x" 错误的原因和解决办法

https://blog.csdn.net/u012839187/article/details/48025225

4、caffe2 operator 以及网络的定义都是使用protocol 序列化了了一个protobuf文件,等到真正运行的时候,他会使用c++后端根据protobuf文件进行初始化,然后运行

5、brew是一个智能的帮助函数的集合,可以使用他来创建网络。当创建网络或者operator的时候他可以像帮助函数那样帮助你初始化参数,定义操作,选择机器。

brew is a smart collection of helper functions. You can use all Caffe2 awesome helper functions with a single import of brew module. You can now add a FC layer using:

6、网络分为参数初始化网络和主网络

举例:

workspace.RunNetOnce(train_model.param_init_net)
workspace.CreateNet(train_model.net, overwrite=True)

workspace.RunNet(train_model.net)

7、In our view, 

ModelHelper class should only contain network definition and parameter information. (用来声明网络)

The brew module will have the functions to build network and initialize parameters.(用来把operator添加进网络)

举例:

train_model = model_helper.ModelHelper(name="mnist_train", arg_scope=arg_scope)

conv1 = brew.conv(train_model , data, 'conv1', dim_in=1, dim_out=20, kernel=5)

8、网络训练完,测试完之后,要部署网络来保存网络借结构和训练所得的参数,以备下次使用

举例:

deploy_model = model_helper.ModelHelper(
    name="mnist_deploy", arg_scope=arg_scope, init_params=False)
AddModel(deploy_model, "data")

pe_meta = pe.PredictorExportMeta(
    predict_net=deploy_model.net.Proto(),
    parameters=[str(b) for b in deploy_model.params], 
    inputs=["data"],
    outputs=["softmax"],
)

# save the model to a file. Use minidb as the file format
pe.save_to_db("minidb", os.path.join(root_folder, "mnist_model.minidb"), pe_meta)

猜你喜欢

转载自blog.csdn.net/m0_37263345/article/details/81110503