MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / encode_single

Method encode_single

monai/apps/detection/utils/box_coder.py:154–169  ·  view source on GitHub ↗

Encode proposals with respect to ground truth (gt) boxes. Args: gt_boxes: gt boxes, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode`` proposals: boxes to be encoded, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode`

(self, gt_boxes: Tensor, proposals: Tensor)

Source from the content-addressed store, hash-verified

152 return targets
153
154 def encode_single(self, gt_boxes: Tensor, proposals: Tensor) -> Tensor:
155 """
156 Encode proposals with respect to ground truth (gt) boxes.
157
158 Args:
159 gt_boxes: gt boxes, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode``
160 proposals: boxes to be encoded, Nx4 or Nx6 torch tensor. The box mode is assumed to be ``StandardMode``
161
162 Return:
163 encoded gt, target of box regression that is used to convert proposals into gt_boxes, Nx4 or Nx6 torch tensor.
164 """
165 dtype = gt_boxes.dtype
166 device = gt_boxes.device
167 weights = torch.as_tensor(self.weights, dtype=dtype, device=device)
168 targets = encode_boxes(gt_boxes, proposals, weights)
169 return targets
170
171 def decode(self, rel_codes: Tensor, reference_boxes: Sequence[Tensor]) -> Tensor:
172 """

Callers 3

encodeMethod · 0.95
test_valueMethod · 0.95

Calls 2

encode_boxesFunction · 0.85
as_tensorMethod · 0.80

Tested by 1

test_valueMethod · 0.76