From a257552305a29bd251648b31b3abc888ec4e89d4 Mon Sep 17 00:00:00 2001 From: wuzewu Date: Tue, 28 Apr 2020 16:36:48 +0800 Subject: [PATCH] Update param name in detection task --- paddlehub/finetune/task/faster_rcnn_task.py | 18 ++++++++---------- paddlehub/finetune/task/yolo_task.py | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/paddlehub/finetune/task/faster_rcnn_task.py b/paddlehub/finetune/task/faster_rcnn_task.py index ea4eca50..2d4916cf 100644 --- a/paddlehub/finetune/task/faster_rcnn_task.py +++ b/paddlehub/finetune/task/faster_rcnn_task.py @@ -67,30 +67,28 @@ class FasterRCNNTask(DetectionTask): head_feat = self.main_program.global_block().vars[ self.predict_feature[0].name] - # Rename following layers for: ValueError: Variable cls_score_w has been created before. - # the previous shape is (2048, 81); the new shape is (100352, 81). - # They are not matched. cls_score = fluid.layers.fc( input=head_feat, size=self.num_classes, act=None, - name='my_cls_score', + name='paddlehub_rcnn_cls_score', param_attr=ParamAttr( - name='my_cls_score_w', initializer=Normal(loc=0.0, scale=0.01)), + name='paddlehub_rcnn_cls_score_weights', + initializer=Normal(loc=0.0, scale=0.01)), bias_attr=ParamAttr( - name='my_cls_score_b', + name='paddlehub_rcnn_cls_score_bias', learning_rate=2., regularizer=L2Decay(0.))) bbox_pred = fluid.layers.fc( input=head_feat, size=4 * self.num_classes, act=None, - name='my_bbox_pred', + name='paddlehub_rcnn_bbox_pred', param_attr=ParamAttr( - name='my_bbox_pred_w', initializer=Normal(loc=0.0, - scale=0.001)), + name='paddlehub_rcnn_bbox_pred_weights', + initializer=Normal(loc=0.0, scale=0.001)), bias_attr=ParamAttr( - name='my_bbox_pred_b', + name='paddlehub_rcnn_bbox_pred_bias', learning_rate=2., regularizer=L2Decay(0.))) diff --git a/paddlehub/finetune/task/yolo_task.py b/paddlehub/finetune/task/yolo_task.py index fd852422..07b499ba 100644 --- a/paddlehub/finetune/task/yolo_task.py +++ b/paddlehub/finetune/task/yolo_task.py @@ -90,10 +90,10 @@ class YOLOTask(DetectionTask): act=None, # Rename for: conflict with module pretrain weights param_attr=ParamAttr( - name="ft_yolo_output.{}.conv.weights".format(i)), + name="paddlehub_yolo_output.{}.conv.weights".format(i)), bias_attr=ParamAttr( regularizer=L2Decay(0.), - name="ft_yolo_output.{}.conv.bias".format(i))) + name="paddlehub_yolo_output.{}.conv.bias".format(i))) outputs.append(block_out) if self.is_train_phase: -- GitLab