fix(gpu): 修复MuseTalk蓝色块 — Step5删除多余BGR2RGB转换,直接传BGR给VAE #2015
@@ -805,8 +805,9 @@ def _run_inference(
|
||||
crop = frame[y1:y2_eff, x1:x2]
|
||||
if crop.size == 0:
|
||||
continue
|
||||
crop_rgb = cv2.cvtColor(crop, cv2.COLOR_BGR2RGB)
|
||||
crop_resized = cv2.resize(crop_rgb, (256, 256), interpolation=cv2.INTER_LANCZOS4)
|
||||
# 直接传 BGR 给 VAE:VAE 内部 preprocess_img 已做 BGR→RGB 转换,
|
||||
# 此处再 cvtColor 会造成双重转换、R/B 通道互换(蓝色块根因)。
|
||||
crop_resized = cv2.resize(crop, (256, 256), interpolation=cv2.INTER_LANCZOS4)
|
||||
# 使用 VAE 的 get_latents_for_unet 得到 8 通道输入
|
||||
# get_latents_for_unet 内部: preprocess(half_mask=True) encode + preprocess(half_mask=False) encode → cat → [1,8,32,32]
|
||||
latents = vae.get_latents_for_unet(crop_resized).detach().cpu()
|
||||
|
||||
Reference in New Issue
Block a user