Skip to content

请问如果用于多个视频的拼接,需要怎么改造? #291

Closed

Description

@qijiaojiao

论文的扩展里有提到这个应用,请问代码上怎么改造呢

Activity

  1. hzwer commented on Nov 23, 2022

    @hzwer
    Owner

    在 model/IFNet_m.py 里面把 timestep 改写一下

    timestep = (x[:, :1].clone() * 0 + 1) 
    n, c, h, w = x.shape
    _, XXs = np.mgrid[:h, :w]
    XXs = torch.from_numpy(XXs[:,:,np.newaxis]).permute(2, 0, 1).float()[None].to(device)
    timestep = XXs * timestep / XXs.max()
    

    这样应该就创建了一个渐变的 temporal encoding

  2. qijiaojiao commented on Nov 28, 2022

    @qijiaojiao
    Author

    在 model/IFNet_m.py 里面把 timestep 改写一下

    timestep = (x[:, :1].clone() * 0 + 1) 
    n, c, h, w = x.shape
    _, XXs = np.mgrid[:h, :w]
    XXs = torch.from_numpy(XXs[:,:,np.newaxis]).permute(2, 0, 1).float()[None].to(device)
    timestep = XXs * timestep / XXs.max()
    

    这样应该就创建了一个渐变的 temporal encoding

    您好,我用rife_m,修改了ifnet_m中如上您给的代码,然后参照论文Fig8做的图片I0 I1(基于demo里的两张图片进行了左右侧裁剪),出来的中间帧图片是一片混乱的像素,可以帮忙看下什么问题吗?
    rife_m推理如下:
    img_list = [img0]
    p = 2 ** args.exp
    for i in range(p-1):
    t = (i+1)*(1./p)
    print(t)
    img_list.append(model.inference(img0, img1, timestep=t))
    img_list.append(img1)

  3. hzwer commented on Nov 28, 2022

    @hzwer
    Owner

    我试了一下,用目前的 RIFEm 模型,对这两张图片做插帧会出一片蓝色,具体原因可能是模型无法适应镜头移动,我猜测训练的时候如果加一些镜头移动的增广能修复,很抱歉我之前没有注意到

    改用 practical RIFE 里的模型,用 v4.6 模型 https://github.com/hzwer/Practical-RIFE#usage ,可以得到正常的结果

    输入(左右各裁剪 32 pixel):
    img0
    img2

    输出:
    img1

    我的 timestep 生成方式:

    n, c, h, w = x.shape
    XXs, YYs = np.mgrid[:h, :w]
    XXs = torch.from_numpy(XXs[np.newaxis, np.newaxis, :,:]).float().to(device)
    YYs = torch.from_numpy(YYs[np.newaxis, np.newaxis, :,:]).float().to(device)
    timestep = YYs / YYs.max()
    
  4. qijiaojiao commented on Dec 1, 2022

    @qijiaojiao
    Author

    谢谢了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions