Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
010256f
第一次提交
STF-Zero Dec 20, 2024
8f0fa2d
第一次提交
STF-Zero Dec 20, 2024
457fe73
上传评价指标计算函数目录PingJia
STF-Zero Dec 20, 2024
cb8a6f4
在MP4目录下添加所有测试视频的原视频
STF-Zero Dec 20, 2024
427f841
补上May姨的MP4文件
STF-Zero Dec 20, 2024
a25983d
补提交May.Mp4
STF-Zero Dec 20, 2024
cc7aec9
删除《新建文件夹》目录
STF-Zero Dec 20, 2024
fa9c809
Obama2的NIQE更新
STF-Zero Dec 20, 2024
09a0965
NIQE计算逻辑的更新,增加了对图片尺寸的统一,均为512*512
STF-Zero Dec 20, 2024
506eaa7
上传了Lieu的NIQE值
STF-Zero Dec 20, 2024
95e3eba
niqe.py增加注释,增加Jae-in的定性评估帧间图片
STF-Zero Dec 20, 2024
dc0d3a2
Macron的NIQE更新
STF-Zero Dec 20, 2024
a66a61e
Obama的NIQE更新
STF-Zero Dec 20, 2024
61dc564
修改了PSNR和SSIM的计算逻辑,更新了Jae-in的PSNR和SSIM值
STF-Zero Dec 20, 2024
7103d57
很多PSNR、SSIM的更新,Obama、Obama1、Obama2的NIQE
STF-Zero Dec 20, 2024
9f6034c
删除一个错误文件
STF-Zero Dec 20, 2024
e236be4
添加了May和Shaheen的PSNR、SSIM和NIQE
Dec 20, 2024
d642099
修改了FID计算逻辑,并生成了Jae-in的所有帧图形以作计算准备
STF-Zero Dec 21, 2024
d0b6b3a
增加了LSE-C和LSE-D的计算代码,并更新了所有测试数据的LSE值
STF-Zero Dec 21, 2024
712f3c3
上传了LSE计算的代码
STF-Zero Dec 21, 2024
ced4536
编写Dockerfile和环境yml,更新了所有测试视频的FID值
STF-Zero Dec 21, 2024
84369f1
项目dockerfile和说明提交
endorphin-naixu Dec 21, 2024
f5a7e22
整合代码至Evaluate/main.py中,编写Dockerfile
STF-Zero Dec 21, 2024
4e2666b
docker
STF-Zero Dec 21, 2024
f9da2b6
最后修改
STF-Zero Dec 21, 2024
b19d284
LMD评价方式
endorphin-naixu Dec 21, 2024
1ce83c2
Merge branch 'main' of github.com:STF-Zero/talkingface-kit
endorphin-naixu Dec 21, 2024
63aaca9
readme.md更新
STF-Zero Dec 21, 2024
b4c0116
LMD
endorphin-naixu Dec 22, 2024
0231638
Merge branch 'main' of github.com:STF-Zero/talkingface-kit
endorphin-naixu Dec 22, 2024
002ff4e
将lmd整合进镜像
STF-Zero Dec 22, 2024
67edf4e
dockerfile更新
STF-Zero Dec 22, 2024
6a35a85
最终整合版本的dockerfile和requirements.txt
STF-Zero Dec 23, 2024
80ec79c
应该是最后更新dockerfile
STF-Zero Dec 23, 2024
4a483b6
忘记改main.py了。。
STF-Zero Dec 23, 2024
d34f68f
evaluate的readme更新docker run的命令
STF-Zero Dec 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added hallo_root/Innovation/LMD_evaluate/0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added hallo_root/Innovation/LMD_evaluate/1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions hallo_root/Innovation/LMD_evaluate/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 配置说明

建议使用Anaconda构建虚拟环境,另外如果在构建dlib时报错,注意检查是否安装cmake,dlib的构建基础是cmake。

# 算法说明

