Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the weight of InnerProduct layer #4

Open
pengjiao123 opened this issue Feb 23, 2017 · 6 comments
Open

the weight of InnerProduct layer #4

pengjiao123 opened this issue Feb 23, 2017 · 6 comments

Comments

@pengjiao123
Copy link

你好,我把网络连接改成102410241024*10的全连接,利用python接口拿出solver.net.params['ip1'][0].data
即为全连接层的权重,为什么不是三值的?是不是我哪里做的有问题?
image

@pengjiao123
Copy link
Author

是1024乘以1024乘以1024乘以10的全连接

@fengfu-chris
Copy link
Owner

@pengjiao123 默认存储的是全精度的权重,使用时按照三值化函数前馈传播就行了。在deploy的时候,可以存储为三值化的权重,需要在solver里面加上
snapshot_ternary: true
这样在models目录里面会额外的存储 tn 结尾的三值权重。

@pengjiao123
Copy link
Author

的确会额外生成如lenet_tn_iter_1000.caffemodel.tn的文件,但是无法读取。一般的caffemodel不是可以通过net = caffe.Net(model, weights, 'test')的方式提取参数吗?我试了用这种方法不行。
谢谢了

@fengfu-chris
Copy link
Owner

存储的时候是把 16 个三值参数打包成 1 个 fixed32 类型的 ProtoBuffer, 所以需要专门的功能函数读取。你可以参考下 TernaryToProto 和 TernaryFromProto 这两个函数(blobs, layer, nets中)。

@Saniya666
Copy link

您好,请问你有解决掉读取三值权重模型这个问题吗?

@sainisanjay
Copy link

sainisanjay commented Jul 4, 2017

Hi @pengjiao123, are you able to visualize the ternary weights. Because i tried caffe code but that didn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants