diff --git a/tests/st/testcase/origin_models/ResNet-50-deploy.prototxt b/tests/st/testcase/origin_models/ResNet-50-deploy.prototxt deleted file mode 100755 index cc50de4..0000000 --- a/tests/st/testcase/origin_models/ResNet-50-deploy.prototxt +++ /dev/null @@ -1,2320 +0,0 @@ -name: "ResNet-50" -input: "data" -input_dim: 1 -input_dim: 3 -input_dim: 224 -input_dim: 224 - -layer { - bottom: "data" - top: "conv1" - name: "conv1" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 7 - pad: 3 - stride: 2 - } -} - -layer { - bottom: "conv1" - top: "conv1" - name: "bn_conv1" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "conv1" - top: "conv1" - name: "scale_conv1" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "conv1" - top: "conv1" - name: "conv1_relu" - type: "ReLU" -} - -layer { - bottom: "conv1" - top: "pool1" - name: "pool1" - type: "Pooling" - pooling_param { - kernel_size: 3 - stride: 2 - pool: MAX - } -} - -layer { - bottom: "pool1" - top: "res2a_branch1" - name: "res2a_branch1" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2a_branch1" - top: "res2a_branch1" - name: "bn2a_branch1" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2a_branch1" - top: "res2a_branch1" - name: "scale2a_branch1" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "pool1" - top: "res2a_branch2a" - name: "res2a_branch2a" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2a_branch2a" - top: "res2a_branch2a" - name: "bn2a_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2a_branch2a" - top: "res2a_branch2a" - name: "scale2a_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2a_branch2a" - top: "res2a_branch2a" - name: "res2a_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res2a_branch2a" - top: "res2a_branch2b" - name: "res2a_branch2b" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2a_branch2b" - top: "res2a_branch2b" - name: "bn2a_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2a_branch2b" - top: "res2a_branch2b" - name: "scale2a_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2a_branch2b" - top: "res2a_branch2b" - name: "res2a_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res2a_branch2b" - top: "res2a_branch2c" - name: "res2a_branch2c" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2a_branch2c" - top: "res2a_branch2c" - name: "bn2a_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2a_branch2c" - top: "res2a_branch2c" - name: "scale2a_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2a_branch1" - bottom: "res2a_branch2c" - top: "res2a" - name: "res2a" - type: "Eltwise" -} - -layer { - bottom: "res2a" - top: "res2a" - name: "res2a_relu" - type: "ReLU" -} - -layer { - bottom: "res2a" - top: "res2b_branch2a" - name: "res2b_branch2a" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2b_branch2a" - top: "res2b_branch2a" - name: "bn2b_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2b_branch2a" - top: "res2b_branch2a" - name: "scale2b_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2b_branch2a" - top: "res2b_branch2a" - name: "res2b_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res2b_branch2a" - top: "res2b_branch2b" - name: "res2b_branch2b" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2b_branch2b" - top: "res2b_branch2b" - name: "bn2b_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2b_branch2b" - top: "res2b_branch2b" - name: "scale2b_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2b_branch2b" - top: "res2b_branch2b" - name: "res2b_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res2b_branch2b" - top: "res2b_branch2c" - name: "res2b_branch2c" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2b_branch2c" - top: "res2b_branch2c" - name: "bn2b_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2b_branch2c" - top: "res2b_branch2c" - name: "scale2b_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2a" - bottom: "res2b_branch2c" - top: "res2b" - name: "res2b" - type: "Eltwise" -} - -layer { - bottom: "res2b" - top: "res2b" - name: "res2b_relu" - type: "ReLU" -} - -layer { - bottom: "res2b" - top: "res2c_branch2a" - name: "res2c_branch2a" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2c_branch2a" - top: "res2c_branch2a" - name: "bn2c_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2c_branch2a" - top: "res2c_branch2a" - name: "scale2c_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2c_branch2a" - top: "res2c_branch2a" - name: "res2c_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res2c_branch2a" - top: "res2c_branch2b" - name: "res2c_branch2b" - type: "Convolution" - convolution_param { - num_output: 64 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2c_branch2b" - top: "res2c_branch2b" - name: "bn2c_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2c_branch2b" - top: "res2c_branch2b" - name: "scale2c_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2c_branch2b" - top: "res2c_branch2b" - name: "res2c_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res2c_branch2b" - top: "res2c_branch2c" - name: "res2c_branch2c" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res2c_branch2c" - top: "res2c_branch2c" - name: "bn2c_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res2c_branch2c" - top: "res2c_branch2c" - name: "scale2c_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2b" - bottom: "res2c_branch2c" - top: "res2c" - name: "res2c" - type: "Eltwise" -} - -layer { - bottom: "res2c" - top: "res2c" - name: "res2c_relu" - type: "ReLU" -} - -layer { - bottom: "res2c" - top: "res3a_branch1" - name: "res3a_branch1" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res3a_branch1" - top: "res3a_branch1" - name: "bn3a_branch1" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3a_branch1" - top: "res3a_branch1" - name: "scale3a_branch1" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res2c" - top: "res3a_branch2a" - name: "res3a_branch2a" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res3a_branch2a" - top: "res3a_branch2a" - name: "bn3a_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3a_branch2a" - top: "res3a_branch2a" - name: "scale3a_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3a_branch2a" - top: "res3a_branch2a" - name: "res3a_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res3a_branch2a" - top: "res3a_branch2b" - name: "res3a_branch2b" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3a_branch2b" - top: "res3a_branch2b" - name: "bn3a_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3a_branch2b" - top: "res3a_branch2b" - name: "scale3a_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3a_branch2b" - top: "res3a_branch2b" - name: "res3a_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res3a_branch2b" - top: "res3a_branch2c" - name: "res3a_branch2c" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3a_branch2c" - top: "res3a_branch2c" - name: "bn3a_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3a_branch2c" - top: "res3a_branch2c" - name: "scale3a_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3a_branch1" - bottom: "res3a_branch2c" - top: "res3a" - name: "res3a" - type: "Eltwise" -} - -layer { - bottom: "res3a" - top: "res3a" - name: "res3a_relu" - type: "ReLU" -} - -layer { - bottom: "res3a" - top: "res3b_branch2a" - name: "res3b_branch2a" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3b_branch2a" - top: "res3b_branch2a" - name: "bn3b_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3b_branch2a" - top: "res3b_branch2a" - name: "scale3b_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3b_branch2a" - top: "res3b_branch2a" - name: "res3b_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res3b_branch2a" - top: "res3b_branch2b" - name: "res3b_branch2b" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3b_branch2b" - top: "res3b_branch2b" - name: "bn3b_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3b_branch2b" - top: "res3b_branch2b" - name: "scale3b_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3b_branch2b" - top: "res3b_branch2b" - name: "res3b_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res3b_branch2b" - top: "res3b_branch2c" - name: "res3b_branch2c" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3b_branch2c" - top: "res3b_branch2c" - name: "bn3b_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3b_branch2c" - top: "res3b_branch2c" - name: "scale3b_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3a" - bottom: "res3b_branch2c" - top: "res3b" - name: "res3b" - type: "Eltwise" -} - -layer { - bottom: "res3b" - top: "res3b" - name: "res3b_relu" - type: "ReLU" -} - -layer { - bottom: "res3b" - top: "res3c_branch2a" - name: "res3c_branch2a" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3c_branch2a" - top: "res3c_branch2a" - name: "bn3c_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3c_branch2a" - top: "res3c_branch2a" - name: "scale3c_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3c_branch2a" - top: "res3c_branch2a" - name: "res3c_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res3c_branch2a" - top: "res3c_branch2b" - name: "res3c_branch2b" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3c_branch2b" - top: "res3c_branch2b" - name: "bn3c_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3c_branch2b" - top: "res3c_branch2b" - name: "scale3c_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3c_branch2b" - top: "res3c_branch2b" - name: "res3c_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res3c_branch2b" - top: "res3c_branch2c" - name: "res3c_branch2c" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3c_branch2c" - top: "res3c_branch2c" - name: "bn3c_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3c_branch2c" - top: "res3c_branch2c" - name: "scale3c_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3b" - bottom: "res3c_branch2c" - top: "res3c" - name: "res3c" - type: "Eltwise" -} - -layer { - bottom: "res3c" - top: "res3c" - name: "res3c_relu" - type: "ReLU" -} - -layer { - bottom: "res3c" - top: "res3d_branch2a" - name: "res3d_branch2a" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3d_branch2a" - top: "res3d_branch2a" - name: "bn3d_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3d_branch2a" - top: "res3d_branch2a" - name: "scale3d_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3d_branch2a" - top: "res3d_branch2a" - name: "res3d_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res3d_branch2a" - top: "res3d_branch2b" - name: "res3d_branch2b" - type: "Convolution" - convolution_param { - num_output: 128 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3d_branch2b" - top: "res3d_branch2b" - name: "bn3d_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3d_branch2b" - top: "res3d_branch2b" - name: "scale3d_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3d_branch2b" - top: "res3d_branch2b" - name: "res3d_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res3d_branch2b" - top: "res3d_branch2c" - name: "res3d_branch2c" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res3d_branch2c" - top: "res3d_branch2c" - name: "bn3d_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res3d_branch2c" - top: "res3d_branch2c" - name: "scale3d_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3c" - bottom: "res3d_branch2c" - top: "res3d" - name: "res3d" - type: "Eltwise" -} - -layer { - bottom: "res3d" - top: "res3d" - name: "res3d_relu" - type: "ReLU" -} - -layer { - bottom: "res3d" - top: "res4a_branch1" - name: "res4a_branch1" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res4a_branch1" - top: "res4a_branch1" - name: "bn4a_branch1" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4a_branch1" - top: "res4a_branch1" - name: "scale4a_branch1" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res3d" - top: "res4a_branch2a" - name: "res4a_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res4a_branch2a" - top: "res4a_branch2a" - name: "bn4a_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4a_branch2a" - top: "res4a_branch2a" - name: "scale4a_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4a_branch2a" - top: "res4a_branch2a" - name: "res4a_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4a_branch2a" - top: "res4a_branch2b" - name: "res4a_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4a_branch2b" - top: "res4a_branch2b" - name: "bn4a_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4a_branch2b" - top: "res4a_branch2b" - name: "scale4a_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4a_branch2b" - top: "res4a_branch2b" - name: "res4a_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4a_branch2b" - top: "res4a_branch2c" - name: "res4a_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4a_branch2c" - top: "res4a_branch2c" - name: "bn4a_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4a_branch2c" - top: "res4a_branch2c" - name: "scale4a_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4a_branch1" - bottom: "res4a_branch2c" - top: "res4a" - name: "res4a" - type: "Eltwise" -} - -layer { - bottom: "res4a" - top: "res4a" - name: "res4a_relu" - type: "ReLU" -} - -layer { - bottom: "res4a" - top: "res4b_branch2a" - name: "res4b_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4b_branch2a" - top: "res4b_branch2a" - name: "bn4b_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4b_branch2a" - top: "res4b_branch2a" - name: "scale4b_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4b_branch2a" - top: "res4b_branch2a" - name: "res4b_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4b_branch2a" - top: "res4b_branch2b" - name: "res4b_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4b_branch2b" - top: "res4b_branch2b" - name: "bn4b_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4b_branch2b" - top: "res4b_branch2b" - name: "scale4b_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4b_branch2b" - top: "res4b_branch2b" - name: "res4b_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4b_branch2b" - top: "res4b_branch2c" - name: "res4b_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4b_branch2c" - top: "res4b_branch2c" - name: "bn4b_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4b_branch2c" - top: "res4b_branch2c" - name: "scale4b_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4a" - bottom: "res4b_branch2c" - top: "res4b" - name: "res4b" - type: "Eltwise" -} - -layer { - bottom: "res4b" - top: "res4b" - name: "res4b_relu" - type: "ReLU" -} - -layer { - bottom: "res4b" - top: "res4c_branch2a" - name: "res4c_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4c_branch2a" - top: "res4c_branch2a" - name: "bn4c_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4c_branch2a" - top: "res4c_branch2a" - name: "scale4c_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4c_branch2a" - top: "res4c_branch2a" - name: "res4c_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4c_branch2a" - top: "res4c_branch2b" - name: "res4c_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4c_branch2b" - top: "res4c_branch2b" - name: "bn4c_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4c_branch2b" - top: "res4c_branch2b" - name: "scale4c_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4c_branch2b" - top: "res4c_branch2b" - name: "res4c_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4c_branch2b" - top: "res4c_branch2c" - name: "res4c_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4c_branch2c" - top: "res4c_branch2c" - name: "bn4c_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4c_branch2c" - top: "res4c_branch2c" - name: "scale4c_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4b" - bottom: "res4c_branch2c" - top: "res4c" - name: "res4c" - type: "Eltwise" -} - -layer { - bottom: "res4c" - top: "res4c" - name: "res4c_relu" - type: "ReLU" -} - -layer { - bottom: "res4c" - top: "res4d_branch2a" - name: "res4d_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4d_branch2a" - top: "res4d_branch2a" - name: "bn4d_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4d_branch2a" - top: "res4d_branch2a" - name: "scale4d_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4d_branch2a" - top: "res4d_branch2a" - name: "res4d_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4d_branch2a" - top: "res4d_branch2b" - name: "res4d_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4d_branch2b" - top: "res4d_branch2b" - name: "bn4d_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4d_branch2b" - top: "res4d_branch2b" - name: "scale4d_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4d_branch2b" - top: "res4d_branch2b" - name: "res4d_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4d_branch2b" - top: "res4d_branch2c" - name: "res4d_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4d_branch2c" - top: "res4d_branch2c" - name: "bn4d_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4d_branch2c" - top: "res4d_branch2c" - name: "scale4d_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4c" - bottom: "res4d_branch2c" - top: "res4d" - name: "res4d" - type: "Eltwise" -} - -layer { - bottom: "res4d" - top: "res4d" - name: "res4d_relu" - type: "ReLU" -} - -layer { - bottom: "res4d" - top: "res4e_branch2a" - name: "res4e_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4e_branch2a" - top: "res4e_branch2a" - name: "bn4e_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4e_branch2a" - top: "res4e_branch2a" - name: "scale4e_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4e_branch2a" - top: "res4e_branch2a" - name: "res4e_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4e_branch2a" - top: "res4e_branch2b" - name: "res4e_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4e_branch2b" - top: "res4e_branch2b" - name: "bn4e_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4e_branch2b" - top: "res4e_branch2b" - name: "scale4e_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4e_branch2b" - top: "res4e_branch2b" - name: "res4e_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4e_branch2b" - top: "res4e_branch2c" - name: "res4e_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4e_branch2c" - top: "res4e_branch2c" - name: "bn4e_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4e_branch2c" - top: "res4e_branch2c" - name: "scale4e_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4d" - bottom: "res4e_branch2c" - top: "res4e" - name: "res4e" - type: "Eltwise" -} - -layer { - bottom: "res4e" - top: "res4e" - name: "res4e_relu" - type: "ReLU" -} - -layer { - bottom: "res4e" - top: "res4f_branch2a" - name: "res4f_branch2a" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4f_branch2a" - top: "res4f_branch2a" - name: "bn4f_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4f_branch2a" - top: "res4f_branch2a" - name: "scale4f_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4f_branch2a" - top: "res4f_branch2a" - name: "res4f_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res4f_branch2a" - top: "res4f_branch2b" - name: "res4f_branch2b" - type: "Convolution" - convolution_param { - num_output: 256 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4f_branch2b" - top: "res4f_branch2b" - name: "bn4f_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4f_branch2b" - top: "res4f_branch2b" - name: "scale4f_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4f_branch2b" - top: "res4f_branch2b" - name: "res4f_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res4f_branch2b" - top: "res4f_branch2c" - name: "res4f_branch2c" - type: "Convolution" - convolution_param { - num_output: 1024 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res4f_branch2c" - top: "res4f_branch2c" - name: "bn4f_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res4f_branch2c" - top: "res4f_branch2c" - name: "scale4f_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4e" - bottom: "res4f_branch2c" - top: "res4f" - name: "res4f" - type: "Eltwise" -} - -layer { - bottom: "res4f" - top: "res4f" - name: "res4f_relu" - type: "ReLU" -} - -layer { - bottom: "res4f" - top: "res5a_branch1" - name: "res5a_branch1" - type: "Convolution" - convolution_param { - num_output: 2048 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res5a_branch1" - top: "res5a_branch1" - name: "bn5a_branch1" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5a_branch1" - top: "res5a_branch1" - name: "scale5a_branch1" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res4f" - top: "res5a_branch2a" - name: "res5a_branch2a" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 2 - bias_term: false - } -} - -layer { - bottom: "res5a_branch2a" - top: "res5a_branch2a" - name: "bn5a_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5a_branch2a" - top: "res5a_branch2a" - name: "scale5a_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5a_branch2a" - top: "res5a_branch2a" - name: "res5a_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res5a_branch2a" - top: "res5a_branch2b" - name: "res5a_branch2b" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5a_branch2b" - top: "res5a_branch2b" - name: "bn5a_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5a_branch2b" - top: "res5a_branch2b" - name: "scale5a_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5a_branch2b" - top: "res5a_branch2b" - name: "res5a_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res5a_branch2b" - top: "res5a_branch2c" - name: "res5a_branch2c" - type: "Convolution" - convolution_param { - num_output: 2048 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5a_branch2c" - top: "res5a_branch2c" - name: "bn5a_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5a_branch2c" - top: "res5a_branch2c" - name: "scale5a_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5a_branch1" - bottom: "res5a_branch2c" - top: "res5a" - name: "res5a" - type: "Eltwise" -} - -layer { - bottom: "res5a" - top: "res5a" - name: "res5a_relu" - type: "ReLU" -} - -layer { - bottom: "res5a" - top: "res5b_branch2a" - name: "res5b_branch2a" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5b_branch2a" - top: "res5b_branch2a" - name: "bn5b_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5b_branch2a" - top: "res5b_branch2a" - name: "scale5b_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5b_branch2a" - top: "res5b_branch2a" - name: "res5b_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res5b_branch2a" - top: "res5b_branch2b" - name: "res5b_branch2b" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5b_branch2b" - top: "res5b_branch2b" - name: "bn5b_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5b_branch2b" - top: "res5b_branch2b" - name: "scale5b_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5b_branch2b" - top: "res5b_branch2b" - name: "res5b_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res5b_branch2b" - top: "res5b_branch2c" - name: "res5b_branch2c" - type: "Convolution" - convolution_param { - num_output: 2048 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5b_branch2c" - top: "res5b_branch2c" - name: "bn5b_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5b_branch2c" - top: "res5b_branch2c" - name: "scale5b_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5a" - bottom: "res5b_branch2c" - top: "res5b" - name: "res5b" - type: "Eltwise" -} - -layer { - bottom: "res5b" - top: "res5b" - name: "res5b_relu" - type: "ReLU" -} - -layer { - bottom: "res5b" - top: "res5c_branch2a" - name: "res5c_branch2a" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5c_branch2a" - top: "res5c_branch2a" - name: "bn5c_branch2a" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5c_branch2a" - top: "res5c_branch2a" - name: "scale5c_branch2a" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5c_branch2a" - top: "res5c_branch2a" - name: "res5c_branch2a_relu" - type: "ReLU" -} - -layer { - bottom: "res5c_branch2a" - top: "res5c_branch2b" - name: "res5c_branch2b" - type: "Convolution" - convolution_param { - num_output: 512 - kernel_size: 3 - pad: 1 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5c_branch2b" - top: "res5c_branch2b" - name: "bn5c_branch2b" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5c_branch2b" - top: "res5c_branch2b" - name: "scale5c_branch2b" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5c_branch2b" - top: "res5c_branch2b" - name: "res5c_branch2b_relu" - type: "ReLU" -} - -layer { - bottom: "res5c_branch2b" - top: "res5c_branch2c" - name: "res5c_branch2c" - type: "Convolution" - convolution_param { - num_output: 2048 - kernel_size: 1 - pad: 0 - stride: 1 - bias_term: false - } -} - -layer { - bottom: "res5c_branch2c" - top: "res5c_branch2c" - name: "bn5c_branch2c" - type: "BatchNorm" - batch_norm_param { - use_global_stats: true - } -} - -layer { - bottom: "res5c_branch2c" - top: "res5c_branch2c" - name: "scale5c_branch2c" - type: "Scale" - scale_param { - bias_term: true - } -} - -layer { - bottom: "res5b" - bottom: "res5c_branch2c" - top: "res5c" - name: "res5c" - type: "Eltwise" -} - -layer { - bottom: "res5c" - top: "res5c" - name: "res5c_relu" - type: "ReLU" -} - -layer { - bottom: "res5c" - top: "pool5" - name: "pool5" - type: "Pooling" - pooling_param { - kernel_size: 7 - stride: 1 - pool: AVE - } -} - -layer { - bottom: "pool5" - top: "fc1000" - name: "fc1000" - type: "InnerProduct" - inner_product_param { - num_output: 1000 - } -} - -layer { - bottom: "fc1000" - top: "prob" - name: "prob" - type: "Softmax" -} - diff --git a/tests/st/testcase/origin_models/ResNet-50-model.caffemodel b/tests/st/testcase/origin_models/ResNet-50-model.caffemodel deleted file mode 100755 index de274ef..0000000 Binary files a/tests/st/testcase/origin_models/ResNet-50-model.caffemodel and /dev/null differ diff --git a/tests/st/testcase/origin_models/custom.proto b/tests/st/testcase/origin_models/custom.proto new file mode 100755 index 0000000..834724a --- /dev/null +++ b/tests/st/testcase/origin_models/custom.proto @@ -0,0 +1,18 @@ +syntax = "proto2"; +package domi::caffe; + +message FillerParameter { + optional string type = 1 [default = 'constant']; + optional float value = 2 [default = 0]; + optional float min = 3 [default = 0]; + optional float max = 4 [default = 1]; + optional float mean = 5 [default = 0]; + optional float std = 6 [default = 1]; + optional int32 sparse = 7 [default = 1]; + enum VarianceNorm { + FAN_IN = 0; + FAN_OUT = 1; + AVERAGE = 2; + } + optional VarianceNorm variance_norm = 8 [default = FAN_IN]; +} \ No newline at end of file diff --git a/tests/st/testcase/test_caffe_parser.cc b/tests/st/testcase/test_caffe_parser.cc index f2c706a..4e37ffe 100644 --- a/tests/st/testcase/test_caffe_parser.cc +++ b/tests/st/testcase/test_caffe_parser.cc @@ -39,6 +39,12 @@ #undef protected #undef private +#include +#include +#include +#include +#include + using namespace domi::caffe; using namespace ge; @@ -68,6 +74,92 @@ static ge::NodePtr GenNodeFromOpDesc(ge::OpDescPtr opDesc){ return g->AddNode(std::move(opDesc)); } + ge::ComputeGraphPtr build_graph(bool with_leaf_node = false) + { + ge::ComputeGraphPtr graph = std::make_shared("default"); + ge::OpDescPtr data_op = std::make_shared(); + data_op->SetType(parser::DATA); + data_op->SetName("Data1"); + data_op->AddInputDesc(ge::GeTensorDesc()); + data_op->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr data1 = graph->AddNode(data_op); + + ge::OpDescPtr relu_op1 = std::make_shared(); + relu_op1->SetType(parser::ACTIVATION); + relu_op1->SetName("Relu1"); + relu_op1->AddInputDesc(ge::GeTensorDesc()); + relu_op1->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr relu1 = graph->AddNode(relu_op1); + + ge::OpDescPtr relu_op2 = std::make_shared(); + relu_op2->SetType(parser::RELU); + relu_op2->SetName("Relu2"); + relu_op2->AddInputDesc(ge::GeTensorDesc()); + relu_op2->AddOutputDesc(ge::GeTensorDesc()); + relu_op2->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr relu2 = graph->AddNode(relu_op2); + + ge::OpDescPtr relu_op3 = std::make_shared(); + relu_op3->SetType(parser::ACTIVATION); + relu_op3->SetName("Relu3"); + relu_op3->AddInputDesc(ge::GeTensorDesc()); + relu_op3->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr relu3; + if (with_leaf_node == true) { + relu3 = graph->AddNode(relu_op3); + } + + ge::OpDescPtr mul_op = std::make_shared(); + mul_op->SetType(parser::MUL); + mul_op->SetName("Mul"); + mul_op->AddInputDesc(ge::GeTensorDesc()); + mul_op->AddInputDesc(ge::GeTensorDesc()); + mul_op->AddOutputDesc(ge::GeTensorDesc()); + mul_op->AddOutputDesc(ge::GeTensorDesc()); + mul_op->AddOutputDesc(ge::GeTensorDesc()); + mul_op->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr mul = graph->AddNode(mul_op); + + ge::OpDescPtr mul_op1 = std::make_shared(); + mul_op1->SetType(parser::MUL); + mul_op1->SetName("Mul1"); + mul_op1->AddInputDesc(ge::GeTensorDesc()); + mul_op1->AddInputDesc(ge::GeTensorDesc()); + mul_op1->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr mul1 = graph->AddNode(mul_op1); + + ge::OpDescPtr mul_op2 = std::make_shared(); + mul_op2->SetType(parser::MUL); + mul_op2->SetName("Mul2"); + mul_op2->AddInputDesc(ge::GeTensorDesc()); + mul_op2->AddInputDesc(ge::GeTensorDesc()); + mul_op2->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr mul2 = graph->AddNode(mul_op2); + + ge::OpDescPtr fc_op = std::make_shared(); + fc_op->SetType(parser::FULL_CONNECTION); + fc_op->SetName("FullConnection"); + fc_op->AddInputDesc(ge::GeTensorDesc()); + fc_op->AddOutputDesc(ge::GeTensorDesc()); + fc_op->AddOutputDesc(ge::GeTensorDesc()); + ge::NodePtr fc = graph->AddNode(fc_op); + + ge::GraphUtils::AddEdge(data1->GetOutDataAnchor(0), relu1->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(relu1->GetOutDataAnchor(0), fc->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(fc->GetOutDataAnchor(0), relu2->GetInDataAnchor(0)); + if (with_leaf_node == true) { + ge::GraphUtils::AddEdge(fc->GetOutDataAnchor(1), relu3->GetInDataAnchor(0)); + } + ge::GraphUtils::AddEdge(relu2->GetOutDataAnchor(0), mul->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(relu2->GetOutDataAnchor(1), mul->GetInDataAnchor(1)); + ge::GraphUtils::AddEdge(mul->GetOutDataAnchor(0), mul1->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(mul->GetOutDataAnchor(1), mul1->GetInDataAnchor(1)); + ge::GraphUtils::AddEdge(mul->GetOutDataAnchor(2), mul2->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(mul->GetOutDataAnchor(3), mul2->GetInDataAnchor(1)); + + return graph; + } + void STestCaffeParser::RegisterCustomOp() { REGISTER_CUSTOM_OP("Data") .FrameworkType(domi::CAFFE) @@ -270,7 +362,7 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_Parse_test) CaffeWeightsParser weightParser; std::string case_dir = __FILE__; case_dir = case_dir.substr(0, case_dir.find_last_of("/")); - std::string model_file = case_dir + "/origin_models/ResNet-50-model.caffemodel"; + std::string model_file = case_dir + "/origin_models/caffe_add.caffemodel"; const char *file = nullptr; ge::ComputeGraphPtr graph; Status ret = weightParser.Parse(file, graph); @@ -283,6 +375,20 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_Parse_test) graph = std::make_shared("test"); ret = weightParser.Parse(file, graph); EXPECT_EQ(ret, FAILED); + + std::string caffe_proto = case_dir + "/../../../../metadef/proto/caffe/"; + std::string custom_proto = case_dir + "/origin_models/"; + ge::GetParserContext().caffe_proto_path.assign(caffe_proto); + ge::GetParserContext().custom_proto_path.assign(custom_proto); + ret = weightParser.Parse(file, graph); + EXPECT_EQ(ret, FAILED); + + custom_proto = case_dir + "/origin_model/"; + caffe_proto = case_dir + "/../../../metadef/proto/caffe/"; + ge::GetParserContext().caffe_proto_path.assign(caffe_proto); + ge::GetParserContext().custom_proto_path.assign(custom_proto); + ret = weightParser.Parse(file, graph); + EXPECT_EQ(ret, SUCCESS); } TEST_F(STestCaffeParser, CaffeWeightsParser_ParseWeightByFusionProto_test) @@ -290,7 +396,7 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_ParseWeightByFusionProto_test) CaffeWeightsParser weightParser; std::string case_dir = __FILE__; case_dir = case_dir.substr(0, case_dir.find_last_of("/")); - std::string weight_file = case_dir + "/origin_models/ResNet-50-model.caffemodel"; + std::string weight_file = case_dir + "/origin_models/caffe_add.caffemodel"; std::string model_file = case_dir + "/origin_models/caffe.proto"; const char *weight_path = model_file.c_str(); std::string fusion_proto_path = model_file; @@ -305,7 +411,7 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_ParseFromMemory_test) CaffeWeightsParser weightParser; std::string case_dir = __FILE__; case_dir = case_dir.substr(0, case_dir.find_last_of("/")); - std::string weight_file = case_dir + "/origin_models/ResNet-50-model.caffemodel"; + std::string weight_file = case_dir + "/origin_models/caffe_add.caffemodel"; ge::ComputeGraphPtr graph; const char *data = nullptr; Status ret = weightParser.ParseFromMemory(data, 1, graph); @@ -546,7 +652,7 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_ParseGraph_test) std::string case_dir = __FILE__; case_dir = case_dir.substr(0, case_dir.find_last_of("/")); - std::string weight_file = case_dir + "/origin_models/ResNet-50-model.caffemodel"; + std::string weight_file = case_dir + "/origin_models/caffe_add.caffemodel"; const char *file = weight_file.c_str(); Status ret = weightParser.Parse(file, graph); @@ -639,4 +745,48 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_CheckLayersSize_test) EXPECT_EQ(ret, FAILED); } +TEST_F(STestCaffeParser, CaffeModelParser_FindShareParamLayers_test) +{ + CaffeModelParser modelParser; + std::map> layer_params_map; + std::vector layer_params; + layer_params.emplace_back("Conv"); + layer_params.emplace_back("Data"); + layer_params.emplace_back("Abs"); + layer_params_map.insert(std::make_pair("Abs", layer_params)); + layer_params_map.insert(std::make_pair("Data", layer_params)); + layer_params_map.insert(std::make_pair("Conv", layer_params)); + + Status ret = modelParser.FindShareParamLayers(layer_params_map); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(STestCaffeParser, CaffeWeightsParser_ParseLayerParameter_test) +{ + CaffeWeightsParser weightParser; + + domi::caffe::NetParameter net; + GetParserContext().type = domi::CAFFE; + domi::caffe::LayerParameter *layer = net.add_layer(); + layer->set_name("Abs"); + layer->set_type("AbsVal"); + + ge::ComputeGraphPtr compute_graph = build_graph(true); + std::string case_dir = __FILE__; + case_dir = case_dir.substr(0, case_dir.find_last_of("/")); + std::string caffe_proto = case_dir + "/../../../metadef/proto/caffe/"; + google::protobuf::compiler::DiskSourceTree sourceTree; + sourceTree.MapPath("project_root", caffe_proto); + google::protobuf::compiler::Importer importer(&sourceTree, nullptr); + importer.Import("project_root/caffe.proto"); + + auto descriptor = importer.pool()->FindMessageTypeByName("domi.caffe.LayerParameter"); + google::protobuf::DynamicMessageFactory factory; + const google::protobuf::Message *proto = factory.GetPrototype(descriptor); + const google::protobuf::Message *message = proto->New(); + + Status ret = weightParser.ParseLayerParameter(descriptor, message, compute_graph); + delete message; + EXPECT_EQ(ret, SUCCESS); +} } // namespace ge