Browse Source

[to #42322933]change output channels from RGB to BGR, to consistent with demo-service

默认输出为array的,通道格式统一为BGR格式,本次修改是为了与这个格式一致
        Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10422508
master
wenqi.oywq yingda.chen 3 years ago
parent
commit
88a7599efb
2 changed files with 2 additions and 3 deletions
  1. +1
    -1
      modelscope/pipelines/cv/image_color_enhance_pipeline.py
  2. +1
    -2
      tests/pipelines/test_image_color_enhance.py

+ 1
- 1
modelscope/pipelines/cv/image_color_enhance_pipeline.py View File

@@ -55,5 +55,5 @@ class ImageColorEnhancePipeline(Pipeline):

def postprocess(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
output_img = (inputs['outputs'].squeeze(0) * 255.).type(
torch.uint8).cpu().permute(1, 2, 0).numpy()
torch.uint8).cpu().permute(1, 2, 0).numpy()[:, :, ::-1]
return {OutputKeys.OUTPUT_IMG: output_img}

+ 1
- 2
tests/pipelines/test_image_color_enhance.py View File

@@ -21,8 +21,7 @@ class ImageColorEnhanceTest(unittest.TestCase, DemoCompatibilityCheck):
def pipeline_inference(self, pipeline: Pipeline, input_location: str):
result = pipeline(input_location)
if result is not None:
cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG][:, :,
[2, 1, 0]])
cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG])
print(f'Output written to {osp.abspath("result.png")}')

@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')


Loading…
Cancel
Save