MCPcopy Create free account
hub / github.com/arielshaulov/FlowMo / load_image_batch

Method load_image_batch

wan/utils/vace_processor.py:69–84  ·  view source on GitHub ↗
(self, *data_key_batch, normalize=True, seq_len=None, **kwargs)

Source from the content-addressed store, hash-verified

67 return self.load_image_batch(data_key, data_key2, **kwargs)
68
69 def load_image_batch(self, *data_key_batch, normalize=True, seq_len=None, **kwargs):
70 seq_len = self.seq_len if seq_len is None else seq_len
71 imgs = []
72 for data_key in data_key_batch:
73 img = self._load_image(data_key)
74 imgs.append(img)
75 w, h = imgs[0].size
76 dh, dw = self.downsample[1:]
77
78 # compute output size
79 scale = min(1., np.sqrt(seq_len / ((h / dh) * (w / dw))))
80 oh = int(h * scale) // dh * dh
81 ow = int(w * scale) // dw * dw
82 assert (oh // dh) * (ow // dw) <= seq_len
83 imgs = [self._image_preprocess(img, oh, ow, normalize) for img in imgs]
84 return *imgs, (oh, ow)
85
86
87class VaceVideoProcessor(object):

Callers 2

load_imageMethod · 0.95
load_image_pairMethod · 0.95

Calls 2

_load_imageMethod · 0.95
_image_preprocessMethod · 0.95

Tested by

no test coverage detected