فهرست منبع

Merge pull request #842 from will-jl944/develop_jf

fix bug when pretrain_weights is None
FlyingQianMM 4 سال پیش
والد
کامیت
e8246361e4
3فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      dygraph/paddlex/cv/models/classifier.py
  2. 1 1
      dygraph/paddlex/cv/models/detector.py
  3. 1 1
      dygraph/paddlex/cv/models/segmenter.py

+ 1 - 1
dygraph/paddlex/cv/models/classifier.py

@@ -243,7 +243,7 @@ class BaseClassifier(BaseModel):
                     "If don't want to use pretrain weights, "
                     "set pretrain_weights to be None.")
                 pretrain_weights = 'IMAGENET'
-        elif osp.exists(pretrain_weights):
+        elif pretrain_weights is not None and osp.exists(pretrain_weights):
             if osp.splitext(pretrain_weights)[-1] != '.pdparams':
                 logging.error(
                     "Invalid pretrain weights. Please specify a '.pdparams' file.",

+ 1 - 1
dygraph/paddlex/cv/models/detector.py

@@ -240,7 +240,7 @@ class BaseDetector(BaseModel):
                                 "If you don't want to use pretrain weights, "
                                 "set pretrain_weights to be None.".format(
                                     pretrain_weights))
-        elif osp.exists(pretrain_weights):
+        elif pretrain_weights is not None and osp.exists(pretrain_weights):
             if osp.splitext(pretrain_weights)[-1] != '.pdparams':
                 logging.error(
                     "Invalid pretrain weights. Please specify a '.pdparams' file.",

+ 1 - 1
dygraph/paddlex/cv/models/segmenter.py

@@ -241,7 +241,7 @@ class BaseSegmenter(BaseModel):
                                         0]))
                 pretrain_weights = seg_pretrain_weights_dict[self.model_name][
                     0]
-        elif osp.exists(pretrain_weights):
+        elif pretrain_weights is not None and osp.exists(pretrain_weights):
             if osp.splitext(pretrain_weights)[-1] != '.pdparams':
                 logging.error(
                     "Invalid pretrain weights. Please specify a '.pdparams' file.",