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

Method nonempty

detectron2/structures/boxes.py:201–215  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 5

find_top_rpn_proposalsFunction · 0.95
transform_proposalsFunction · 0.95
detector_postprocessFunction · 0.45
filter_empty_instancesFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected