cvat/serverless/openvino/base/shared.py

10 lines
262 B
Python
Raw Normal View History

2025-09-16 01:19:40 +00:00
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
def to_cvat_mask(box: list, mask):
xtl, ytl, xbr, ybr = box
flattened = mask[ytl:ybr + 1, xtl:xbr + 1].flat[:].tolist()
flattened.extend([xtl, ytl, xbr, ybr])
return flattened