MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / __resize__

Method __resize__

sft/dataset.py:54–66  ·  view source on GitHub ↗
(self, origin_img)

Source from the content-addressed store, hash-verified

52 return len(self.raw_data)
53
54 def __resize__(self, origin_img):
55 resolution = origin_img.size
56 w,h = resolution
57 if self.max_line_res is not None:
58 max_line = self.max_line_res
59 if h > max_line:
60 w = int(w * max_line / h)
61 h = max_line
62 if w > max_line:
63 h = int(h * max_line / w)
64 w = max_line
65 img = origin_img.resize((w,h),resample=Image.Resampling.LANCZOS)
66 return img
67
68 def __getitem__(self, i) -> Dict[str, torch.Tensor]:
69 try:

Callers 1

__getitem__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected