Bobholamovic před 2 roky
rodič
revize
17c21ff9d7

+ 1 - 1
paddlers/datasets/voc.py

@@ -188,7 +188,7 @@ class VOCDetection(Dataset):
                     box_tag = pattern.findall(str(ET.tostringlist(obj)))
                     box_tag = pattern.findall(str(ET.tostringlist(obj)))
                     if len(box_tag) == 0:
                     if len(box_tag) == 0:
                         logging.warning(
                         logging.warning(
-                            "There's no field '<bndbox>' in one of object, "
+                            "There is no field '<bndbox>' in the object, "
                             "so this object will be ignored. xml file: {}".
                             "so this object will be ignored. xml file: {}".
                             format(xml_file))
                             format(xml_file))
                         continue
                         continue

+ 1 - 1
paddlers/rs_models/cd/layers/__init__.py

@@ -12,5 +12,5 @@
 # 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.
 
 
-from ...layers.blocks import *
+from paddlers.rs_models.layers.blocks import *
 from .attention import ChannelAttention, SpatialAttention, CBAM
 from .attention import ChannelAttention, SpatialAttention, CBAM

+ 1 - 1
paddlers/rs_models/cd/layers/attention.py

@@ -16,7 +16,7 @@ import paddle
 import paddle.nn as nn
 import paddle.nn as nn
 import paddle.nn.functional as F
 import paddle.nn.functional as F
 
 
-from .blocks import Conv1x1, BasicConv
+from paddlers.rs_models.layers.blocks import Conv1x1, BasicConv
 
 
 
 
 class ChannelAttention(nn.Layer):
 class ChannelAttention(nn.Layer):

+ 1 - 1
paddlers/rs_models/clas/condensenet_v2.py

@@ -20,7 +20,7 @@ Apache License [see LICENSE for details]
 import paddle
 import paddle
 import paddle.nn as nn
 import paddle.nn as nn
 
 
-from ...layers.blocks import make_bn
+from paddlers.rs_models.layers.blocks import make_bn
 
 
 __all__ = ["CondenseNetV2_a", "CondenseNetV2_b", "CondenseNetV2_c"]
 __all__ = ["CondenseNetV2_a", "CondenseNetV2_b", "CondenseNetV2_c"]
 
 

+ 1 - 1
paddlers/rs_models/seg/layers/layers_lib.py

@@ -16,7 +16,7 @@ import paddle
 import paddle.nn as nn
 import paddle.nn as nn
 import paddle.nn.functional as F
 import paddle.nn.functional as F
 
 
-from ...layers.blocks import *
+from paddlers.rs_models.layers.blocks import *
 
 
 
 
 class Add(nn.Layer):
 class Add(nn.Layer):

+ 2 - 2
paddlers/tasks/__init__.py

@@ -15,6 +15,6 @@
 import paddlers.tasks.object_detector as det
 import paddlers.tasks.object_detector as det
 import paddlers.tasks.segmenter as seg
 import paddlers.tasks.segmenter as seg
 import paddlers.tasks.change_detector as cd
 import paddlers.tasks.change_detector as cd
-import paddlers.classifier as clas
-import paddlers.image_restorer as res
+import paddlers.tasks.classifier as clas
+import paddlers.tasks.image_restorer as res
 from .load_model import load_model
 from .load_model import load_model

+ 1 - 1
paddlers/tasks/change_detector.py

@@ -52,7 +52,7 @@ class BaseChangeDetector(BaseModel):
             del self.init_params['with_net']
             del self.init_params['with_net']
         super(BaseChangeDetector, self).__init__('change_detector')
         super(BaseChangeDetector, self).__init__('change_detector')
         if model_name not in __all__:
         if model_name not in __all__:
-            raise Exception("ERROR: There's no model named {}.".format(
+            raise ValueError("ERROR: There is no model named {}.".format(
                 model_name))
                 model_name))
         self.model_name = model_name
         self.model_name = model_name
         self.num_classes = num_classes
         self.num_classes = num_classes

