MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / load_image_batch

Method load_image_batch

wan/utils/vace_processor.py:69–88  ·  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,
70 *data_key_batch,
71 normalize=True,
72 seq_len=None,
73 **kwargs):
74 seq_len = self.seq_len if seq_len is None else seq_len
75 imgs = []
76 for data_key in data_key_batch:
77 img = self._load_image(data_key)
78 imgs.append(img)
79 w, h = imgs[0].size
80 dh, dw = self.downsample[1:]
81
82 # compute output size
83 scale = min(1., np.sqrt(seq_len / ((h / dh) * (w / dw))))
84 oh = int(h * scale) // dh * dh
85 ow = int(w * scale) // dw * dw
86 assert (oh // dh) * (ow // dw) <= seq_len
87 imgs = [self._image_preprocess(img, oh, ow, normalize) for img in imgs]
88 return *imgs, (oh, ow)
89
90
91class 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