From 55138a40a219975bcbbeb6c1edef5284de721f72 Mon Sep 17 00:00:00 2001 From: ruri Date: Wed, 19 Jun 2019 21:06:01 +0800 Subject: [PATCH] Add license and follow PEP 8 (#2452) --- .../dist_train/batch_merge.py | 14 ++++++++++ .../dist_train/dist_utils.py | 14 ++++++++++ .../image_classification/dist_train/env.py | 14 ++++++++++ PaddleCV/image_classification/eval.py | 26 +++++++++++++++---- .../fast_imagenet/datasets.py | 14 ++++++++++ .../fast_imagenet/reader.py | 19 ++++++++++++-- .../fast_imagenet/tools/resize.py | 18 ++++++++++++- .../fast_imagenet/train.py | 2 +- .../fast_imagenet/transforms.py | 17 ++++++++++++ PaddleCV/image_classification/infer.py | 24 ++++++++++++++--- .../image_classification/models/alexnet.py | 18 ++++++++++++- PaddleCV/image_classification/models/dpn.py | 18 ++++++++++++- .../image_classification/models/googlenet.py | 15 +++++++++++ .../models/inception_v4.py | 18 ++++++++++++- .../image_classification/models/mobilenet.py | 15 +++++++++++ .../image_classification/models/resnet.py | 18 ++++++++++++- .../models/resnet_dist.py | 21 +++++++++++++-- .../image_classification/models/resnet_vc.py | 17 +++++++++++- .../image_classification/models/resnet_vd.py | 18 ++++++++++++- .../image_classification/models/resnext.py | 18 ++++++++++++- .../image_classification/models/se_resnext.py | 18 ++++++++++++- .../models/se_resnext_vd.py | 17 +++++++++++- .../models/shufflenet_v2.py | 20 ++++++++++++++ PaddleCV/image_classification/models/vgg.py | 15 +++++++++++ PaddleCV/image_classification/reader.py | 17 +++++++++++- PaddleCV/image_classification/reader_cv2.py | 17 +++++++++++- PaddleCV/image_classification/train.py | 22 +++++++++++++--- .../image_classification/utils/fp16_utils.py | 15 +++++++++++ .../utils/learning_rate.py | 19 ++++++++++++-- .../image_classification/utils/utility.py | 3 +-- 30 files changed, 468 insertions(+), 33 deletions(-) diff --git a/PaddleCV/image_classification/dist_train/batch_merge.py b/PaddleCV/image_classification/dist_train/batch_merge.py index ee365de3..01bb9ab0 100644 --- a/PaddleCV/image_classification/dist_train/batch_merge.py +++ b/PaddleCV/image_classification/dist_train/batch_merge.py @@ -1,3 +1,17 @@ +#copyright (c) 2019 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 paddle.fluid as fluid import numpy as np diff --git a/PaddleCV/image_classification/dist_train/dist_utils.py b/PaddleCV/image_classification/dist_train/dist_utils.py index 823055e0..58355a66 100644 --- a/PaddleCV/image_classification/dist_train/dist_utils.py +++ b/PaddleCV/image_classification/dist_train/dist_utils.py @@ -1,3 +1,17 @@ +#copyright (c) 2019 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 import paddle.fluid as fluid diff --git a/PaddleCV/image_classification/dist_train/env.py b/PaddleCV/image_classification/dist_train/env.py index f85297e4..08db25bd 100644 --- a/PaddleCV/image_classification/dist_train/env.py +++ b/PaddleCV/image_classification/dist_train/env.py @@ -1,3 +1,17 @@ +#copyright (c) 2019 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 diff --git a/PaddleCV/image_classification/eval.py b/PaddleCV/image_classification/eval.py index 06b3e587..8db943bf 100644 --- a/PaddleCV/image_classification/eval.py +++ b/PaddleCV/image_classification/eval.py @@ -1,19 +1,35 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import os -import numpy as np import time import sys -import paddle -import paddle.fluid as fluid -import reader_cv2 as reader +import math +import numpy as np import argparse import functools + +import paddle +import paddle.fluid as fluid +import reader_cv2 as reader import models from utils.learning_rate import cosine_decay from utils.utility import add_arguments, print_arguments -import math parser = argparse.ArgumentParser(description=__doc__) add_arg = functools.partial(add_arguments, argparser=parser) diff --git a/PaddleCV/image_classification/fast_imagenet/datasets.py b/PaddleCV/image_classification/fast_imagenet/datasets.py index 866e58db..d8083ff1 100644 --- a/PaddleCV/image_classification/fast_imagenet/datasets.py +++ b/PaddleCV/image_classification/fast_imagenet/datasets.py @@ -1,3 +1,17 @@ +#copyright (c) 2019 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 PIL import Image import os diff --git a/PaddleCV/image_classification/fast_imagenet/reader.py b/PaddleCV/image_classification/fast_imagenet/reader.py index 9d277322..926bcc47 100644 --- a/PaddleCV/image_classification/fast_imagenet/reader.py +++ b/PaddleCV/image_classification/fast_imagenet/reader.py @@ -1,10 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division -import os +from __future__ import print_function +import os import numpy as np import math import random - import pickle from tqdm import tqdm import time diff --git a/PaddleCV/image_classification/fast_imagenet/tools/resize.py b/PaddleCV/image_classification/fast_imagenet/tools/resize.py index 0cb7fcde..7eab28c5 100644 --- a/PaddleCV/image_classification/fast_imagenet/tools/resize.py +++ b/PaddleCV/image_classification/fast_imagenet/tools/resize.py @@ -1,8 +1,24 @@ +#copyright (c) 2019 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 PIL import Image from pathlib import Path from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from functools import partial + import multiprocessing + cpus = multiprocessing.cpu_count() cpus = min(36,cpus) @@ -41,4 +57,4 @@ for sz in szs: for ds in ("validation", "train"): print(PATH/ds) - resize_imgs(PATH/ds) \ No newline at end of file + resize_imgs(PATH/ds) diff --git a/PaddleCV/image_classification/fast_imagenet/train.py b/PaddleCV/image_classification/fast_imagenet/train.py index 2479d65c..e7bdb465 100644 --- a/PaddleCV/image_classification/fast_imagenet/train.py +++ b/PaddleCV/image_classification/fast_imagenet/train.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/PaddleCV/image_classification/fast_imagenet/transforms.py b/PaddleCV/image_classification/fast_imagenet/transforms.py index ad9707ba..eb3effd3 100644 --- a/PaddleCV/image_classification/fast_imagenet/transforms.py +++ b/PaddleCV/image_classification/fast_imagenet/transforms.py @@ -1,4 +1,21 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division +from __future__ import print_function + import math import random from PIL import Image diff --git a/PaddleCV/image_classification/infer.py b/PaddleCV/image_classification/infer.py index ac788c89..f60073f3 100644 --- a/PaddleCV/image_classification/infer.py +++ b/PaddleCV/image_classification/infer.py @@ -1,19 +1,35 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import os -import numpy as np import time import sys +import math +import numpy as np +import argparse +import functools + import paddle import paddle.fluid as fluid import reader_cv2 as reader -import argparse -import functools import models import utils from utils.utility import add_arguments,print_arguments -import math parser = argparse.ArgumentParser(description=__doc__) # yapf: disable diff --git a/PaddleCV/image_classification/models/alexnet.py b/PaddleCV/image_classification/models/alexnet.py index f063c4d6..dcc68ec0 100644 --- a/PaddleCV/image_classification/models/alexnet.py +++ b/PaddleCV/image_classification/models/alexnet.py @@ -1,9 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math __all__ = ['AlexNet'] diff --git a/PaddleCV/image_classification/models/dpn.py b/PaddleCV/image_classification/models/dpn.py index 7f759b3b..bbc19aea 100644 --- a/PaddleCV/image_classification/models/dpn.py +++ b/PaddleCV/image_classification/models/dpn.py @@ -1,12 +1,28 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import os import numpy as np import time import sys -import paddle.fluid as fluid import math + +import paddle.fluid as fluid from paddle.fluid.param_attr import ParamAttr __all__ = ["DPN", "DPN68", "DPN92", "DPN98", "DPN107", "DPN131"] diff --git a/PaddleCV/image_classification/models/googlenet.py b/PaddleCV/image_classification/models/googlenet.py index bd9040c5..9bb3ad6d 100644 --- a/PaddleCV/image_classification/models/googlenet.py +++ b/PaddleCV/image_classification/models/googlenet.py @@ -1,6 +1,21 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import paddle import paddle.fluid as fluid from paddle.fluid.param_attr import ParamAttr diff --git a/PaddleCV/image_classification/models/inception_v4.py b/PaddleCV/image_classification/models/inception_v4.py index 8c6c0dbb..47d406be 100644 --- a/PaddleCV/image_classification/models/inception_v4.py +++ b/PaddleCV/image_classification/models/inception_v4.py @@ -1,9 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = ['InceptionV4'] diff --git a/PaddleCV/image_classification/models/mobilenet.py b/PaddleCV/image_classification/models/mobilenet.py index d242bc94..4a1154e1 100644 --- a/PaddleCV/image_classification/models/mobilenet.py +++ b/PaddleCV/image_classification/models/mobilenet.py @@ -1,6 +1,21 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import paddle.fluid as fluid from paddle.fluid.initializer import MSRA from paddle.fluid.param_attr import ParamAttr diff --git a/PaddleCV/image_classification/models/resnet.py b/PaddleCV/image_classification/models/resnet.py index b44a6192..3f705d40 100644 --- a/PaddleCV/image_classification/models/resnet.py +++ b/PaddleCV/image_classification/models/resnet.py @@ -1,9 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = ["ResNet", "ResNet18", "ResNet34", "ResNet50", "ResNet101", "ResNet152"] diff --git a/PaddleCV/image_classification/models/resnet_dist.py b/PaddleCV/image_classification/models/resnet_dist.py index 4656b4a2..fad32e8b 100644 --- a/PaddleCV/image_classification/models/resnet_dist.py +++ b/PaddleCV/image_classification/models/resnet_dist.py @@ -1,10 +1,27 @@ -#NOTE: This is for distributed resnet +#copyright (c) 2019 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. + +#NOTE: This is for distributed resnet. + from __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math __all__ = ["DistResNet"] diff --git a/PaddleCV/image_classification/models/resnet_vc.py b/PaddleCV/image_classification/models/resnet_vc.py index d715193e..71b3f533 100644 --- a/PaddleCV/image_classification/models/resnet_vc.py +++ b/PaddleCV/image_classification/models/resnet_vc.py @@ -1,10 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = ["ResNet", "ResNet50_vc", "ResNet101_vc", "ResNet152_vc"] diff --git a/PaddleCV/image_classification/models/resnet_vd.py b/PaddleCV/image_classification/models/resnet_vd.py index edbe0f9e..e56a9766 100644 --- a/PaddleCV/image_classification/models/resnet_vd.py +++ b/PaddleCV/image_classification/models/resnet_vd.py @@ -1,10 +1,26 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid from paddle.fluid.param_attr import ParamAttr -import math __all__ = ["ResNet", "ResNet50_vd","ResNet101_vd", "ResNet152_vd", "ResNet200_vd"] diff --git a/PaddleCV/image_classification/models/resnext.py b/PaddleCV/image_classification/models/resnext.py index f0b5e110..a50db517 100644 --- a/PaddleCV/image_classification/models/resnext.py +++ b/PaddleCV/image_classification/models/resnext.py @@ -1,9 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = ["ResNeXt", "ResNeXt50_64x4d", "ResNeXt101_64x4d", "ResNeXt152_64x4d"] diff --git a/PaddleCV/image_classification/models/se_resnext.py b/PaddleCV/image_classification/models/se_resnext.py index 0ae3d66f..697c551e 100644 --- a/PaddleCV/image_classification/models/se_resnext.py +++ b/PaddleCV/image_classification/models/se_resnext.py @@ -1,9 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = [ diff --git a/PaddleCV/image_classification/models/se_resnext_vd.py b/PaddleCV/image_classification/models/se_resnext_vd.py index 10d953f5..d4c919ff 100644 --- a/PaddleCV/image_classification/models/se_resnext_vd.py +++ b/PaddleCV/image_classification/models/se_resnext_vd.py @@ -1,10 +1,25 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function +import math + import paddle import paddle.fluid as fluid -import math from paddle.fluid.param_attr import ParamAttr __all__ = [ diff --git a/PaddleCV/image_classification/models/shufflenet_v2.py b/PaddleCV/image_classification/models/shufflenet_v2.py index c1467e45..0c48d7ea 100644 --- a/PaddleCV/image_classification/models/shufflenet_v2.py +++ b/PaddleCV/image_classification/models/shufflenet_v2.py @@ -1,3 +1,23 @@ +#copyright (c) 2019 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 __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import math + import paddle.fluid as fluid from paddle.fluid.initializer import MSRA from paddle.fluid.param_attr import ParamAttr diff --git a/PaddleCV/image_classification/models/vgg.py b/PaddleCV/image_classification/models/vgg.py index 8fcd2d9f..a69bb39f 100644 --- a/PaddleCV/image_classification/models/vgg.py +++ b/PaddleCV/image_classification/models/vgg.py @@ -1,6 +1,21 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import paddle import paddle.fluid as fluid diff --git a/PaddleCV/image_classification/reader.py b/PaddleCV/image_classification/reader.py index 373a3023..cb0acee9 100644 --- a/PaddleCV/image_classification/reader.py +++ b/PaddleCV/image_classification/reader.py @@ -1,11 +1,26 @@ +#copyright (c) 2019 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 import math import random import functools import numpy as np -import paddle from PIL import Image, ImageEnhance +import paddle + random.seed(0) np.random.seed(0) diff --git a/PaddleCV/image_classification/reader_cv2.py b/PaddleCV/image_classification/reader_cv2.py index 7b9a714c..d720754a 100644 --- a/PaddleCV/image_classification/reader_cv2.py +++ b/PaddleCV/image_classification/reader_cv2.py @@ -1,12 +1,27 @@ +#copyright (c) 2019 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 import math import random import functools import numpy as np -import paddle import cv2 import io +import paddle + random.seed(0) np.random.seed(0) diff --git a/PaddleCV/image_classification/train.py b/PaddleCV/image_classification/train.py index 467ef098..cb33fd72 100644 --- a/PaddleCV/image_classification/train.py +++ b/PaddleCV/image_classification/train.py @@ -1,19 +1,35 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + import os import numpy as np import time import sys import functools import math +import argparse +import functools +import subprocess + import paddle import paddle.fluid as fluid import paddle.dataset.flowers as flowers import reader_cv2 as reader -import argparse -import functools -import subprocess import utils import models from utils.fp16_utils import create_master_params_grads, master_param_to_train_param diff --git a/PaddleCV/image_classification/utils/fp16_utils.py b/PaddleCV/image_classification/utils/fp16_utils.py index bc55f77d..fbae4dc3 100644 --- a/PaddleCV/image_classification/utils/fp16_utils.py +++ b/PaddleCV/image_classification/utils/fp16_utils.py @@ -1,4 +1,19 @@ +#copyright (c) 2019 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 __future__ import print_function + import paddle import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/PaddleCV/image_classification/utils/learning_rate.py b/PaddleCV/image_classification/utils/learning_rate.py index f505d79e..2a2c10d1 100644 --- a/PaddleCV/image_classification/utils/learning_rate.py +++ b/PaddleCV/image_classification/utils/learning_rate.py @@ -1,13 +1,28 @@ +#copyright (c) 2019 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 __future__ import absolute_import from __future__ import division from __future__ import print_function + +import math + import paddle import paddle.fluid as fluid import paddle.fluid.layers.ops as ops from paddle.fluid.initializer import init_on_cpu from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter -import math - def cosine_decay(learning_rate, step_each_epoch, epochs=120): """Applies cosine decay to the learning rate. diff --git a/PaddleCV/image_classification/utils/utility.py b/PaddleCV/image_classification/utils/utility.py index c28646da..33ac1e35 100644 --- a/PaddleCV/image_classification/utils/utility.py +++ b/PaddleCV/image_classification/utils/utility.py @@ -16,11 +16,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + import distutils.util import numpy as np import six -from paddle.fluid import core - def print_arguments(args): """Print argparse's arguments. -- GitLab