Преглед изворни кода

load model correctly when fixed_input_shape is None

FlyingQianMM пре 4 година
родитељ
комит
81867e2222
1 измењених фајлова са 9 додато и 8 уклоњено
  1. 9 8
      paddlex/cv/models/load_model.py

+ 9 - 8
paddlex/cv/models/load_model.py

@@ -57,14 +57,15 @@ def load_model(model_dir, fixed_input_shape=None):
 
     if info['Model'].count('RCNN') > 0:
         if info['_init_params']['with_fpn']:
-            if model.fixed_input_shape[0] % 32 > 0:
-                raise Exception(
-                    "The first value in fixed_input_shape must be a multiple of 32, but recieved {}.".
-                    format(model.fixed_input_shape[0]))
-            if model.fixed_input_shape[1] % 32 > 0:
-                raise Exception(
-                    "The second value in fixed_input_shape must be a multiple of 32, but recieved {}.".
-                    format(model.fixed_input_shape[1]))
+            if model.fixed_input_shape is not None:
+                if model.fixed_input_shape[0] % 32 > 0:
+                    raise Exception(
+                        "The first value in fixed_input_shape must be a multiple of 32, but recieved {}.".
+                        format(model.fixed_input_shape[0]))
+                if model.fixed_input_shape[1] % 32 > 0:
+                    raise Exception(
+                        "The second value in fixed_input_shape must be a multiple of 32, but recieved {}.".
+                        format(model.fixed_input_shape[1]))
 
     with fluid.scope_guard(model_scope):
         if status == "Normal" or \