From 596947758fb02f49a151ef02d8beebd3121ee9e3 Mon Sep 17 00:00:00 2001 From: weishengyu Date: Tue, 15 Dec 2020 15:52:23 +0800 Subject: [PATCH] add headers and remove useless import --- tools/style_text_rec/arch/base_module.py | 2 +- tools/style_text_rec/arch/decoder.py | 1 + tools/style_text_rec/arch/encoder.py | 1 + tools/style_text_rec/arch/spectral_norm.py | 4 ---- tools/style_text_rec/arch/style_text_rec.py | 3 --- tools/style_text_rec/engine/corpus_generators.py | 16 ++++++++++++++-- tools/style_text_rec/engine/synthesisers.py | 13 +++++++++++++ tools/style_text_rec/engine/text_drawers.py | 1 - tools/style_text_rec/tools/synth_dataset.py | 13 +++++++++++++ tools/style_text_rec/utils/config.py | 1 - tools/style_text_rec/utils/load_params.py | 6 ------ tools/style_text_rec/utils/logging.py | 1 - 12 files changed, 43 insertions(+), 19 deletions(-) diff --git a/tools/style_text_rec/arch/base_module.py b/tools/style_text_rec/arch/base_module.py index ea203f82..da2b6b83 100644 --- a/tools/style_text_rec/arch/base_module.py +++ b/tools/style_text_rec/arch/base_module.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import functools import paddle import paddle.nn as nn + from arch.spectral_norm import spectral_norm diff --git a/tools/style_text_rec/arch/decoder.py b/tools/style_text_rec/arch/decoder.py index fe8c599c..36f07c59 100644 --- a/tools/style_text_rec/arch/decoder.py +++ b/tools/style_text_rec/arch/decoder.py @@ -13,6 +13,7 @@ # limitations under the License. import paddle import paddle.nn as nn + from arch.base_module import SNConv, SNConvTranspose, ResBlock diff --git a/tools/style_text_rec/arch/encoder.py b/tools/style_text_rec/arch/encoder.py index a304fcae..b884cda2 100644 --- a/tools/style_text_rec/arch/encoder.py +++ b/tools/style_text_rec/arch/encoder.py @@ -13,6 +13,7 @@ # limitations under the License. import paddle import paddle.nn as nn + from arch.base_module import SNConv, SNConvTranspose, ResBlock diff --git a/tools/style_text_rec/arch/spectral_norm.py b/tools/style_text_rec/arch/spectral_norm.py index 349043ca..21d0afc8 100644 --- a/tools/style_text_rec/arch/spectral_norm.py +++ b/tools/style_text_rec/arch/spectral_norm.py @@ -11,10 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -import math -import numpy as np - import paddle import paddle.nn as nn import paddle.nn.functional as F diff --git a/tools/style_text_rec/arch/style_text_rec.py b/tools/style_text_rec/arch/style_text_rec.py index 0686045d..599927ce 100644 --- a/tools/style_text_rec/arch/style_text_rec.py +++ b/tools/style_text_rec/arch/style_text_rec.py @@ -11,9 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np -import cv2 -import math import paddle import paddle.nn as nn diff --git a/tools/style_text_rec/engine/corpus_generators.py b/tools/style_text_rec/engine/corpus_generators.py index 9f5758a5..186d15f3 100644 --- a/tools/style_text_rec/engine/corpus_generators.py +++ b/tools/style_text_rec/engine/corpus_generators.py @@ -1,6 +1,18 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import random -from PIL import Image, ImageDraw, ImageFont -import numpy as np + from utils.logging import get_logger diff --git a/tools/style_text_rec/engine/synthesisers.py b/tools/style_text_rec/engine/synthesisers.py index 4ef2d1c4..177e3e04 100644 --- a/tools/style_text_rec/engine/synthesisers.py +++ b/tools/style_text_rec/engine/synthesisers.py @@ -1,3 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os from utils.config import ArgsParser, load_config, override_config diff --git a/tools/style_text_rec/engine/text_drawers.py b/tools/style_text_rec/engine/text_drawers.py index c44c840c..8aaac06e 100644 --- a/tools/style_text_rec/engine/text_drawers.py +++ b/tools/style_text_rec/engine/text_drawers.py @@ -1,4 +1,3 @@ -import random from PIL import Image, ImageDraw, ImageFont import numpy as np from utils.logging import get_logger diff --git a/tools/style_text_rec/tools/synth_dataset.py b/tools/style_text_rec/tools/synth_dataset.py index 54f366a8..4a0e6d5e 100644 --- a/tools/style_text_rec/tools/synth_dataset.py +++ b/tools/style_text_rec/tools/synth_dataset.py @@ -1,3 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. from engine.synthesisers import DatasetSynthesiser diff --git a/tools/style_text_rec/utils/config.py b/tools/style_text_rec/utils/config.py index f11b7826..d028b7c4 100644 --- a/tools/style_text_rec/utils/config.py +++ b/tools/style_text_rec/utils/config.py @@ -13,7 +13,6 @@ # limitations under the License. import yaml import os -from collections import OrderedDict from argparse import ArgumentParser, RawDescriptionHelpFormatter diff --git a/tools/style_text_rec/utils/load_params.py b/tools/style_text_rec/utils/load_params.py index 943fd262..be056136 100644 --- a/tools/style_text_rec/utils/load_params.py +++ b/tools/style_text_rec/utils/load_params.py @@ -11,13 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - import os - import paddle __all__ = ['load_dygraph_pretrain'] diff --git a/tools/style_text_rec/utils/logging.py b/tools/style_text_rec/utils/logging.py index 295900e8..f700fe26 100644 --- a/tools/style_text_rec/utils/logging.py +++ b/tools/style_text_rec/utils/logging.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - import os import sys import logging