Răsfoiți Sursa

fix restful bug

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

+ 1 - 1
paddlex_restful/restful/project/evaluate/classification.py

@@ -111,7 +111,7 @@ class Evaluator(object):
         '''生成评估报告。
         '''
         report = dict()
-        report['Confusion_Matrix'] = self.cal_confusion_matrix()
+        report['Confusion_Matrix'] = self.cal_confusion_matrix().tolist()
         report['PRF1_average'] = {}
         report['PRF1'], report['PRF1_average'][
             'over_all'] = self.cal_precision_recall_F1()

+ 1 - 1
paddlex_restful/restful/project/evaluate/detection.py

@@ -769,7 +769,7 @@ class InsSegEvaluator(DetEvaluator):
         '''
         report = dict()
         report['BBox_Confusion_Matrix'] = copy.deepcopy(
-            self.cal_confusion_matrix())
+            self.cal_confusion_matrix().tolist())
         report['BBox_mAP'] = copy.deepcopy(self.cal_map())
         report['BBox_PRAP'] = copy.deepcopy(self.cal_precision_recall())
         report['label_list'] = copy.deepcopy(list(self.cname2cid.keys()))

+ 1 - 1
paddlex_restful/restful/project/evaluate/segmentation.py

@@ -112,7 +112,7 @@ class Evaluator(object):
             category_iou_dict[self.labels[i]] = category_iou[i]
 
         report = dict()
-        report['Confusion_Matrix'] = self.cal_confusion_matrix()
+        report['Confusion_Matrix'] = self.cal_confusion_matrix().tolist()
         report['Mean_IoU'] = mean_iou
         report['Mean_Acc'] = mean_acc
         report['PRIoU'] = self.cal_precision_recall()

+ 1 - 1
paddlex_restful/restful/project/task.py

@@ -334,7 +334,7 @@ def get_eval_all_metrics(data, workspace):
                 epoch_index = int(file_dir.split('_')[-1])
                 yml_file_path = osp.join(epoch_dir, "model.yml")
                 f = open(yml_file_path, 'r', encoding='utf-8')
-                yml_file = yaml.load(f.read())
+                yml_file = yaml.load(f.read(), Loader=yaml.Loader)
                 result = yml_file["_Attributes"]["eval_metrics"]
                 key = list(result.keys())[0]
                 value = result[key]