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])
| 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 | """ |
no outgoing calls