MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / coco_encode_rle

Function coco_encode_rle

utils/sam_utils/amg.py:294–300  ·  view source on GitHub ↗
(uncompressed_rle: Dict[str, Any])

Source from the content-addressed store, hash-verified

292
293
294def coco_encode_rle(uncompressed_rle: Dict[str, Any]) -> Dict[str, Any]:
295 from pycocotools import mask as mask_utils # type: ignore
296
297 h, w = uncompressed_rle["size"]
298 rle = mask_utils.frPyObjects(uncompressed_rle, h, w)
299 rle["counts"] = rle["counts"].decode("utf-8") # Necessary to serialize with json
300 return rle
301
302
303def batched_mask_to_box(masks: torch.Tensor) -> torch.Tensor:

Callers 1

generateMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected