Prechádzať zdrojové kódy

fix channel order to BGR in output of doc preprocessor pipeline

gaotingquan 6 mesiacov pred
rodič
commit
aad6666ba5

+ 3 - 1
paddlex/inference/pipelines/doc_preprocessor/pipeline.py

@@ -167,7 +167,9 @@ class DocPreprocessorPipeline(BasePipeline):
                 rot_img = image_array
 
             if model_settings["use_doc_unwarping"]:
-                output_img = next(self.doc_unwarping_model(rot_img))["doctr_img"]
+                output_img = next(self.doc_unwarping_model(rot_img))["doctr_img"][
+                    :, :, ::-1
+                ]
             else:
                 output_img = rot_img
 

+ 1 - 1
paddlex/inference/pipelines/formula_recognition/result.py

@@ -61,7 +61,7 @@ class FormulaRecognitionResult(BaseCVResult):
         Returns:
             Dict[str, Image.Image]: An image with detection boxes, texts, and scores blended on it.
         """
-        image = Image.fromarray(self["doc_preprocessor_res"]["output_img"])
+        image = Image.fromarray(self["doc_preprocessor_res"]["output_img"][:, :, ::-1])
         res_img_dict = {}
         model_settings = self["model_settings"]
         if model_settings["use_doc_preprocessor"]:

+ 1 - 1
paddlex/inference/pipelines/layout_parsing/result.py

@@ -52,7 +52,7 @@ class LayoutParsingResult(BaseCVResult, HtmlMixin, XlsxMixin):
 
         if model_settings["use_table_recognition"] and len(self["table_res_list"]) > 0:
             table_cell_img = Image.fromarray(
-                copy.deepcopy(self["doc_preprocessor_res"]["output_img"])
+                copy.deepcopy(self["doc_preprocessor_res"]["output_img"][:, :, ::-1])
             )
             table_draw = ImageDraw.Draw(table_cell_img)
             rectangle_color = (255, 0, 0)

+ 1 - 1
paddlex/inference/pipelines/table_recognition/result.py

@@ -120,7 +120,7 @@ class TableRecognitionResult(BaseCVResult, HtmlMixin, XlsxMixin):
 
         if len(self["table_res_list"]) > 0:
             table_cell_img = Image.fromarray(
-                copy.deepcopy(self["doc_preprocessor_res"]["output_img"])
+                copy.deepcopy(self["doc_preprocessor_res"]["output_img"][:, :, ::-1])
             )
             table_draw = ImageDraw.Draw(table_cell_img)
             rectangle_color = (255, 0, 0)