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

Method convert

ultralytics/utils/instance.py:59–71  ·  view source on GitHub ↗

Converts bounding box format from one type to another.

(self, format)

Source from the content-addressed store, hash-verified

57 # self.normalized = normalized
58
59 def convert(self, format):
60 """Converts bounding box format from one type to another."""
61 assert format in _formats, f'Invalid bounding box format: {format}, format must be one of {_formats}'
62 if self.format == format:
63 return
64 elif self.format == 'xyxy':
65 func = xyxy2xywh if format == 'xywh' else xyxy2ltwh
66 elif self.format == 'xywh':
67 func = xywh2xyxy if format == 'xyxy' else xywh2ltwh
68 else:
69 func = ltwh2xyxy if format == 'xyxy' else ltwh2xywh
70 self.bboxes = func(self.bboxes)
71 self.format = format
72
73 def areas(self):
74 """Return box areas."""

Callers 4

areasMethod · 0.95
convert_bboxMethod · 0.45
_single_checkMethod · 0.45
export_coremlMethod · 0.45

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected