mirror of
https://github.com/modelscope/modelscope.git
synced 2026-09-01 19:49:03 +02:00
[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
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user