MCPcopy Create free account
hub / github.com/aigc3d/LHM / scale

Method scale

engine/SegmentAPI/base.py:115–131  ·  view source on GitHub ↗
(self, scale, width, height)

Source from the content-addressed store, hash-verified

113 return list(map(int, self.box))
114
115 def scale(self, scale, width, height):
116 new_box = self.to_xywh()
117 cx, cy, w, h = new_box.get_box()
118 w = w * scale
119 h = h * scale
120
121 l = cx - w // 2
122 t = cy - h // 2
123 r = cx + w - (w // 2)
124 b = cy + h - (h // 2)
125
126 l = int(max(l, 0))
127 t = int(max(t, 0))
128 r = int(min(r, width))
129 b = int(min(b, height))
130
131 return Bbox([l, t, r, b], mode="whwh")
132
133 def __repr__(self):
134 box = self.to_whwh()

Callers 5

predict_bboxMethod · 0.95
birefnet_predict_bboxMethod · 0.95
rembg_predict_bboxMethod · 0.95
yolo_predict_bboxMethod · 0.95
backprop_lossMethod · 0.45

Calls 3

to_xywhMethod · 0.95
BboxClass · 0.70
get_boxMethod · 0.45

Tested by

no test coverage detected