Find boxes that are non-empty. A box is considered empty, if either of its side is no larger than threshold. Returns: Tensor: a binary vector which represents whether each box is empty (False) or non-empty (True).
(self, threshold: float = 0.0)
| 199 | self.tensor[:, 3].clamp_(min=0, max=h) |
| 200 | |
| 201 | def nonempty(self, threshold: float = 0.0) -> torch.Tensor: |
| 202 | """ |
| 203 | Find boxes that are non-empty. |
| 204 | A box is considered empty, if either of its side is no larger than threshold. |
| 205 | |
| 206 | Returns: |
| 207 | Tensor: |
| 208 | a binary vector which represents whether each box is empty |
| 209 | (False) or non-empty (True). |
| 210 | """ |
| 211 | box = self.tensor |
| 212 | widths = box[:, 2] - box[:, 0] |
| 213 | heights = box[:, 3] - box[:, 1] |
| 214 | keep = (widths > threshold) & (heights > threshold) |
| 215 | return keep |
| 216 | |
| 217 | def __getitem__(self, item) -> "Boxes": |
| 218 | """ |
no outgoing calls
no test coverage detected