MCPcopy Create free account
hub / github.com/BICLab/SpikeYOLO / normalize

Method normalize

ultralytics/utils/instance.py:262–272  ·  view source on GitHub ↗

Normalize bounding boxes, segments, and keypoints to image dimensions.

(self, w, h)

Source from the content-addressed store, hash-verified

260 self.normalized = False
261
262 def normalize(self, w, h):
263 """Normalize bounding boxes, segments, and keypoints to image dimensions."""
264 if self.normalized:
265 return
266 self._bboxes.mul(scale=(1 / w, 1 / h, 1 / w, 1 / h))
267 self.segments[..., 0] /= w
268 self.segments[..., 1] /= h
269 if self.keypoints is not None:
270 self.keypoints[..., 0] /= w
271 self.keypoints[..., 1] /= h
272 self.normalized = True
273
274 def add_padding(self, padw, padh):
275 """Handle rect and mosaic situation."""

Callers 2

__call__Method · 0.45
__call__Method · 0.45

Calls 1

mulMethod · 0.45

Tested by

no test coverage detected