根据用户提供的Caffe原始模型(.prototxt和.caffemodel),生成张量分解后的模型文件以及权重文件。
auto_decomposition(model_file,weights_file,new_model_file,new_weights_file)
参数名 |
输入/返回值 |
含义 |
使用限制 |
---|---|---|---|
model_file |
输入 |
用户Caffe模型的定义文件,格式为.prototxt。 |
数据类型:string |
weights_file |
输入 |
用户训练好的的Caffe模型权重文件,格式为.caffemodel。 |
数据类型:string |
new_model_file |
输入 |
张量分解后的Caffe模型定义文件,格式为.prototxt,例如xx_tensor_decomposition.prototxt |
数据类型:string |
new_weights_file |
输入 |
张量分解后的Caffe模型权重文件,格式为.caffemodel,例如xx_tensor_decomposition.caffemodel |
数据类型:string |
无。
1 2 3 4 5 |
from amct_caffe.tensor_decompose import auto_decomposition auto_decomposition(model_file='ResNet-50-deploy.prototxt', weights_file='ResNet-50-weights.caffemodel', new_model_file='ResNet-50-deploy_tensor_decomposition.prototxt', new_weights_file='ResNet-50-deploy_tensor_decomposition.caffemodel') |