瀏覽代碼

fix format with ndarray (#2228)

zhangyubo0722 1 年之前
父節點
當前提交
ae1bab152a
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      paddlex/inference/components/transforms/image/common.py

+ 2 - 0
paddlex/inference/components/transforms/image/common.py

@@ -94,6 +94,8 @@ class ReadImage(_BaseRead):
             with temp_file_manager.temp_file_context(suffix=".png") as temp_file:
             with temp_file_manager.temp_file_context(suffix=".png") as temp_file:
                 img_path = Path(temp_file.name)
                 img_path = Path(temp_file.name)
                 self._writer.write(img_path, img)
                 self._writer.write(img_path, img)
+                if self.format == "RGB":
+                    img = img[:, :, ::-1]
                 yield [
                 yield [
                     {
                     {
                         "input_path": img_path,
                         "input_path": img_path,