MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / clip

Method clip

PATH/core/models/ops/boxes.py:181–195  ·  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

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

Callers 15

__call__Method · 0.80
__call__Method · 0.80
SolarizeAddFunction · 0.80
__call__Method · 0.80
__call__Method · 0.80
convertMethod · 0.80
convertMethod · 0.80
_process_imgMethod · 0.80
_process_imgMethod · 0.80
_process_imgMethod · 0.80
_process_imgMethod · 0.80
cosine_similarityFunction · 0.80

Calls 1

stackMethod · 0.80

Tested by 1

cosine_similarityFunction · 0.64