From 79fd3f46965479ec142d1fe4c9704fa1c7975e54 Mon Sep 17 00:00:00 2001 From: "shimin.ysm" Date: Mon, 13 Mar 2023 18:20:07 +0800 Subject: [PATCH] =?UTF-8?q?bts=20=E5=9B=BE=E7=89=87=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=88=87=E6=8D=A2=20LoadImage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11969289 --- .../pipelines/cv/image_bts_depth_estimation_pipeline.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modelscope/pipelines/cv/image_bts_depth_estimation_pipeline.py b/modelscope/pipelines/cv/image_bts_depth_estimation_pipeline.py index a3e75ce3..f635f566 100644 --- a/modelscope/pipelines/cv/image_bts_depth_estimation_pipeline.py +++ b/modelscope/pipelines/cv/image_bts_depth_estimation_pipeline.py @@ -10,6 +10,7 @@ from modelscope.metainfo import Pipelines from modelscope.outputs import OutputKeys from modelscope.pipelines.base import Input, Pipeline from modelscope.pipelines.builder import PIPELINES +from modelscope.preprocessors import LoadImage from modelscope.utils.constant import Tasks from modelscope.utils.cv.image_utils import depth_to_color from modelscope.utils.logger import get_logger @@ -50,9 +51,7 @@ class ImageBTSDepthEstimationPipeline(Pipeline): logger.info('BTS depth estimation model, pipeline init') def preprocess(self, input: Input) -> Dict[str, Any]: - img = cv2.imread(input) - img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) - img = np.array(img, dtype=np.uint8) + img = LoadImage.convert_to_ndarray(input) h, w, _ = img.shape top, left = int(h - 352), int((w - 1216) / 2)