+ 1 - 1
paddlers/tasks/classifier.py

@@ -23,7 +23,7 @@ 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.rs_models.cls as cmcls
+import paddlers.rs_models.clas as cmcls
 import paddlers
 import paddlers
 from paddlers.transforms import arrange_transforms
 from paddlers.transforms import arrange_transforms
 from paddlers.utils import get_single_card_bs, DisablePrint
 from paddlers.utils import get_single_card_bs, DisablePrint

+ 1 - 1
paddlers/tasks/object_detector.py

@@ -49,7 +49,7 @@ class BaseDetector(BaseModel):
             del self.init_params['with_net']
             del self.init_params['with_net']
         super(BaseDetector, self).__init__('detector')
         super(BaseDetector, self).__init__('detector')
         if not hasattr(ppdet.modeling, model_name):
         if not hasattr(ppdet.modeling, model_name):
-            raise Exception("ERROR: There's no model named {}.".format(
+            raise ValueError("ERROR: There is no model named {}.".format(
                 model_name))
                 model_name))
 
 
         self.model_name = model_name
         self.model_name = model_name

+ 1 - 1
paddlers/tasks/segmenter.py

@@ -49,7 +49,7 @@ class BaseSegmenter(BaseModel):
         super(BaseSegmenter, self).__init__('segmenter')
         super(BaseSegmenter, self).__init__('segmenter')
         if not hasattr(paddleseg.models, model_name) and \
         if not hasattr(paddleseg.models, model_name) and \
            not hasattr(cmseg, model_name):
            not hasattr(cmseg, model_name):
-            raise Exception("ERROR: There's no model named {}.".format(
+            raise ValueError("ERROR: There is no model named {}.".format(
                 model_name))
                 model_name))
         self.model_name = model_name
         self.model_name = model_name
         self.num_classes = num_classes
         self.num_classes = num_classes

+ 1 - 0
paddlers/transforms/operators.py

@@ -234,6 +234,7 @@ class DecodeImg(Transform):
                 raise ValueError(
                 raise ValueError(
                     "The height or width of the image is not same as the mask.")
                     "The height or width of the image is not same as the mask.")
         if 'aux_masks' in sample:
         if 'aux_masks' in sample:
+            sample['aux_masks_ori'] = copy.deepcopy(sample['aux_masks'])
             sample['aux_masks'] = list(
             sample['aux_masks'] = list(
                 map(self.apply_mask, sample['aux_masks']))
                 map(self.apply_mask, sample['aux_masks']))
             # TODO: check the shape of auxiliary masks
             # TODO: check the shape of auxiliary masks

+ 4 - 1
tests/transforms/test_operators.py

@@ -23,7 +23,7 @@ from data import build_input_from_file
 
 
 __all__ = ['TestTransform', 'TestCompose', 'TestArrange']
 __all__ = ['TestTransform', 'TestCompose', 'TestArrange']
 
 
-WHITE_LIST = []
+WHITE_LIST = ['ReloadMask']
 
 
 
 
 def _add_op_tests(cls):
 def _add_op_tests(cls):
@@ -37,6 +37,9 @@ def _add_op_tests(cls):
                                                      T.operators.Transform):
                                                      T.operators.Transform):
             if op_class is T.DecodeImg or op_class in WHITE_LIST or op_name in WHITE_LIST:
             if op_class is T.DecodeImg or op_class in WHITE_LIST or op_name in WHITE_LIST:
                 continue
                 continue
+            if issubclass(op_class, T.Compose) or issubclass(
+                    op_class, T.operators.Arrange):
+                continue
             attr_name = 'test_' + op_name
             attr_name = 'test_' + op_name
             if hasattr(cls, attr_name):
             if hasattr(cls, attr_name):
                 continue
                 continue