Browse Source

disable training for exported inference model

will-jl944 4 years ago
parent
commit
031992d6f6
2 changed files with 8 additions and 0 deletions
  1. 4 0
      paddlex/cv/models/detector.py
  2. 4 0
      paddlex/cv/models/segmenter.py

+ 4 - 0
paddlex/cv/models/detector.py

@@ -196,6 +196,10 @@ class BaseDetector(BaseModel):
                 `pretrain_weights` can be set simultaneously. Defaults to None.
                 `pretrain_weights` can be set simultaneously. Defaults to None.
 
 
         """
         """
+        if self.status == 'Infer':
+            logging.error(
+                "Exported inference model does not support training.",
+                exit=True)
         if pretrain_weights is not None and resume_checkpoint is not None:
         if pretrain_weights is not None and resume_checkpoint is not None:
             logging.error(
             logging.error(
                 "pretrain_weights and resume_checkpoint cannot be set simultaneously.",
                 "pretrain_weights and resume_checkpoint cannot be set simultaneously.",

+ 4 - 0
paddlex/cv/models/segmenter.py

@@ -235,6 +235,10 @@ class BaseSegmenter(BaseModel):
                 `pretrain_weights` can be set simultaneously. Defaults to None.
                 `pretrain_weights` can be set simultaneously. Defaults to None.
 
 
         """
         """
+        if self.status == 'Infer':
+            logging.error(
+                "Exported inference model does not support training.",
+                exit=True)
         if pretrain_weights is not None and resume_checkpoint is not None:
         if pretrain_weights is not None and resume_checkpoint is not None:
             logging.error(
             logging.error(
                 "pretrain_weights and resume_checkpoint cannot be set simultaneously.",
                 "pretrain_weights and resume_checkpoint cannot be set simultaneously.",