Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化推理效果的讨论 #107

Open
tailangjun opened this issue May 4, 2024 · 23 comments
Open

优化推理效果的讨论 #107

tailangjun opened this issue May 4, 2024 · 23 comments

Comments

@tailangjun
Copy link

tailangjun commented May 4, 2024

通过几个月的训练,踩过不少坑,终于把整个流程都走通了,下面是中文推理效果

Celebrity_._facial_dubbing_add_audio.mp4

目前还存在几个大问题,这里做一下总结

  1. 生成区域抖动严重
  2. 生成区域色差问题
  3. 生成区域边框裁剪
@tailangjun
Copy link
Author

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

@tailangjun
Copy link
Author

  1. 生成区域色差问题?
    这个问题应该是推理视频和数据集色彩较大导致,后面丰富数据集应该会有改善

@tailangjun
Copy link
Author

tailangjun commented May 4, 2024

  1. 生成区域边框裁剪?
    我们目前的做法是用 frame_landmark生成一个凸多边形,作为 mask和 frame_data做运算,有些时候边框裁剪不太干净,不知道是 frame_landmark的点不太准,还是 frame_landmark的点太少。openface和 dlib都是 68个特征点,mediapippe是468个特征点。三种方法我都尝试过,发现没法彻底根除。然后我思考了一下这个问题的本质,这是问题 2色差问题衍生出来的问题,如果问题 2改善了,这个问题应该也会得到改善

@Inferencer
Copy link

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

You can set the crop-radius
I print the crop radius it detects for example frame 1 is 64, frames 2 crop radius is 68
Then I run it again with a crop radius of 64

Crop_radius_example1.mp4

@tailangjun
Copy link
Author

tailangjun commented May 5, 2024

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

You can set the crop-radius I print the crop radius it detects for example frame 1 is 64, frames 2 crop radius is 68 Then I run it again with a crop radius of 64

Crop_radius_example1.mp4

我改用 min_crop_radius后确实好一些了,非常感谢。另外问一下,预处理的时候用到 compute_crop_radius的地方是不是也得修改

Celebrity_._facial_dubbing_add_audio.mp4

@tailangjun
Copy link
Author

tailangjun commented May 9, 2024

发现推理出来的脸部比原脸要胖一些,高度要短一些,不知道是啥原因导致的。这应该也是代码中要用 random_scale = random.random() / 10 + 1.05来盖住原下巴的原因吧

random_scale = 1.0的效果
https://github.com/MRzzm/DINet/assets/12316965/851a46e4-6caa-47f2-9b6d-b9f22930151a

random_scale = 1.05的效果
https://github.com/MRzzm/DINet/assets/12316965/6ef68925-8c7d-41d6-81d7-02bbede9e4a3

random_scale = 1.1的效果
https://github.com/MRzzm/DINet/assets/12316965/7c6c5d9b-e6e4-4b3b-875c-8252d47ee77b

random_scale = 1.15的效果
https://github.com/MRzzm/DINet/assets/12316965/8293a457-2f57-4a4d-a394-80ed9c08f7ed

@flysky126
Copy link

你是按照源代码的训练方式训的吗? 源代码训练太慢

@tailangjun
Copy link
Author

你是按照源代码的训练方式训的吗? 源代码训练太慢

差不多,但是预处理代码做了一些修改

@Inferencer
Copy link

发现推理出来的脸部比原脸要胖一些,高度要短一些,不知道是啥原因导致的。这应该也是代码中要用 random_scale = random.random() / 10 + 1.05来盖住原下巴的原因吧

random_scale = 1.0的效果 https://github.com/MRzzm/DINet/assets/12316965/851a46e4-6caa-47f2-9b6d-b9f22930151a

random_scale = 1.05的效果 https://github.com/MRzzm/DINet/assets/12316965/6ef68925-8c7d-41d6-81d7-02bbede9e4a3

random_scale = 1.1的效果 https://github.com/MRzzm/DINet/assets/12316965/7c6c5d9b-e6e4-4b3b-875c-8252d47ee77b

random_scale = 1.15的效果 https://github.com/MRzzm/DINet/assets/12316965/8293a457-2f57-4a4d-a394-80ed9c08f7ed

thanks for comparison I have removed randomness in my repo LipSick and set this to 1.1 hopefully that works well, I had to stop using random as the crop radius results i print kept changing and I needed consistency

@tailangjun
Copy link
Author

发现推理出来的脸部比原脸要胖一些,高度要短一些,不知道是啥原因导致的。这应该也是代码中要用 random_scale = random.random() / 10 + 1.05来盖住原下巴的原因吧
random_scale = 1.0的效果 https://github.com/MRzzm/DINet/assets/12316965/851a46e4-6caa-47f2-9b6d-b9f22930151a
random_scale = 1.05的效果 https://github.com/MRzzm/DINet/assets/12316965/6ef68925-8c7d-41d6-81d7-02bbede9e4a3
random_scale = 1.1的效果 https://github.com/MRzzm/DINet/assets/12316965/7c6c5d9b-e6e4-4b3b-875c-8252d47ee77b
random_scale = 1.15的效果 https://github.com/MRzzm/DINet/assets/12316965/8293a457-2f57-4a4d-a394-80ed9c08f7ed

