mirror of
https://github.com/THUDM/CogVideo.git
synced 2025-06-19 06:59:17 +08:00
# BGR to RGB
This commit is contained in:
parent
88c79c5ecd
commit
41990b0228
@ -103,9 +103,13 @@ def rife_inference_with_path(model, video_path):
|
||||
pt_frame_data = []
|
||||
pt_frame = skvideo.io.vreader(video_path)
|
||||
for frame in pt_frame:
|
||||
# BGR to RGB
|
||||
frame_rgb = frame[..., ::-1]
|
||||
frame_rgb = frame_rgb.copy()
|
||||
tensor = torch.from_numpy(frame_rgb).float().to("cpu", non_blocking=True).float() / 255.0
|
||||
pt_frame_data.append(
|
||||
torch.from_numpy(np.transpose(frame, (2, 0, 1))).to("cpu", non_blocking=True).float() / 255.0
|
||||
)
|
||||
tensor.permute(2, 0, 1)
|
||||
) # to [c, h, w,]
|
||||
|
||||
pt_frame = torch.from_numpy(np.stack(pt_frame_data))
|
||||
pt_frame = pt_frame.to(device)
|
||||
|
Loading…
x
Reference in New Issue
Block a user