## 原理介绍
LMD 的核心思想是通过比较生成图像(或视频帧)中的关键点(landmarks)和对应真实图像中的关键点,来量化生成结果与真实目标之间的差异。关键点通常指的是脸部关键点,比如眼睛、鼻子、嘴巴等部位的位置。算法分为以下几个步骤:
1. 关键点提取
使用预训练的面部关键点检测模型(dlib 的 shape_predictor_68_face_landmarks.dat权重文件),从生成的图像和真实图像中提取一组面部关键点坐标。每个关键点坐标表示为二维平面上的点 $(x, y)$。
2. 距离计算
对应的关键点之间的欧氏距离被用来衡量生成结果与真实目标的相似度。
$$
d_i = \sqrt{(x_i^{\text{gen}} - x_i^{\text{real}})^2 + (y_i^{\text{gen}} - y_i^{\text{real}})^2}
$$
3. 平均距离
将所有关键点的距离取平均,得到 LMD 值:
$$
\text{LMD} = \frac{1}{N} \sum_{i=1}^{N} d_i
$$
## 测试效果
我们对测试集中的jae-in.mp4进行了测试,得到以下结果
![alt text](image.png)
理想情况下,LMD 越低越好,表示生成结果越接近真实。当前值 36.08 是偏高的,表明生成的面部动作和表情与真实视频差距较大。
## 问题分析
通常研究中,LMD 值应低于某个阈值(比如 10-15)才能被认为生成结果较为逼真。而我们在对hallo模型生成的视频进行测试后,发现所得到的LMD值都普遍偏大。这是因为LMD算法的原理是检测每一帧中人脸五官的相对距离,而hallo模型只根据一帧图像生成视频,这导致生成视频的人脸几乎是静止的,所以当原视频中人的头部动作幅度较大时,LMD值就会偏高。

<img src="0.gif" alt="GIF 1" width="400" height="400"> <img src="1.gif" alt="GIF 2" width="400" height="400">
Binary file added hallo_root/Innovation/LMD_evaluate/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions hallo_root/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# evaluate_root
Evaluate 目录中的main.py是进行评估值计算的统一接口,通过运行此python文件计算各评估指标

MP4 目录下,Hallo中存放的是Hallo项目生成的视频,Source中存放的是原视频

Dockerfile是评估的镜像构建文件

README.md 说明了评估镜像的具体获取和使用步骤

# image
Dockerfile是Hallo的可运行项目的镜像构建文件

README.md 说明了Hallo的可运行项目的具体获取和使用步骤

# Innovation
LMD_evaluate 目录中,存放了我们组使用的新评估指标LMD的相关说明
35 changes: 35 additions & 0 deletions hallo_root/evaluate_root/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 使用 NVIDIA 提供的 CUDA 镜像作为基础镜像
# FROM nvidia/cuda:12.7-base-ubuntu22.04
# FROM nvidia/cuda:12.7-devel-ubuntu22.04
FROM nvidia/cuda:11.8.0-base-ubuntu22.04

# 设置环境变量,避免交互式安装
ENV DEBIAN_FRONTEND=noninteractive

# 安装 Python 环境和其他依赖
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
build-essential \
cmake \
g++ \
libopenblas-dev \
libopencv-dev \
liblapack-dev \
libboost-all-dev \
git \
ffmpeg \
&& apt-get clean

# 设置工作目录
WORKDIR /app

# 复制项目文件到容器
COPY . /app/

# 安装 Python 包
RUN pip install --upgrade pip setuptools wheel
RUN pip install --no-cache-dir -r requirements.txt

# 安装 InsightFace
RUN pip install insightface
Binary file added hallo_root/evaluate_root/Evaluate.xlsx
Binary file not shown.
3 changes: 3 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/TestPython.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/image_metrics.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions hallo_root/evaluate_root/Evaluate/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions hallo_root/evaluate_root/Evaluate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# image_metrics
FID、LPIPS、NIQE、PSNR、SSIM
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 33 additions & 0 deletions hallo_root/evaluate_root/Evaluate/cal_lpips.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import lpips
from utils import tensor2img, img2tensor

'''
https://github.com/richzhang/PerceptualSimilarity

@inproceedings{zhang2018perceptual,
title={The Unreasonable Effectiveness of Deep Features as a Perceptual Metric},
author={Zhang, Richard and Isola, Phillip and Efros, Alexei A and Shechtman, Eli and Wang, Oliver},
booktitle={CVPR},
year={2018}
}
'''


loss_fn_alex = lpips.LPIPS(net='alex') # best forward scores
loss_fn_vgg = lpips.LPIPS(net='vgg') # closer to "traditional" perceptual loss, when used for optimization

if __name__ =='__main__':
import torch

img0 = torch.randn(1, 3, 64, 64) # image should be RGB, IMPORTANT: normalized to [-1,1]
img1 = torch.randn(1, 3, 64, 64)
d = loss_fn_alex(img0, img1)

print(d)

from skimage import io

clean = io.imread('clean/2762.png')
noisy = io.imread('noisy/2762.png')
print(loss_fn_alex(img2tensor(clean), img2tensor(noisy)))
print(loss_fn_vgg(img2tensor(clean), img2tensor(noisy)))
Loading