Răsfoiți Sursa

fix export bug

will-jl944 4 ani în urmă
părinte
comite
4fb4e714cf

+ 13 - 6
paddlex_restful/restful/project/operate.py

@@ -327,16 +327,23 @@ def _call_paddlex_export_infer(task_path, save_dir, export_status_path, epoch):
         osp.join(export_status_path, 'out.log'), 'w', encoding='utf-8')
     sys.stderr = open(
         osp.join(export_status_path, 'err.log'), 'w', encoding='utf-8')
+
     import os
     os.environ['CUDA_VISIBLE_DEVICES'] = ''
+    os.environ['PADDLEX_EXPORT_STAGE'] = 'True'
+    os.environ['PADDLESEG_EXPORT_STAGE'] = 'True'
     import paddlex as pdx
-    if epoch is not None:
-        model_dir = "epoch_{}".format(epoch)
-        model_path = osp.join(task_path, 'output', model_dir)
-    else:
-        model_path = osp.join(task_path, 'output', 'best_model')
+    model_dir = "epoch_{}".format(epoch) if epoch is not None else "best_model"
+    model_path = osp.join(task_path, 'output', model_dir)
     model = pdx.load_model(model_path)
-    model.export_inference_model(save_dir)
+    model._export_inference_model(save_dir)
+    '''
+    model_dir = "epoch_{}".format(epoch)
+    model_path = osp.join(task_path, 'output', model_dir)
+    if os.path.exists(save_dir):
+        shutil.rmtree(save_dir)
+    shutil.copytree(model_path, save_dir)
+    '''
     set_folder_status(export_status_path, TaskStatus.XEXPORTED)
     set_folder_status(task_path, TaskStatus.XEXPORTED)
 

+ 0 - 1
paddlex_restful/restful/project/train/params.py

@@ -251,7 +251,6 @@ class SegParams(Params):
         self.backbone = 'ResNet50_vd'
         self.blur = True
         self.blur_prob = 0.
-        self.max_rotation = 15
         self.scale_aspect = False
         self.min_ratio = 0.5
         self.aspect_ratio = 0.33

+ 0 - 1
paddlex_restful/restful/project/train/params_v2.py

@@ -282,7 +282,6 @@ def get_segmentation_params(params):
     params['blur'] = False
     params['blur_prob'] = 0.1
     params['rotate'] = False
-    params['max_rotation'] = 15
     params['scale_aspect'] = False
     params['min_ratio'] = 0.5
     params['aspect_ratio'] = 0.33

+ 1 - 1
paddlex_restful/restful/templates/paddlex_restful_demo.html

@@ -533,7 +533,7 @@ var Model_List = {
               "Xception65", "DenseNet121", "DenseNet161", "DenseNet201",
               "ShuffleNetV2"],
      "detection":["YOLOv3", "FasterRCNN", "PPYOLO", "PPYOLOTiny", "PPYOLOv2"],
-     "segmentation":["DeepLabv3P", "BiSeNetV2", "U-Net", "HRNet_W18", "FastSCNN"],
+     "segmentation":["DeepLabV3P", "BiSeNetV2", "U-Net", "HRNet_W18", "FastSCNN"],
      "instance_segmentation":["MaskRCNN"]
 }