MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / clip

Method clip

detectron2/structures/boxes.py:186–199  ·  view source on GitHub ↗

Clip (in place) the boxes by limiting x coordinates to the range [0, width] and y coordinates to the range [0, height]. Args: box_size (height, width): The clipping box's size.

(self, box_size: Tuple[int, int])

Source from the content-addressed store, hash-verified

184 return area
185
186 def clip(self, box_size: Tuple[int, int]) -> None:
187 """
188 Clip (in place) the boxes by limiting x coordinates to the range [0, width]
189 and y coordinates to the range [0, height].
190
191 Args:
192 box_size (height, width): The clipping box's size.
193 """
194 assert torch.isfinite(self.tensor).all(), "Box tensor contains infinite or NaN!"
195 h, w = box_size
196 self.tensor[:, 0].clamp_(min=0, max=w)
197 self.tensor[:, 1].clamp_(min=0, max=h)
198 self.tensor[:, 2].clamp_(min=0, max=w)
199 self.tensor[:, 3].clamp_(min=0, max=h)
200
201 def nonempty(self, threshold: float = 0.0) -> torch.Tensor:
202 """

Callers 13

find_top_rpn_proposalsFunction · 0.95
transform_proposalsFunction · 0.95
detector_postprocessFunction · 0.45
__init__Method · 0.45
overlay_instancesMethod · 0.45
_jitterMethod · 0.45

Calls

no outgoing calls

Tested by 2