Repository: PaddlePaddle/models

Issue:
[PaddleSlim测试] distillation name conflicts error.
### 蒸馏任务执行失败

#### 对应提测报告章节：3.2节

#### 问题描述：
执行任务后报错，提示batch norm layer的input channel和Scale的shape不一致。

#### 原因：
1. MobileNetV1和ResNet50第一个卷积层的weight名称都被强制指定为了`conv1_weights`,导致命名冲突。
2. paddle/models/PaddleSlim/run.sh中下载的预训练模型，MobileNetV1和ResNet50的FC layer的parameter的名称都为fc_0.w_0和fc_0.b_0, 导致命名冲突。

#### 解决办法：
1. 修改PaddlePaddle/models/PaddleSlim/model/resnet.py, 将ResNet第一层conv层的名称修改为‘res_conv1’
2. 修改PaddlePaddle/models/PaddleSlim/run.sh, 下载pretrain model之后，将ResNet的`conv1_weights`重命名为`res_conv1_weights`. 将ResNet的`fc_0.w_0`和`fc_0.b_0`重命名为`fc_1.w_0`和`fc_1.b_0`

#### 错误类型：
models repo示例错误


Discussion:

Resolving patch:
diff --git a/PaddleSlim/compress.py b/PaddleSlim/compress.py
--- a/PaddleSlim/compress.py
+++ b/PaddleSlim/compress.py
@@ -69,14 +69,9 @@ def compress(args):
         momentum=0.9,
         learning_rate=fluid.layers.piecewise_decay(
             boundaries=[5000 * 30, 5000 * 60, 5000 * 90],
-            values=[0.01, 0.001, 0.0001, 0.00001]),
+            values=[0.1, 0.01, 0.001, 0.0001]),
         regularization=fluid.regularizer.L2Decay(4e-5))
 
-    #    opt = fluid.optimizer.Momentum(
-    #        momentum=0.9,
-    #        learning_rate=0.01,
-    #        regularization=fluid.regularizer.L2Decay(4e-5))
-
     place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace()
     exe = fluid.Executor(place)
     exe.run(fluid.default_startup_program())
@@ -107,7 +102,10 @@ def if_exist(var):
         with fluid.program_guard(teacher_program, startup_program):
             img = teacher_program.global_block()._clone_variable(
                 image, force_persistable=False)
-            predict = teacher_model.net(img, class_dim=args.class_dim)
+            predict = teacher_model.net(img,
+                                        class_dim=args.class_dim,
+                                        conv1_name='res_conv1',
+                                        fc_name='res_fc')
         exe.run(startup_program)
         assert args.teacher_pretrained_model and os.path.exists(
             args.teacher_pretrained_model
diff --git a/PaddleSlim/models/resnet.py b/PaddleSlim/models/resnet.py
--- a/PaddleSlim/models/resnet.py
+++ b/PaddleSlim/models/resnet.py
@@ -26,7 +26,7 @@ def __init__(self, layers=50):
         self.params = train_parameters
         self.layers = layers
 
-    def net(self, input, class_dim=1000):
+    def net(self, input, class_dim=1000, conv1_name='conv1', fc_name=None):
         layers = self.layers
         supported_layers = [50, 101, 152]
         assert layers in supported_layers, \
@@ -48,7 +48,7 @@ def net(self, input, class_dim=1000):
             filter_size=7,
             stride=2,
             act='relu',
-            name="conv1")
+            name=conv1_name)
         conv = fluid.layers.pool2d(
             input=conv,
             pool_size=3,
@@ -77,6 +77,7 @@ def net(self, input, class_dim=1000):
         out = fluid.layers.fc(input=pool,
                               size=class_dim,
                               act='softmax',
+                              name=fc_name,
                               param_attr=fluid.param_attr.ParamAttr(
                                   initializer=fluid.initializer.Uniform(-stdv,
                                                                         stdv)))


Test patch: