michaelowenliu 3 gadi atpakaļ
vecāks
revīzija
cdb5e7beaf
38 mainītis faili ar 154 papildinājumiem un 67 dzēšanām
  1. 0 1
      paddlers/custom_models/cd/backbones/resnet.py
  2. 1 0
      paddlers/custom_models/gan/generators/builder.py
  3. 1 0
      paddlers/custom_models/gan/generators/rcan.py
  4. 2 0
      paddlers/custom_models/seg/farseg.py
  5. 3 1
      paddlers/datasets/coco.py
  6. 1 0
      paddlers/datasets/seg_dataset.py
  7. 3 1
      paddlers/datasets/voc.py
  8. 1 0
      paddlers/deploy/predictor.py
  9. 2 0
      paddlers/tasks/base.py
  10. 3 1
      paddlers/tasks/classifier.py
  11. 0 1
      paddlers/tasks/image_restorer.py
  12. 3 1
      paddlers/tasks/load_model.py
  13. 2 0
      paddlers/tasks/object_detector.py
  14. 3 1
      paddlers/tasks/segmenter.py
  15. 1 0
      paddlers/tasks/utils/visualize.py
  16. 2 0
      paddlers/tools/yolo_cluster.py
  17. 3 1
      paddlers/transforms/batch_operators.py
  18. 2 1
      paddlers/transforms/functions.py
  19. 1 1
      paddlers/transforms/operators.py
  20. 2 0
      paddlers/utils/checkpoint.py
  21. 2 0
      paddlers/utils/download.py
  22. 1 0
      paddlers/utils/env.py
  23. 1 0
      paddlers/utils/logging.py
  24. 1 1
      paddlers/utils/stats.py
  25. 2 0
      paddlers/utils/utils.py
  26. 5 3
      tools/coco2mask.py
  27. 15 7
      tools/coco_tools/json_AnnoSta.py
  28. 15 7
      tools/coco_tools/json_Img2Json.py
  29. 14 7
      tools/coco_tools/json_ImgSta.py
  30. 14 7
      tools/coco_tools/json_InfoShow.py
  31. 14 7
      tools/coco_tools/json_Merge.py
  32. 15 7
      tools/coco_tools/json_Split.py
  33. 3 1
      tools/mask2geojson.py
  34. 4 3
      tools/mask2shp.py
  35. 3 3
      tools/matcher.py
  36. 4 3
      tools/oif.py
  37. 2 0
      tools/spliter.py
  38. 3 1
      tools/utils/raster.py

+ 0 - 1
paddlers/custom_models/cd/backbones/resnet.py

@@ -33,7 +33,6 @@ from __future__ import print_function
 
 
 import paddle
 import paddle
 import paddle.nn as nn
 import paddle.nn as nn
-
 from paddle.utils.download import get_weights_path_from_url
 from paddle.utils.download import get_weights_path_from_url
 
 
 __all__ = []
 __all__ = []

+ 1 - 0
paddlers/custom_models/gan/generators/builder.py

@@ -13,6 +13,7 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import copy
 import copy
+
 from ....models.ppgan.utils.registry import Registry
 from ....models.ppgan.utils.registry import Registry
 
 
 GENERATORS = Registry("GENERATOR")
 GENERATORS = Registry("GENERATOR")

+ 1 - 0
paddlers/custom_models/gan/generators/rcan.py

@@ -1,5 +1,6 @@
 # base on https://github.com/kongdebug/RCAN-Paddle
 # base on https://github.com/kongdebug/RCAN-Paddle
 import math
 import math
+
 import paddle
 import paddle
 import paddle.nn as nn
 import paddle.nn as nn
 
 

+ 2 - 0
paddlers/custom_models/seg/farseg.py

@@ -18,11 +18,13 @@ Apache License [see LICENSE for details]
 """
 """
 
 
 import math
 import math
+
 import paddle.nn as nn
 import paddle.nn as nn
 import paddle.nn.functional as F
 import paddle.nn.functional as F
 from paddle.vision.models import resnet50
 from paddle.vision.models import resnet50
 from paddle import nn
 from paddle import nn
 import paddle.nn.functional as F
 import paddle.nn.functional as F
+
 from .layers import (Identity, ConvReLU, kaiming_normal_init, constant_init)
 from .layers import (Identity, ConvReLU, kaiming_normal_init, constant_init)
 
 
 
 

+ 3 - 1
paddlers/datasets/coco.py

@@ -17,9 +17,11 @@ import copy
 import os
 import os
 import os.path as osp
 import os.path as osp
 import random
 import random