thanks for comparison I have removed randomness in my repo LipSick and set this to 1.1 hopefully that works well, I had to stop using random as the crop radius results i print kept changing and I needed consistency

嗯,我觉得单纯修改 random_scale还不能完全消除原来的下巴,特别是在脸部边缘有阴影的情况下,我在尝试加一些图像处理的逻辑以实现彻底消除

@jinwonkim93
Copy link

did you reproduced syncnet?

@wning13
Copy link

wning13 commented May 10, 2024

  1. 生成区域色差问题?
    这个问题应该是推理视频和数据集色彩较大导致,后面丰富数据集应该会有改善

可以用推理的视频先做下finetune,应该会好一些

@wning13
Copy link

wning13 commented May 10, 2024

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

可以试试landmark结合光流法平滑处理,我在nerf类的项目里见到过这样的做法。

@Inferencer
Copy link

You are right it won't fix the chin, an experiment you can try since you are using open-face csv is track the face, then in a video editor move the person in the video slightly higher or slower so the video is still 1920x1080 but now you have a black bar either below or on top.
I did this experiment a long time ago but can't remember the results.

@tailangjun
Copy link
Author

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

可以试试landmark结合光流法平滑处理,我在nerf类的项目里见到过这样的做法。

请问是 GeneFace++还是 ER-Nerf等

@einsqing
Copy link

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

可以试试landmark结合光流法平滑处理,我在nerf类的项目里见到过这样的做法。

请问是 GeneFace++还是 ER-Nerf等

synctalk

@tailangjun
Copy link
Author

tailangjun commented May 10, 2024

synctalk

收到,非常感谢,是不是那个 vis_parsing_maps函数呀,我学习一下

@tailangjun
Copy link
Author

  1. 生成区域色差问题?
    这个问题应该是推理视频和数据集色彩较大导致,后面丰富数据集应该会有改善

可以用推理的视频先做下finetune,应该会好一些

嗯,finetune肯定是可以的,我在想有没有更省事的方法

@tailangjun
Copy link
Author

did you reproduced syncnet?

是的,要支持中文的话得自己训练 syncnet

@sunjian2015
Copy link

min_crop_radius

你好,请问openface是在Linux上使用的吗?需要用哪些命令选项啊?还有个问题,那个 min_crop_radius 是在哪个地方修改的呢?感谢

@tailangjun
Copy link
Author

min_crop_radius

你好,请问openface是在Linux上使用的吗?需要用哪些命令选项啊?还有个问题,那个 min_crop_radius 是在哪个地方修改的呢?感谢

Linux上可以使用 FeatureExtraction,具体参数可以到官网查

@sunjian2015
Copy link

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

You can set the crop-radius I print the crop radius it detects for example frame 1 is 64, frames 2 crop radius is 68 Then I run it again with a crop radius of 64
Crop_radius_example1.mp4

我改用 min_crop_radius后确实好一些了,非常感谢。另外问一下,预处理的时候用到 compute_crop_radius的地方是不是也得修改

Celebrity_._facial_dubbing_add_audio.mp4

这个不就是改 compute_crop_radius 这个地方吗?其他的地方也没有 crop_radius 相关的呀

@tailangjun
Copy link
Author

  1. 生成区域抖动严重?
    这个问题我最开始怀疑的是 openface获取到的 landmark不准,但是换成 dlib后没啥变化。然后我怀疑是不是 landmark数据从 float转为 np.int32后导致的,但是数组的下标只能是整数,这条路也走不通。接着我怀疑是不是 compute_crop_radius的random_scale = random.random() / 10 + 1.05 采用随机数导致,尝试改成 1.1也没有大的改善。

You can set the crop-radius I print the crop radius . It detects for example frame 1 is 64, frame 2 crop radius is 68 Then I run it again with a crop radius of 64
Crop_radius_example1.mp4

我改用 min_crop_radius后确实好一些了,非常感谢。另外问一下,预处理的时候用到 compute_crop_radius的地方是不是也得修改
Celebrity_._facial_dubbing_add_audio.mp4

这个不就是改 compute_crop_radius 这个地方吗?其他的地方也没有 crop_radius 相关的呀

data_processing.py中也有调用 compute_crop_radius的,我觉得比较好的改法是将 random_scale的默认值直接写在定义中,外面默认就不用填 random_scale了
def compute_crop_radius(video_size,landmark_data_clip,random_scale = 1.10):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants