From 93c908c8cc0677e1dce3cfce2c9e855f7443353f Mon Sep 17 00:00:00 2001 From: wuyefeilin <30919197+wuyefeilin@users.noreply.github.com> Date: Mon, 28 Sep 2020 12:09:12 +0800 Subject: [PATCH] fix some (#418) * update hrnet yaml * add benchmark yaml * update deeplabv3p.yml * delete utf-8 decalre * update val.py * update deeplabv3p.yml --- dygraph/benchmark/deeplabv3p.yml | 1 + dygraph/paddleseg/core/val.py | 4 ++-- dygraph/paddleseg/cvlibs/callbacks.py | 1 - dygraph/paddleseg/cvlibs/manager.py | 1 - dygraph/paddleseg/env.py | 1 - dygraph/paddleseg/models/common/__init__.py | 3 +-- dygraph/paddleseg/models/common/activation.py | 7 +++---- dygraph/paddleseg/models/common/layer_libs.py | 1 - dygraph/paddleseg/models/common/pyramid_pool.py | 3 +-- 9 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dygraph/benchmark/deeplabv3p.yml b/dygraph/benchmark/deeplabv3p.yml index a299bee3..bf9db712 100644 --- a/dygraph/benchmark/deeplabv3p.yml +++ b/dygraph/benchmark/deeplabv3p.yml @@ -28,6 +28,7 @@ model: backbone: type: ResNet50_vd output_stride: 8 + multi_grid: [1, 2, 4] num_classes: 19 backbone_indices: [0, 3] aspp_ratios: [1, 12, 24, 36] diff --git a/dygraph/paddleseg/core/val.py b/dygraph/paddleseg/core/val.py index 936b2576..ebc6e669 100644 --- a/dygraph/paddleseg/core/val.py +++ b/dygraph/paddleseg/core/val.py @@ -19,7 +19,7 @@ import tqdm import cv2 import paddle import paddle.nn.functional as F -from paddle import to_variable +from paddle import to_tensor import paddleseg.utils.logger as logger from paddleseg.utils import ConfusionMatrix @@ -47,7 +47,7 @@ def evaluate(model, timer.start() for iter, (im, im_info, label) in tqdm.tqdm( enumerate(eval_dataset), total=total_iters): - im = to_variable(im) + im = to_tensor(im) logits = model(im) pred = paddle.argmax(logits[0], axis=1) pred = pred.numpy().astype('float32') diff --git a/dygraph/paddleseg/cvlibs/callbacks.py b/dygraph/paddleseg/cvlibs/callbacks.py index e948344a..13b6c1a1 100644 --- a/dygraph/paddleseg/cvlibs/callbacks.py +++ b/dygraph/paddleseg/cvlibs/callbacks.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/dygraph/paddleseg/cvlibs/manager.py b/dygraph/paddleseg/cvlibs/manager.py index 33907006..e6aace64 100644 --- a/dygraph/paddleseg/cvlibs/manager.py +++ b/dygraph/paddleseg/cvlibs/manager.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/dygraph/paddleseg/env.py b/dygraph/paddleseg/env.py index 3bb0930a..43f88150 100644 --- a/dygraph/paddleseg/env.py +++ b/dygraph/paddleseg/env.py @@ -1,4 +1,3 @@ -# coding:utf-8 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License" diff --git a/dygraph/paddleseg/models/common/__init__.py b/dygraph/paddleseg/models/common/__init__.py index 33b2611d..3024f08b 100644 --- a/dygraph/paddleseg/models/common/__init__.py +++ b/dygraph/paddleseg/models/common/__init__.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,4 +14,4 @@ from . import layer_libs from . import activation -from . import pyramid_pool \ No newline at end of file +from . import pyramid_pool diff --git a/dygraph/paddleseg/models/common/activation.py b/dygraph/paddleseg/models/common/activation.py index 69af72e0..f565fb07 100644 --- a/dygraph/paddleseg/models/common/activation.py +++ b/dygraph/paddleseg/models/common/activation.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,8 +27,8 @@ class Activation(nn.Layer): >>> print(sigmoid) >>> not_exit_one = Activation("not_exit_one") - KeyError: "not_exit_one does not exist in the current dict_keys(['elu', 'gelu', 'hardshrink', - 'tanh', 'hardtanh', 'prelu', 'relu', 'relu6', 'selu', 'leakyrelu', 'sigmoid', 'softmax', + KeyError: "not_exit_one does not exist in the current dict_keys(['elu', 'gelu', 'hardshrink', + 'tanh', 'hardtanh', 'prelu', 'relu', 'relu6', 'selu', 'leakyrelu', 'sigmoid', 'softmax', 'softplus', 'softshrink', 'softsign', 'tanhshrink', 'logsigmoid', 'logsoftmax', 'hsigmoid'])" Args: @@ -57,4 +56,4 @@ class Activation(nn.Layer): if self._act is not None: return self.act_func(x) else: - return x \ No newline at end of file + return x diff --git a/dygraph/paddleseg/models/common/layer_libs.py b/dygraph/paddleseg/models/common/layer_libs.py index 0335cfac..d032a59c 100644 --- a/dygraph/paddleseg/models/common/layer_libs.py +++ b/dygraph/paddleseg/models/common/layer_libs.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/dygraph/paddleseg/models/common/pyramid_pool.py b/dygraph/paddleseg/models/common/pyramid_pool.py index d1c64338..07f73d5c 100644 --- a/dygraph/paddleseg/models/common/pyramid_pool.py +++ b/dygraph/paddleseg/models/common/pyramid_pool.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -87,7 +86,7 @@ class ASPPModule(nn.Layer): img_avg = self.global_avg_pool(x) img_avg = F.resize_bilinear(img_avg, out_shape=x.shape[2:]) outputs.append(img_avg) - + x = paddle.concat(outputs, axis=1) x = self.conv_bn_relu(x) x = self.dropout(x) -- GitLab