-import numpy as np
 from collections import OrderedDict
 from collections import OrderedDict
+
+import numpy as np
 from paddle.io import Dataset
 from paddle.io import Dataset
+
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 from paddlers.transforms import ImgDecoder, MixupImage
 from paddlers.transforms import ImgDecoder, MixupImage
 from paddlers.tools import YOLOAnchorCluster
 from paddlers.tools import YOLOAnchorCluster

+ 1 - 0
paddlers/datasets/seg_dataset.py

@@ -16,6 +16,7 @@ import os.path as osp
 import copy
 import copy
 
 
 from paddle.io import Dataset
 from paddle.io import Dataset
+
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 
 
 
 

+ 3 - 1
paddlers/datasets/voc.py

@@ -18,10 +18,12 @@ import os
 import os.path as osp
 import os.path as osp
 import random
 import random
 import re
 import re
-import numpy as np
 from collections import OrderedDict
 from collections import OrderedDict
 import xml.etree.ElementTree as ET
 import xml.etree.ElementTree as ET
+
+import numpy as np
 from paddle.io import Dataset
 from paddle.io import Dataset
+
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 from paddlers.utils import logging, get_num_workers, get_encoding, path_normalization, is_pic
 from paddlers.transforms import ImgDecoder, MixupImage
 from paddlers.transforms import ImgDecoder, MixupImage
 from paddlers.tools import YOLOAnchorCluster
 from paddlers.tools import YOLOAnchorCluster

+ 1 - 0
paddlers/deploy/predictor.py

@@ -18,6 +18,7 @@ import numpy as np
 from paddle.inference import Config
 from paddle.inference import Config
 from paddle.inference import create_predictor
 from paddle.inference import create_predictor
 from paddle.inference import PrecisionType
 from paddle.inference import PrecisionType
+
 from paddlers.tasks import load_model
 from paddlers.tasks import load_model
 from paddlers.utils import logging, Timer
 from paddlers.utils import logging, Timer
 
 

+ 2 - 0
paddlers/tasks/base.py

@@ -20,11 +20,13 @@ import copy
 import math
 import math
 import yaml
 import yaml
 import json
 import json
+
 import paddle
 import paddle
 from paddle.io import DataLoader, DistributedBatchSampler
 from paddle.io import DataLoader, DistributedBatchSampler
 from paddleslim import QAT
 from paddleslim import QAT
 from paddleslim.analysis import flops
 from paddleslim.analysis import flops
 from paddleslim import L1NormFilterPruner, FPGMFilterPruner
 from paddleslim import L1NormFilterPruner, FPGMFilterPruner
