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

Method apply_boxes

utils/sam_utils/transforms.py:47–53  ·  view source on GitHub ↗

Expects a numpy array shape Bx4. Requires the original image size in (H, W) format.

(self, boxes: np.ndarray, original_size: Tuple[int, ...])

Source from the content-addressed store, hash-verified

45 return coords
46
47 def apply_boxes(self, boxes: np.ndarray, original_size: Tuple[int, ...]) -> np.ndarray:
48 """
49 Expects a numpy array shape Bx4. Requires the original image size
50 in (H, W) format.
51 """
52 boxes = self.apply_coords(boxes.reshape(-1, 2, 2), original_size)
53 return boxes.reshape(-1, 4)
54
55 def apply_image_torch(self, image: torch.Tensor) -> torch.Tensor:
56 """

Callers

nothing calls this directly

Calls 1

apply_coordsMethod · 0.95

Tested by

no test coverage detected