auto_decomposition
产品支持情况
产品  | 
是否支持  | 
|---|---|
x  | 
|
x  | 
|
√  | 
|
√  | 
|
√  | 
功能说明
根据用户提供的Caffe原始模型(.prototxt和.caffemodel),生成张量分解后的模型文件以及权重文件。
函数原型
1 | 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  | 
返回值说明
无
约束说明
- 用户提供用于转换的原始Caffe模型,需要保证prototxt文件和caffemodel配套。
 - 用户调用张量分解接口函数,输入原始模型路径以及模型分解后的保存路径,接口函数对符合分解条件的卷积层进行自动分解,约束请参见分解约束。
 
调用示例
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')  | 
落盘文件说明:
- 张量分解后的模型定义文件,格式为.prototxt。
 - 张量分解后的模型权重文件,格式为.caffemodel。
 
父主题: 张量分解接口