+
 import paddlers
 import paddlers
 from paddlers.transforms import arrange_transforms
 from paddlers.transforms import arrange_transforms
 from paddlers.utils import (seconds_to_hms, get_single_card_bs, dict2str,
 from paddlers.utils import (seconds_to_hms, get_single_card_bs, dict2str,

+ 3 - 1
paddlers/tasks/classifier.py

@@ -14,11 +14,13 @@
 
 
 import math
 import math
 import os.path as osp
 import os.path as osp
-import numpy as np
 from collections import OrderedDict
 from collections import OrderedDict
+
+import numpy as np
 import paddle
 import paddle
 import paddle.nn.functional as F
 import paddle.nn.functional as F
 from paddle.static import InputSpec
 from paddle.static import InputSpec
+
 import paddlers.models.ppcls as paddleclas
 import paddlers.models.ppcls as paddleclas
 import paddlers.custom_models.cls as cmcls
 import paddlers.custom_models.cls as cmcls
 import paddlers
 import paddlers

+ 0 - 1
paddlers/tasks/image_restorer.py

@@ -14,7 +14,6 @@
 
 
 import os
 import os
 import time
 import time
-
 import datetime
 import datetime
 
 
 import paddle
 import paddle

+ 3 - 1
paddlers/tasks/load_model.py

@@ -13,10 +13,12 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import os.path as osp
 import os.path as osp
-import numpy as np
 import yaml
 import yaml
+
+import numpy as np
 import paddle
 import paddle
 import paddleslim
 import paddleslim
+
 import paddlers
 import paddlers
 import paddlers.utils.logging as logging
 import paddlers.utils.logging as logging
 from paddlers.transforms import build_transforms
 from paddlers.transforms import build_transforms

+ 2 - 0
paddlers/tasks/object_detector.py

@@ -18,9 +18,11 @@ import collections
 import copy
 import copy
 import os
 import os
 import os.path as osp
 import os.path as osp
+
 import numpy as np
 import numpy as np
 import paddle
 import paddle
 from paddle.static import InputSpec
 from paddle.static import InputSpec
+
 import paddlers.models.ppdet as ppdet
 import paddlers.models.ppdet as ppdet
 from paddlers.models.ppdet.modeling.proposal_generator.target_layer import BBoxAssigner, MaskAssigner
 from paddlers.models.ppdet.modeling.proposal_generator.target_layer import BBoxAssigner, MaskAssigner
 import paddlers
 import paddlers

+ 3 - 1
paddlers/tasks/segmenter.py

@@ -14,12 +14,14 @@
 
 
 import math
 import math
 import os.path as osp
 import os.path as osp
+from collections import OrderedDict
+
 import numpy as np
 import numpy as np
 import cv2
 import cv2
-from collections import OrderedDict
 import paddle
 import paddle
 import paddle.nn.functional as F
 import paddle.nn.functional as F
 from paddle.static import InputSpec
 from paddle.static import InputSpec
+
 import paddlers.models.ppseg as paddleseg
 import paddlers.models.ppseg as paddleseg
 import paddlers.custom_models.seg as cmseg
 import paddlers.custom_models.seg as cmseg
 import paddlers
 import paddlers

+ 1 - 0
paddlers/tasks/utils/visualize.py

@@ -16,6 +16,7 @@ import os
 import cv2
 import cv2
 import numpy as np
 import numpy as np
 import time
 import time
+
 import paddlers.utils.logging as logging
 import paddlers.utils.logging as logging
 from paddlers.utils import is_pic
 from paddlers.utils import is_pic
 from .det_metrics.coco_utils import loadRes
 from .det_metrics.coco_utils import loadRes

+ 2 - 0
paddlers/tools/yolo_cluster.py

@@ -14,9 +14,11 @@
 
 
 import copy
 import copy
 import os
 import os
+
 import numpy as np
 import numpy as np
 from tqdm import tqdm
 from tqdm import tqdm
 from scipy.cluster.vq import kmeans
 from scipy.cluster.vq import kmeans
+
 from paddlers.utils import logging
 from paddlers.utils import logging
 
 
 __all__ = ['YOLOAnchorCluster']
 __all__ = ['YOLOAnchorCluster']

+ 3 - 1
paddlers/transforms/batch_operators.py

@@ -14,12 +14,14 @@
 
 
 import traceback
 import traceback
 import random
 import random
-import numpy as np
 try:
 try:
     from collections.abc import Sequence
     from collections.abc import Sequence
 except Exception:
 except Exception:
     from collections import Sequence
     from collections import Sequence
+
+import numpy as np
 from paddle.fluid.dataloader.collate import default_collate_fn
 from paddle.fluid.dataloader.collate import default_collate_fn
+
 from .operators import Transform, Resize, ResizeByShort, _Permute, interp_dict
 from .operators import Transform, Resize, ResizeByShort, _Permute, interp_dict
 from .box_utils import jaccard_overlap
 from .box_utils import jaccard_overlap
 from paddlers.utils import logging
 from paddlers.utils import logging

+ 2 - 1
paddlers/transforms/functions.py

@@ -13,8 +13,9 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import cv2
 import cv2
-import numpy as np
 import copy
 import copy
+
+import numpy as np
 import shapely.ops
 import shapely.ops
 from shapely.geometry import Polygon, MultiPolygon, GeometryCollection
 from shapely.geometry import Polygon, MultiPolygon, GeometryCollection
 from sklearn.decomposition import PCA
 from sklearn.decomposition import PCA

+ 1 - 1
paddlers/transforms/operators.py

@@ -27,8 +27,8 @@ import numpy as np
 import cv2
 import cv2
 import imghdr
 import imghdr
 from PIL import Image
 from PIL import Image
-import paddlers
 
 
+import paddlers
 from .functions import normalize, horizontal_flip, permute, vertical_flip, center_crop, is_poly, \
 from .functions import normalize, horizontal_flip, permute, vertical_flip, center_crop, is_poly, \
     horizontal_flip_poly, horizontal_flip_rle, vertical_flip_poly, vertical_flip_rle, crop_poly, \
     horizontal_flip_poly, horizontal_flip_rle, vertical_flip_poly, vertical_flip_rle, crop_poly, \
     crop_rle, expand_poly, expand_rle, resize_poly, resize_rle, de_haze, pca, select_bands, \
     crop_rle, expand_poly, expand_rle, resize_poly, resize_rle, de_haze, pca, select_bands, \

+ 2 - 0
paddlers/utils/checkpoint.py

@@ -14,8 +14,10 @@
 
 
 import os
 import os
 import os.path as osp
 import os.path as osp
+
 import glob
 import glob
 import paddle
 import paddle
+
 from . import logging
 from . import logging
 from .download import download_and_decompress
 from .download import download_and_decompress
 
 

+ 2 - 0
paddlers/utils/download.py

@@ -21,8 +21,10 @@ import time
 import hashlib
 import hashlib
 import tarfile
 import tarfile
 import zipfile
 import zipfile
+
 import filelock
 import filelock
 import paddle
 import paddle
+
 from . import logging
 from . import logging
 
 
 DOWNLOAD_RETRY_LIMIT = 3
 DOWNLOAD_RETRY_LIMIT = 3

+ 1 - 0
paddlers/utils/env.py

@@ -16,6 +16,7 @@ import os
 import platform
 import platform
 import random
 import random
 import multiprocessing as mp
 import multiprocessing as mp
+
 import numpy as np
 import numpy as np
 import paddle
 import paddle
 
 

+ 1 - 0
paddlers/utils/logging.py

@@ -15,6 +15,7 @@
 import time
 import time
 import os
 import os
 import sys
 import sys
+
 import colorama
 import colorama
 from colorama import init
 from colorama import init
 import paddle
 import paddle

+ 1 - 1
paddlers/utils/stats.py

@@ -13,9 +13,9 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import collections
 import collections
-import numpy as np
 import datetime
 import datetime
 
 
+import numpy as np
 
 
 class SmoothedValue(object):
 class SmoothedValue(object):
     """Track a series of values and provide access to smoothed values over a
     """Track a series of values and provide access to smoothed values over a

+ 2 - 0
paddlers/utils/utils.py

@@ -20,7 +20,9 @@ import math
 import imghdr
 import imghdr
 import chardet
 import chardet
 import json
 import json
+
 import numpy as np
 import numpy as np
+
 from . import logging
 from . import logging
 import platform
 import platform
 import paddlers
 import paddlers

+ 5 - 3
tools/coco2mask.py

@@ -15,14 +15,16 @@
 import os
 import os
 import os.path as osp
 import os.path as osp
 import shutil
 import shutil
-import cv2
-import numpy as np
 import json
 import json
 import argparse
 import argparse
+from collections import defaultdict
+
+import cv2
+import numpy as np
 import glob
 import glob
 from tqdm import tqdm
 from tqdm import tqdm
 from PIL import Image
 from PIL import Image
-from collections import defaultdict
+
 from utils import Timer
 from utils import Timer
 
 
 
 

+ 15 - 7
tools/coco_tools/json_AnnoSta.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_annotations_sta.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # json文件annotations信息,生成统计结果csv,对象框shape、对象看shape比例、对象框起始位置、对象结束位置、对象结束位置、对象类别、单个图像对象数量的分布
 # json文件annotations信息,生成统计结果csv,对象框shape、对象看shape比例、对象框起始位置、对象结束位置、对象结束位置、对象类别、单个图像对象数量的分布
@@ -22,6 +29,7 @@ python ./coco_tools/json_AnnoSta.py \
 import os
 import os
 import json
 import json
 import argparse
 import argparse
+
 import numpy as np
 import numpy as np
 import pandas as pd
 import pandas as pd
 import seaborn as sns
 import seaborn as sns

+ 15 - 7
tools/coco_tools/json_Img2Json.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_getTest.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # 根据test影像文件夹生成test.json
 # 根据test影像文件夹生成test.json
@@ -16,6 +23,7 @@ python ./coco_tools/json_Img2Json.py \
 import os, cv2
 import os, cv2
 import json
 import json
 import argparse
 import argparse
+
 from tqdm import tqdm
 from tqdm import tqdm
 
 
 
 

+ 14 - 7
tools/coco_tools/json_ImgSta.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_images_sta.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # 统计json文件images信息,生成统计结果csv,同时生成图像shape、图像shape比例的二维分布图
 # 统计json文件images信息,生成统计结果csv,同时生成图像shape、图像shape比例的二维分布图

+ 14 - 7
tools/coco_tools/json_InfoShow.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_infoShow.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # 输出json文件基本信息
 # 输出json文件基本信息

+ 14 - 7
tools/coco_tools/json_Merge.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_merge.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # 合并json文件,可以通过merge_keys控制合并的字段, 默认合并'images', 'annotations'字段
 # 合并json文件,可以通过merge_keys控制合并的字段, 默认合并'images', 'annotations'字段

+ 15 - 7
tools/coco_tools/json_Split.py

@@ -1,10 +1,17 @@
-# -*- coding: utf-8 -*- 
-# @File             : json_split.py
-# @Author           : zhaoHL
-# @Contact          : huilin16@qq.com
-# @Time Create First: 2021/8/1 10:25
-# @Contributor      : zhaoHL
-# @Time Modify Last : 2021/8/1 10:25
+# Copyright (c) 2022 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.
+# 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.
+
 '''
 '''
 @File Description:
 @File Description:
 # json数据集划分,可以通过val_split_rate、val_split_num控制划分比例或个数, keep_val_inTrain可以设定是否在train中保留val相关信息
 # json数据集划分,可以通过val_split_rate、val_split_num控制划分比例或个数, keep_val_inTrain可以设定是否在train中保留val相关信息
@@ -16,6 +23,7 @@ python ./coco_tools/json_Split.py \
 
 
 import json
 import json
 import argparse
 import argparse
+
 import pandas as pd
 import pandas as pd
 
 
 def get_annno(df_img_split, df_anno):
 def get_annno(df_img_split, df_anno):

+ 3 - 1
tools/mask2geojson.py

@@ -13,11 +13,13 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import codecs
 import codecs
+import argparse
+
 import cv2
 import cv2
 import numpy as np
 import numpy as np
-import argparse
 import geojson
 import geojson
 from geojson import Polygon, Feature, FeatureCollection
 from geojson import Polygon, Feature, FeatureCollection
+
 from utils import Raster, Timer
 from utils import Raster, Timer
 
 
 
 

+ 4 - 3
tools/mask2shp.py

@@ -14,11 +14,10 @@
 
 
 import os
 import os
 import os.path as osp
 import os.path as osp
-import numpy as np
 import argparse
 import argparse
-from PIL import Image
-from utils import Raster, Timer
 
 
+import numpy as np
+from PIL import Image
 try:
 try:
     from osgeo import gdal, ogr, osr
     from osgeo import gdal, ogr, osr
 except ImportError:
 except ImportError:
@@ -26,6 +25,8 @@ except ImportError:
     import ogr
     import ogr
     import osr
     import osr
 
 
+from utils import Raster, Timer
+
 
 
 def _mask2tif(mask_path, tmp_path, proj, geot):
 def _mask2tif(mask_path, tmp_path, proj, geot):
     mask = np.asarray(Image.open(mask_path))
     mask = np.asarray(Image.open(mask_path))

+ 3 - 3
tools/matcher.py

@@ -12,16 +12,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-import numpy as np
-import cv2
 import argparse
 import argparse
-from utils import Raster, raster2uint8, Timer
 
 
+import numpy as np
+import cv2
 try:
 try:
     from osgeo import gdal
     from osgeo import gdal
 except ImportError:
 except ImportError:
     import gdal
     import gdal
 
 
+from utils import Raster, raster2uint8, Timer
 
 
 class MatchError(Exception):
 class MatchError(Exception):
     def __str__(self):
     def __str__(self):

+ 4 - 3
tools/oif.py

@@ -12,13 +12,14 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-import numpy as np
-import pandas as pd
 import itertools
 import itertools
 import argparse
 import argparse
-from utils import Raster, Timer
 from easydict import EasyDict as edict
 from easydict import EasyDict as edict
 
 
+import numpy as np
+import pandas as pd
+
+from utils import Raster, Timer
 
 
 def _calcOIF(rgb, stds, rho):
 def _calcOIF(rgb, stds, rho):
     r, g, b = rgb
     r, g, b = rgb

+ 2 - 0
tools/spliter.py

@@ -16,7 +16,9 @@ import os
 import os.path as osp
 import os.path as osp
 import argparse
 import argparse
 from math import ceil
 from math import ceil
+
 from PIL import Image
 from PIL import Image
+
 from utils import Raster, Timer
 from utils import Raster, Timer
 
 
 
 

+ 3 - 1
tools/utils/raster.py

@@ -13,8 +13,10 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import os.path as osp
 import os.path as osp
-import numpy as np
 from typing import List, Tuple, Union
 from typing import List, Tuple, Union
+
+import numpy as np
+
 from paddlers.transforms.functions import to_uint8 as raster2uint8
 from paddlers.transforms.functions import to_uint8 as raster2uint8
 
 
 try:
 try: