fffiloni commited on
Commit
6f199b8
·
verified ·
1 Parent(s): 87815bb

Migrated from GitHub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +38 -0
  2. EMTD_dataset/download.py +40 -0
  3. EMTD_dataset/echomimicv2_benchmark_url+start_timecode+end_timecode.txt +111 -0
  4. EMTD_dataset/preprocess.py +328 -0
  5. EMTD_dataset/ref_imgs_by_FLUX/man/0001.png +0 -0
  6. EMTD_dataset/ref_imgs_by_FLUX/man/0003.png +0 -0
  7. EMTD_dataset/ref_imgs_by_FLUX/man/0010.png +0 -0
  8. EMTD_dataset/ref_imgs_by_FLUX/man/0017.png +3 -0
  9. EMTD_dataset/ref_imgs_by_FLUX/man/0025.png +3 -0
  10. EMTD_dataset/ref_imgs_by_FLUX/man/0055.png +3 -0
  11. EMTD_dataset/ref_imgs_by_FLUX/man/0056.png +3 -0
  12. EMTD_dataset/ref_imgs_by_FLUX/man/0101.png +3 -0
  13. EMTD_dataset/ref_imgs_by_FLUX/man/0119.png +0 -0
  14. EMTD_dataset/ref_imgs_by_FLUX/man/0154.png +0 -0
  15. EMTD_dataset/ref_imgs_by_FLUX/man/0170.png +3 -0
  16. EMTD_dataset/ref_imgs_by_FLUX/man/0177.png +3 -0
  17. EMTD_dataset/ref_imgs_by_FLUX/man/0181.png +3 -0
  18. EMTD_dataset/ref_imgs_by_FLUX/man/0211.png +3 -0
  19. EMTD_dataset/ref_imgs_by_FLUX/man/0252.png +0 -0
  20. EMTD_dataset/ref_imgs_by_FLUX/man/0324.png +0 -0
  21. EMTD_dataset/ref_imgs_by_FLUX/man/0398.png +0 -0
  22. EMTD_dataset/ref_imgs_by_FLUX/man/0415.png +3 -0
  23. EMTD_dataset/ref_imgs_by_FLUX/man/0424.png +3 -0
  24. EMTD_dataset/ref_imgs_by_FLUX/man/1168.png +0 -0
  25. EMTD_dataset/ref_imgs_by_FLUX/woman/0010.png +3 -0
  26. EMTD_dataset/ref_imgs_by_FLUX/woman/0033.png +0 -0
  27. EMTD_dataset/ref_imgs_by_FLUX/woman/0035.png +3 -0
  28. EMTD_dataset/ref_imgs_by_FLUX/woman/0048.png +0 -0
  29. EMTD_dataset/ref_imgs_by_FLUX/woman/0057.png +3 -0
  30. EMTD_dataset/ref_imgs_by_FLUX/woman/0077.png +0 -0
  31. EMTD_dataset/ref_imgs_by_FLUX/woman/0101.png +3 -0
  32. EMTD_dataset/ref_imgs_by_FLUX/woman/0140.png +0 -0
  33. EMTD_dataset/ref_imgs_by_FLUX/woman/0163.png +3 -0
  34. EMTD_dataset/ref_imgs_by_FLUX/woman/0175.png +3 -0
  35. EMTD_dataset/ref_imgs_by_FLUX/woman/0201.png +3 -0
  36. EMTD_dataset/ref_imgs_by_FLUX/woman/0212.png +0 -0
  37. EMTD_dataset/ref_imgs_by_FLUX/woman/0215.png +0 -0
  38. EMTD_dataset/ref_imgs_by_FLUX/woman/0247.png +3 -0
  39. EMTD_dataset/ref_imgs_by_FLUX/woman/0253.png +3 -0
  40. EMTD_dataset/ref_imgs_by_FLUX/woman/0269.png +0 -0
  41. EMTD_dataset/ref_imgs_by_FLUX/woman/0284.png +3 -0
  42. EMTD_dataset/ref_imgs_by_FLUX/woman/0287.png +3 -0
  43. EMTD_dataset/ref_imgs_by_FLUX/woman/0430.png +0 -0
  44. EMTD_dataset/ref_imgs_by_FLUX/woman/0588.png +0 -0
  45. EMTD_dataset/slice.sh +6 -0
  46. LICENSE +201 -0
  47. ORIGINAL_README.md +262 -0
  48. app.py +277 -0
  49. assets/halfbody_demo/audio/chinese/echomimicv2_man.wav +0 -0
  50. assets/halfbody_demo/audio/chinese/echomimicv2_woman.wav +3 -0
.gitattributes CHANGED
@@ -33,3 +33,41 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ EMTD_dataset/ref_imgs_by_FLUX/man/0017.png filter=lfs diff=lfs merge=lfs -text
37
+ EMTD_dataset/ref_imgs_by_FLUX/man/0025.png filter=lfs diff=lfs merge=lfs -text
38
+ EMTD_dataset/ref_imgs_by_FLUX/man/0055.png filter=lfs diff=lfs merge=lfs -text
39
+ EMTD_dataset/ref_imgs_by_FLUX/man/0056.png filter=lfs diff=lfs merge=lfs -text
40
+ EMTD_dataset/ref_imgs_by_FLUX/man/0101.png filter=lfs diff=lfs merge=lfs -text
41
+ EMTD_dataset/ref_imgs_by_FLUX/man/0170.png filter=lfs diff=lfs merge=lfs -text
42
+ EMTD_dataset/ref_imgs_by_FLUX/man/0177.png filter=lfs diff=lfs merge=lfs -text
43
+ EMTD_dataset/ref_imgs_by_FLUX/man/0181.png filter=lfs diff=lfs merge=lfs -text
44
+ EMTD_dataset/ref_imgs_by_FLUX/man/0211.png filter=lfs diff=lfs merge=lfs -text
45
+ EMTD_dataset/ref_imgs_by_FLUX/man/0415.png filter=lfs diff=lfs merge=lfs -text
46
+ EMTD_dataset/ref_imgs_by_FLUX/man/0424.png filter=lfs diff=lfs merge=lfs -text
47
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0010.png filter=lfs diff=lfs merge=lfs -text
48
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0035.png filter=lfs diff=lfs merge=lfs -text
49
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0057.png filter=lfs diff=lfs merge=lfs -text
50
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0101.png filter=lfs diff=lfs merge=lfs -text
51
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0163.png filter=lfs diff=lfs merge=lfs -text
52
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0175.png filter=lfs diff=lfs merge=lfs -text
53
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0201.png filter=lfs diff=lfs merge=lfs -text
54
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0247.png filter=lfs diff=lfs merge=lfs -text
55
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0253.png filter=lfs diff=lfs merge=lfs -text
56
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0284.png filter=lfs diff=lfs merge=lfs -text
57
+ EMTD_dataset/ref_imgs_by_FLUX/woman/0287.png filter=lfs diff=lfs merge=lfs -text
58
+ assets/halfbody_demo/audio/chinese/echomimicv2_woman.wav filter=lfs diff=lfs merge=lfs -text
59
+ assets/halfbody_demo/refimag/natural_bk_openhand/0014.png filter=lfs diff=lfs merge=lfs -text
60
+ assets/halfbody_demo/refimag/natural_bk_openhand/0035.png filter=lfs diff=lfs merge=lfs -text
61
+ assets/halfbody_demo/refimag/natural_bk_openhand/0047.png filter=lfs diff=lfs merge=lfs -text
62
+ assets/halfbody_demo/refimag/natural_bk_openhand/0057.png filter=lfs diff=lfs merge=lfs -text
63
+ assets/halfbody_demo/refimag/natural_bk_openhand/0066.png filter=lfs diff=lfs merge=lfs -text
64
+ assets/halfbody_demo/refimag/natural_bk_openhand/0082.png filter=lfs diff=lfs merge=lfs -text
65
+ assets/halfbody_demo/refimag/natural_bk_openhand/0140.png filter=lfs diff=lfs merge=lfs -text
66
+ assets/halfbody_demo/refimag/natural_bk_openhand/0163.png filter=lfs diff=lfs merge=lfs -text
67
+ assets/halfbody_demo/refimag/natural_bk_openhand/0175.png filter=lfs diff=lfs merge=lfs -text
68
+ assets/halfbody_demo/refimag/natural_bk_openhand/0213.png filter=lfs diff=lfs merge=lfs -text
69
+ assets/halfbody_demo/refimag/natural_bk_openhand/0216.png filter=lfs diff=lfs merge=lfs -text
70
+ assets/halfbody_demo/refimag/natural_bk_openhand/0222.png filter=lfs diff=lfs merge=lfs -text
71
+ assets/halfbody_demo/refimag/natural_bk_openhand/0247.png filter=lfs diff=lfs merge=lfs -text
72
+ assets/halfbody_demo/refimag/natural_bk_openhand/0303.png filter=lfs diff=lfs merge=lfs -text
73
+ assets/halfbody_demo/refimag/natural_bk_openhand/0315.png filter=lfs diff=lfs merge=lfs -text
EMTD_dataset/download.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python
2
+ # -*- coding: UTF-8 -*-
3
+
4
+ import os
5
+ '''
6
+ pip install youtube-dl==2020.12.12
7
+ '''
8
+ import subprocess
9
+ import pandas as pd
10
+
11
+ def download_youtube_video(video_url, output_path):
12
+ """
13
+ :param video_url: youtube video url
14
+ :param output_dir: file path to save
15
+ """
16
+ # video_url, output_path = info
17
+ try:
18
+ if not os.path.exists(os.path.dirname(output_path)):
19
+ os.makedirs(os.path.dirname(output_path), exist_ok=True)
20
+ # download command
21
+ command = ['yt-dlp', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]', '--merge-output-format',
22
+ 'mp4', '--output', output_path , video_url]
23
+ # subprocess.run
24
+ result = subprocess.run(command, capture_output=True, text=True, encoding='utf-8')
25
+
26
+ if result.returncode == 0:
27
+ print('Download {:s} successfully!'.format(video_url))
28
+ else:
29
+ print("Fail to download {:s}, error info:\n{:s}".format(video_url, result.stderr))
30
+ except Exception as e:
31
+ print(f"error: {e}")
32
+
33
+ if __name__ == '__main__':
34
+ df = pd.read_csv("./echomimicv2_benchmark_url+start_timecode+end_timecode.txt")
35
+ save_dir = "ori_video_dir"
36
+ urls = list(set(df['URL']))
37
+ video_output_paths = [os.path.join(save_dir, url.split('v=')[1]+".mp4") for url in urls]
38
+
39
+ for video_url, output_path in zip(urls, video_output_paths):
40
+ download_youtube_video(video_url, output_path)
EMTD_dataset/echomimicv2_benchmark_url+start_timecode+end_timecode.txt ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ URL,Start Timecode,End Timecode
2
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:00:54.596,00:01:01.561
3
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:02:04.207,00:02:11.006
4
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:03:06.103,00:03:13.819
5
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:03:51.231,00:03:56.445
6
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:05:39.047,00:05:43.677
7
+ https://www.youtube.com/watch?v=NBMTc71yrpk,00:07:14.851,00:07:22.734
8
+ https://www.youtube.com/watch?v=j4QlG5jKpio,00:02:31.777,00:02:41.328
9
+ https://www.youtube.com/watch?v=j4QlG5jKpio,00:04:10.750,00:04:31.146
10
+ https://www.youtube.com/watch?v=j4QlG5jKpio,00:06:25.135,00:06:38.231
11
+ https://www.youtube.com/watch?v=j4QlG5jKpio,00:08:32.554,00:08:39.144
12
+ https://www.youtube.com/watch?v=uEOK3fk45Rg,00:02:28.750,00:02:45.625
13
+ https://www.youtube.com/watch?v=uEOK3fk45Rg,00:05:36.167,00:05:51.167
14
+ https://www.youtube.com/watch?v=uEOK3fk45Rg,00:07:46.833,00:08:00.625
15
+ https://www.youtube.com/watch?v=uEOK3fk45Rg,00:09:51.708,00:10:00.250
16
+ https://www.youtube.com/watch?v=p8ReF00JP5w,00:02:10.417,00:02:18.583
17
+ https://www.youtube.com/watch?v=p8ReF00JP5w,00:05:09.583,00:05:19.708
18
+ https://www.youtube.com/watch?v=eIRtcspIH4U,00:04:43.950,00:05:59.025
19
+ https://www.youtube.com/watch?v=eIRtcspIH4U,00:07:35.664,00:08:19.916
20
+ https://www.youtube.com/watch?v=eIRtcspIH4U,00:10:17.867,00:10:32.924
21
+ https://www.youtube.com/watch?app=desktop&v=R7jm0-R9N_o,00:02:39.493,00:02:55.609
22
+ https://www.youtube.com/watch?app=desktop&v=R7jm0-R9N_o,00:04:15.088,00:04:41.114
23
+ https://www.youtube.com/watch?app=desktop&v=R7jm0-R9N_o,00:06:08.635,00:06:42.035
24
+ https://www.youtube.com/watch?app=desktop&v=R7jm0-R9N_o,00:08:08.288,00:08:19.532
25
+ https://www.youtube.com/watch?app=desktop&v=R7jm0-R9N_o,00:09:52.659,00:10:10.009
26
+ https://www.youtube.com/watch?app=desktop&v=whZmwSUMSVY,00:02:03.832,00:02:17.471
27
+ https://www.youtube.com/watch?app=desktop&v=whZmwSUMSVY,00:05:18.610,00:05:29.496
28
+ https://www.youtube.com/watch?app=desktop&v=whZmwSUMSVY,00:08:14.577,00:08:50.155
29
+ https://www.youtube.com/watch?app=desktop&v=8cF442d-EdQ,00:06:30.720,00:07:25.360
30
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:00:38.360,00:00:42.880
31
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:01:21.320,00:01:35.840
32
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:01:56.920,00:02:00.760
33
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:04:38.160,00:04:44.440
34
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:05:12.520,00:05:16.880
35
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:05:45.680,00:05:51.480
36
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:06:12.640,00:06:18.880
37
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:07:00.640,00:07:08.200
38
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:09:23.480,00:09:27.680
39
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:09:50.640,00:09:53.920
40
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:10:17.560,00:10:22.360
41
+ https://www.youtube.com/watch?v=U-BHz_UIOfs,00:10:49.880,00:10:58.000
42
+ https://www.youtube.com/watch?v=FpiWSFcL3-c,00:07:14.100,00:07:18.938
43
+ https://www.youtube.com/watch?v=FpiWSFcL3-c&t=355s,00:05:17.317,00:05:19.528
44
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:00:02.336,00:00:05.255
45
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:00:38.288,00:00:43.293
46
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:00:58.725,00:01:01.728
47
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:01:28.964,00:01:35.220
48
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:01:50.027,00:02:01.079
49
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:03:05.852,00:03:16.488
50
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:03:52.482,00:04:00.615
51
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:05:08.642,00:05:12.270
52
+ https://www.youtube.com/watch?v=4SCrXqbhmCY,00:05:32.624,00:05:35.627
53
+ https://www.youtube.com/watch?v=4c_xYLwOx-g,00:03:17.739,00:03:22.953
54
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:01:17.867,00:01:28.533
55
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:02:55.500,00:03:00.600
56
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:04:05.767,00:04:15.333
57
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:05:04.900,00:05:09.933
58
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:05:47.833,00:05:53.967
59
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:07:04.933,00:07:11.900
60
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:08:53.767,00:09:16.367
61
+ https://www.youtube.com/watch?v=rVNb53lkBuc,00:11:40.333,00:11:45.500
62
+ https://www.youtube.com/watch?v=PZr142ka96k,00:00:58.141,00:01:00.477
63
+ https://www.youtube.com/watch?v=PZr142ka96k,00:03:11.358,00:03:17.030
64
+ https://www.youtube.com/watch?v=6UiU99_tE7I,00:00:05.923,00:00:10.385
65
+ https://www.youtube.com/watch?v=6UiU99_tE7I,00:00:48.215,00:00:51.343
66
+ https://www.youtube.com/watch?v=6UiU99_tE7I,00:02:36.531,00:02:40.077
67
+ https://www.youtube.com/watch?v=6UiU99_tE7I,00:04:08.498,00:04:17.299
68
+ https://www.youtube.com/watch?v=MByKyFt7hZI,00:00:11.637,00:00:16.350
69
+ https://www.youtube.com/watch?v=MByKyFt7hZI,00:02:46.958,00:03:02.432
70
+ https://www.youtube.com/watch?v=MByKyFt7hZI,00:03:54.568,00:03:58.488
71
+ https://www.youtube.com/watch?v=VU44eEKtcmQ,00:00:34.117,00:00:39.957
72
+ https://www.youtube.com/watch?v=VU44eEKtcmQ,00:01:50.819,00:01:56.616
73
+ https://www.youtube.com/watch?v=VU44eEKtcmQ,00:03:14.694,00:03:18.990
74
+ https://www.youtube.com/watch?v=Dvhu2OK7ffg,00:01:53.905,00:01:56.992
75
+ https://www.youtube.com/watch?v=Dvhu2OK7ffg,00:04:51.333,00:04:58.381
76
+ https://www.youtube.com/watch?v=s0H1jxF5TWQ,00:01:55.699,00:01:58.452
77
+ https://www.youtube.com/watch?v=x672EKnKLtA,00:00:55.389,00:01:01.895
78
+ https://www.youtube.com/watch?v=Z3HJCQJ2Lmo,00:01:36.240,00:01:39.520
79
+ https://www.youtube.com/watch?v=40TumEHQk8A,00:01:43.020,00:01:46.690
80
+ https://www.youtube.com/watch?v=rXxUCeRVma4,00:02:51.880,00:02:58.887
81
+ https://www.youtube.com/watch?v=v6mknkg7MEc,00:03:26.080,00:03:36.000
82
+ https://www.youtube.com/watch?v=v6mknkg7MEc,00:06:09.880,00:06:32.120
83
+ https://www.youtube.com/watch?v=v6mknkg7MEc,00:09:30.960,00:09:40.240
84
+ https://www.youtube.com/watch?v=ixBgCWLVvE8,00:02:38.300,00:03:05.133
85
+ https://www.youtube.com/watch?v=ixBgCWLVvE8,00:04:37.033,00:04:43.833
86
+ https://www.youtube.com/watch?v=TQ2f4sJVXAI,00:01:22.900,00:01:47.133
87
+ https://www.youtube.com/watch?v=dZtnOnqcDN4,00:00:48.067,00:01:12.667
88
+ https://www.youtube.com/watch?v=dZtnOnqcDN4,00:04:09.833,00:04:23.867
89
+ https://www.youtube.com/watch?v=dZtnOnqcDN4,00:07:25.733,00:07:52.067
90
+ https://www.youtube.com/watch?v=dZtnOnqcDN4,00:09:41.000,00:10:02.233
91
+ https://www.youtube.com/watch?v=-Hmn5Gmn2dw,00:04:40.208,00:04:49.458
92
+ https://www.youtube.com/watch?v=x1Efv_wF5LE,00:05:35.833,00:05:41.733
93
+ https://www.youtube.com/watch?v=VHMYl70ibHQ,00:03:41.500,00:04:15.833
94
+ https://www.youtube.com/watch?v=fua_rUk0zk0,00:06:47.867,00:07:11.433
95
+ https://www.youtube.com/watch?v=SfROjZlyg7o,00:03:26.400,00:03:38.960
96
+ https://www.youtube.com/watch?v=SfROjZlyg7o,00:06:22.240,00:06:44.160
97
+ https://www.youtube.com/watch?v=wBRqxBvBWQE,00:10:13.208,00:10:32.125
98
+ https://www.youtube.com/watch?v=0BF2Np5J6jY,00:02:51.280,00:02:58.920
99
+ https://www.youtube.com/watch?v=0BF2Np5J6jY,00:04:57.040,00:05:16.680
100
+ https://www.youtube.com/watch?v=0BF2Np5J6jY,00:07:33.400,00:07:43.240
101
+ https://www.youtube.com/watch?v=0BF2Np5J6jY,00:09:45.560,00:09:59.680
102
+ https://www.youtube.com/watch?v=5FCPLlF6P4g,00:01:46.280,00:01:54.880
103
+ https://www.youtube.com/watch?v=5FCPLlF6P4g,00:03:22.200,00:03:41.640
104
+ https://www.youtube.com/watch?v=5FCPLlF6P4g,00:05:05.400,00:05:16.160
105
+ https://www.youtube.com/watch?v=5FCPLlF6P4g,00:06:52.480,00:07:05.360
106
+ https://www.youtube.com/watch?v=-BR9P4E7liU,00:01:52.320,00:02:03.360
107
+ https://www.youtube.com/watch?v=-BR9P4E7liU,00:05:05.760,00:05:17.000
108
+ https://www.youtube.com/watch?v=pxeJxyCiOJo,00:02:48.320,00:03:08.920
109
+ https://www.youtube.com/watch?v=dKmHLAKQ5PI,00:05:55.337,00:06:01.998
110
+ https://www.youtube.com/watch?app=desktop&v=lJUrQKY_A5g,00:04:36.208,00:04:50.958
111
+ https://www.youtube.com/watch?app=desktop&v=lJUrQKY_A5g,00:08:21.583,00:08:43.042
EMTD_dataset/preprocess.py ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ from src.utils.img_utils import pil_to_cv2, cv2_to_pil, center_crop_cv2, pils_from_video, save_videos_from_pils, save_video_from_cv2_list
4
+ from PIL import Image
5
+ import cv2
6
+ from IPython import embed
7
+ import numpy as np
8
+ import copy
9
+ from src.utils.motion_utils import motion_sync
10
+ import pathlib
11
+ import torch
12
+ import pickle
13
+ from glob import glob
14
+ import os
15
+ from src.models.dwpose.dwpose_detector import dwpose_detector as dwprocessor
16
+ from src.models.dwpose.util import draw_pose
17
+ import decord
18
+ from tqdm import tqdm
19
+ from moviepy.editor import AudioFileClip, VideoFileClip
20
+ from multiprocessing.pool import ThreadPool
21
+
22
+ ##################################
23
+ base_dir = "root"
24
+ tasks = ["emtd"]
25
+
26
+ process_num = 800 #1266
27
+
28
+ start = 0
29
+ end = process_num + start
30
+ #################################
31
+ MAX_SIZE = 768
32
+
33
+
34
+ def convert_fps(src_path, tgt_path, tgt_fps=24, tgt_sr=16000):
35
+ clip = VideoFileClip(src_path)
36
+ new_clip = clip.set_fps(tgt_fps)
37
+ if tgt_fps is not None:
38
+ audio = new_clip.audio
39
+ audio = audio.set_fps(tgt_sr)
40
+ new_clip = new_clip.set_audio(audio)
41
+
42
+ new_clip.write_videofile(tgt_path, codec='libx264', audio_codec='aac')
43
+
44
+ def get_video_pose(
45
+ video_path: str,
46
+ sample_stride: int=1,
47
+ max_frame=None):
48
+
49
+ # read input video
50
+ vr = decord.VideoReader(video_path, ctx=decord.cpu(0))
51
+ sample_stride *= max(1, int(vr.get_avg_fps() / 24))
52
+
53
+ frames = vr.get_batch(list(range(0, len(vr), sample_stride))).asnumpy()
54
+ if max_frame is not None:
55
+ frames = frames[0:max_frame,:,:]
56
+ height, width, _ = frames[0].shape
57
+ # detected_poses = [dwprocessor(frm) for frm in tqdm(frames, desc="DWPose")]
58
+ detected_poses = [dwprocessor(frm) for frm in frames]
59
+ dwprocessor.release_memory()
60
+
61
+ return detected_poses, height, width, frames
62
+
63
+ def resize_and_pad(img, max_size):
64
+ img_new = np.zeros((max_size, max_size, 3)).astype('uint8')
65
+ imh, imw = img.shape[0], img.shape[1]
66
+ half = max_size // 2
67
+ if imh > imw:
68
+ imh_new = max_size
69
+ imw_new = int(round(imw/imh * imh_new))
70
+ half_w = imw_new // 2
71
+ rb, re = 0, max_size
72
+ cb = half-half_w
73
+ ce = cb + imw_new
74
+ else:
75
+ imw_new = max_size
76
+ imh_new = int(round(imh/imw * imw_new))
77
+ half_h = imh_new // 2
78
+ cb, ce = 0, max_size
79
+ rb = half-half_h
80
+ re = rb + imh_new
81
+
82
+ img_resize = cv2.resize(img, (imw_new, imh_new))
83
+ img_new[rb:re,cb:ce,:] = img_resize
84
+ return img_new
85
+
86
+ def resize_and_pad_param(imh, imw, max_size):
87
+ half = max_size // 2
88
+ if imh > imw:
89
+ imh_new = max_size
90
+ imw_new = int(round(imw/imh * imh_new))
91
+ half_w = imw_new // 2
92
+ rb, re = 0, max_size
93
+ cb = half-half_w
94
+ ce = cb + imw_new
95
+ else:
96
+ imw_new = max_size
97
+ imh_new = int(round(imh/imw * imw_new))
98
+ imh_new = max_size
99
+
100
+ half_h = imh_new // 2
101
+ cb, ce = 0, max_size
102
+ rb = half-half_h
103
+ re = rb + imh_new
104
+
105
+ return imh_new, imw_new, rb, re, cb, ce
106
+
107
+ def get_pose_params(detected_poses, max_size):
108
+ print('get_pose_params...')
109
+ # pose rescale
110
+ w_min_all, w_max_all, h_min_all, h_max_all = [], [], [], []
111
+ mid_all = []
112
+ for num, detected_pose in enumerate(detected_poses):
113
+ detected_poses[num]['num'] = num
114
+ candidate_body = detected_pose['bodies']['candidate']
115
+ score_body = detected_pose['bodies']['score']
116
+ candidate_face = detected_pose['faces']
117
+ score_face = detected_pose['faces_score']
118
+ candidate_hand = detected_pose['hands']
119
+ score_hand = detected_pose['hands_score']
120
+
121
+ # 选取置信度最高的face
122
+ if candidate_face.shape[0] > 1:
123
+ index = 0
124
+ candidate_face = candidate_face[index]
125
+ score_face = score_face[index]
126
+ detected_poses[num]['faces'] = candidate_face.reshape(1, candidate_face.shape[0], candidate_face.shape[1])
127
+ detected_poses[num]['faces_score'] = score_face.reshape(1, score_face.shape[0])
128
+ else:
129
+ candidate_face = candidate_face[0]
130
+ score_face = score_face[0]
131
+
132
+ # 选取置信度最高的body
133
+ if score_body.shape[0] > 1:
134
+ tmp_score = []
135
+ for k in range(0, score_body.shape[0]):
136
+ tmp_score.append(score_body[k].mean())
137
+ index = np.argmax(tmp_score)
138
+ candidate_body = candidate_body[index*18:(index+1)*18,:]
139
+ score_body = score_body[index]
140
+ score_hand = score_hand[(index*2):(index*2+2),:]
141
+ candidate_hand = candidate_hand[(index*2):(index*2+2),:,:]
142
+ else:
143
+ score_body = score_body[0]
144
+ all_pose = np.concatenate((candidate_body, candidate_face))
145
+ all_score = np.concatenate((score_body, score_face))
146
+ all_pose = all_pose[all_score>0.8]
147
+
148
+
149
+ body_pose = np.concatenate((candidate_body,))
150
+ mid_ = body_pose[1, 0]
151
+
152
+
153
+ face_pose = candidate_face
154
+ hand_pose = candidate_hand
155
+
156
+
157
+ h_min, h_max = np.min(face_pose[:,1]), np.max(body_pose[:7,1])
158
+
159
+ h_ = h_max - h_min
160
+
161
+ mid_w = mid_
162
+ w_min = mid_w - h_ // 2
163
+ w_max = mid_w + h_ // 2
164
+
165
+ w_min_all.append(w_min)
166
+ w_max_all.append(w_max)
167
+ h_min_all.append(h_min)
168
+ h_max_all.append(h_max)
169
+ mid_all.append(mid_w)
170
+
171
+ w_min = np.min(w_min_all)
172
+ w_max = np.max(w_max_all)
173
+ h_min = np.min(h_min_all)
174
+ h_max = np.max(h_max_all)
175
+ mid = np.mean(mid_all)
176
+ print(mid)
177
+
178
+ margin_ratio = 0.25
179
+ h_margin = (h_max-h_min)*margin_ratio
180
+
181
+ h_min = max(h_min-h_margin*0.65, 0)
182
+ h_max = min(h_max+h_margin*0.5, 1)
183
+
184
+ h_new = h_max - h_min
185
+
186
+ h_min_real = int(h_min*height)
187
+ h_max_real = int(h_max*height)
188
+ mid_real = int(mid*width)
189
+
190
+
191
+ height_new = h_max_real-h_min_real+1
192
+ width_new = height_new
193
+ w_min_real = mid_real - height_new // 2
194
+
195
+ w_max_real = w_min_real + width_new
196
+ w_min = w_min_real / width
197
+ w_max = w_max_real / width
198
+
199
+ print(width_new, height_new)
200
+
201
+ imh_new, imw_new, rb, re, cb, ce = resize_and_pad_param(height_new, width_new, max_size)
202
+ res = {'draw_pose_params': [imh_new, imw_new, rb, re, cb, ce],
203
+ 'pose_params': [w_min, w_max, h_min, h_max],
204
+ 'video_params': [h_min_real, h_max_real, w_min_real, w_max_real],
205
+ }
206
+ return res
207
+
208
+ def save_pose_params_item(input_items):
209
+ detected_pose, pose_params, draw_pose_params, save_dir = input_items
210
+ w_min, w_max, h_min, h_max = pose_params
211
+ num = detected_pose['num']
212
+ candidate_body = detected_pose['bodies']['candidate']
213
+ candidate_face = detected_pose['faces'][0]
214
+ candidate_hand = detected_pose['hands']
215
+ candidate_body[:,0] = (candidate_body[:,0]-w_min)/(w_max-w_min)
216
+ candidate_body[:,1] = (candidate_body[:,1]-h_min)/(h_max-h_min)
217
+ candidate_face[:,0] = (candidate_face[:,0]-w_min)/(w_max-w_min)
218
+ candidate_face[:,1] = (candidate_face[:,1]-h_min)/(h_max-h_min)
219
+ candidate_hand[:,:,0] = (candidate_hand[:,:,0]-w_min)/(w_max-w_min)
220
+ candidate_hand[:,:,1] = (candidate_hand[:,:,1]-h_min)/(h_max-h_min)
221
+ detected_pose['bodies']['candidate'] = candidate_body
222
+ detected_pose['faces'] = candidate_face.reshape(1, candidate_face.shape[0], candidate_face.shape[1])
223
+ detected_pose['hands'] = candidate_hand
224
+ detected_pose['draw_pose_params'] = draw_pose_params
225
+ np.save(save_dir+'/'+str(num)+'.npy', detected_pose)
226
+
227
+ def save_pose_params(detected_poses, pose_params, draw_pose_params, ori_video_path):
228
+ save_dir = ori_video_path.replace('original_videos', 'image_audio_features/pose/')
229
+ if not os.path.exists(save_dir):
230
+ os.makedirs(save_dir)
231
+
232
+ input_list = []
233
+ for i, detected_pose in enumerate(detected_poses):
234
+ input_list.append([detected_pose, pose_params, draw_pose_params, save_dir])
235
+
236
+ pool = ThreadPool(8)
237
+ pool.map(save_pose_params_item, input_list)
238
+ pool.close()
239
+ pool.join()
240
+
241
+ def save_processed_video(ori_frames, video_params, ori_video_path, max_size):
242
+ save_path = ori_video_path.replace('original_videos', 'processed/video/')
243
+ save_dir = os.path.dirname(save_path)
244
+ if not os.path.exists(save_dir):
245
+ os.makedirs(save_dir)
246
+ h_min_real, h_max_real, w_min_real, w_max_real = video_params
247
+ video_frame_crop = []
248
+ for img in ori_frames:
249
+ img = img[h_min_real:h_max_real,w_min_real:w_max_real,:]
250
+ img = resize_and_pad(img, max_size=max_size)
251
+ video_frame_crop.append(img)
252
+ save_video_from_cv2_list(video_frame_crop, save_path, fps=24.0, rgb2bgr=True)
253
+ return video_frame_crop
254
+
255
+ def save_audio(ori_video_path, sub_task):
256
+ save_path = ori_video_path.replace('original_videos', 'processed/audio/')
257
+ save_dir = os.path.dirname(save_path)
258
+ save_path = save_path + '.wav'
259
+ if not os.path.exists(save_dir):
260
+ os.makedirs(save_dir)
261
+ ori_video_path = ori_video_path.replace(sub_task, sub_task+'_24fps')
262
+ audio_clip = AudioFileClip(ori_video_path)
263
+ audio_clip.write_audiofile(save_path)
264
+
265
+ def draw_pose_video(pose_params_path, save_path, max_size, ori_frames=None):
266
+ pose_files = os.listdir(pose_params_path)
267
+ # 生成Pose图cd pro
268
+ output_pose_img = []
269
+ for i in range(0, len(pose_files)):
270
+ pose_params_path_tmp = pose_params_path + '/' + str(i) + '.npy'
271
+ detected_pose = np.load(pose_params_path_tmp, allow_pickle=True).tolist()
272
+ imh_new, imw_new, rb, re, cb, ce = detected_pose['draw_pose_params']
273
+ im = draw_pose(detected_pose, imh_new, imw_new, ref_w=800)
274
+ im = np.transpose(np.array(im),(1,2,0))
275
+ img_new = np.zeros((max_size, max_size, 3)).astype('uint8')
276
+ img_new[rb:re,cb:ce,:] = im
277
+ if ori_frames is not None:
278
+ img_new = img_new * 0.6 + ori_frames[i] * 0.4
279
+ img_new = img_new.astype('uint8')
280
+ output_pose_img.append(img_new)
281
+
282
+ output_pose_img = np.stack(output_pose_img)
283
+ save_video_from_cv2_list(output_pose_img, save_path, fps=24.0, rgb2bgr=True)
284
+ print('save to ' + save_path)
285
+
286
+ visualization = False
287
+ for sub_task in tasks:
288
+
289
+ ori_list = os.listdir(base_dir+sub_task)[start:end]
290
+
291
+ mp4_list = ori_list
292
+
293
+ new_dir = base_dir+sub_task+'_24fps'
294
+ if not os.path.exists(new_dir):
295
+ os.makedirs(new_dir)
296
+ index = 1
297
+ for i, mp4_file in enumerate(mp4_list):
298
+ ori_video_path = base_dir+sub_task+'/'+mp4_file
299
+ if ori_video_path[-3:]=='mp4' or ori_video_path[-3:] =='MOV':
300
+ try:
301
+ # 转换祯率
302
+ ori_video_path_new = ori_video_path.replace(sub_task, sub_task+'_24fps')
303
+ if '.MOV' in ori_video_path_new:
304
+ ori_video_path_new.replace('.MOV', '.mp4')
305
+ convert_fps(ori_video_path, ori_video_path_new)
306
+ print([index+start, ori_video_path, start, end])
307
+ # 提取Pose
308
+ detected_poses, height, width, ori_frames = get_video_pose(ori_video_path_new, max_frame=None)
309
+ print(height, width)
310
+ # 提取相关参数
311
+ res_params = get_pose_params(detected_poses, MAX_SIZE)
312
+ # 存储Pose参数
313
+ save_pose_params(detected_poses, res_params['pose_params'], res_params['draw_pose_params'], ori_video_path)
314
+ # 存储截取视频
315
+ video_frame_crop = save_processed_video(ori_frames, res_params['video_params'], ori_video_path, MAX_SIZE)
316
+ # 存储音频
317
+ save_audio(ori_video_path, sub_task)
318
+ index += 1
319
+ if visualization:
320
+ # 绘制pose图
321
+ pose_params_path = ori_video_path.replace('original_videos', 'image_audio_features/pose')
322
+ save_path = "./vis_pose_results/" + os.path.basename(ori_video_path)
323
+ draw_pose_video(pose_params_path, save_path, ori_frames=video_frame_crop)
324
+ except:
325
+ print(["extract crash!", index+start, ori_video_path, start, end])
326
+ continue
327
+
328
+ print(["All Finished", sub_task, start, end])
EMTD_dataset/ref_imgs_by_FLUX/man/0001.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0003.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0010.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0017.png ADDED

Git LFS Details

  • SHA256: 9239e40e7d0c691a528815c7228d60ae1a22b3509f52ce318ba4c3931b754cb9
  • Pointer size: 132 Bytes
  • Size of remote file: 1.14 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0025.png ADDED

Git LFS Details

  • SHA256: b777ff1c40b3fd942c500dd64fcbb8bbc132c6fd042d4c21917ae4f1e1d50528
  • Pointer size: 132 Bytes
  • Size of remote file: 1.1 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0055.png ADDED

Git LFS Details

  • SHA256: cb2ddc3c9ca2d3c84ce9bacaae9d05ed7dae8026ba07374bf1033f88f3da4073
  • Pointer size: 132 Bytes
  • Size of remote file: 1.28 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0056.png ADDED

Git LFS Details

  • SHA256: ece281f1fae05062215df35754d783ebd2e41b392241d5f7b5032937d075e201
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0101.png ADDED

Git LFS Details

  • SHA256: 992fdfd853b1cfa388063332a95e2a2480f786384a31daeccd216d60c12515c4
  • Pointer size: 132 Bytes
  • Size of remote file: 1.17 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0119.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0154.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0170.png ADDED

Git LFS Details

  • SHA256: b139884688f1dd6e00c58aa9b7b11a0a86df9c05234c69454141d918e873d432
  • Pointer size: 132 Bytes
  • Size of remote file: 1.28 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0177.png ADDED

Git LFS Details

  • SHA256: 07545452d05dc56187294cda0fece15b6b3aa19d2cbfd033f8eeeff1daff4ddc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.12 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0181.png ADDED

Git LFS Details

  • SHA256: d42f2ca4c633f1d72fe1ec498dbf3d7e395f4da0763be7e3cbbb62a3ab6eb900
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0211.png ADDED

Git LFS Details

  • SHA256: ea834e25d2bc1c29b05d00c74bc85f6c408751862b1fce0026670c981ae96cf3
  • Pointer size: 132 Bytes
  • Size of remote file: 1.01 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0252.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0324.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0398.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/man/0415.png ADDED

Git LFS Details

  • SHA256: b1a7ccb254c8b913cccd2e32e666bbe34ed244a39899f1cf98daac4e68a8415c
  • Pointer size: 132 Bytes
  • Size of remote file: 1.2 MB
EMTD_dataset/ref_imgs_by_FLUX/man/0424.png ADDED

Git LFS Details

  • SHA256: 408e5eee36b984b9fb0556c364e90239994a023e91b1105d835fcfec42779008
  • Pointer size: 132 Bytes
  • Size of remote file: 1.17 MB
EMTD_dataset/ref_imgs_by_FLUX/man/1168.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0010.png ADDED

Git LFS Details

  • SHA256: ada109a5205aa2f00e28e1d5b8680e5ee7ece8b64946b4f58031258a2d8bee82
  • Pointer size: 132 Bytes
  • Size of remote file: 1.17 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0033.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0035.png ADDED

Git LFS Details

  • SHA256: abab1a5b68a5057fadc93539d2d2d4c147c695d1b523c9cb8573c18d6dd33fd4
  • Pointer size: 132 Bytes
  • Size of remote file: 1.07 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0048.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0057.png ADDED

Git LFS Details

  • SHA256: 08f2daaeef43506aa3d78b35b61788b6dad5c2e520c34867f4a6d46ed0172e2d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0077.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0101.png ADDED

Git LFS Details

  • SHA256: 923bb6897c7a6703d769a099534a1bc18786787f30af25891ebaf9a395e5d743
  • Pointer size: 132 Bytes
  • Size of remote file: 1.02 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0140.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0163.png ADDED

Git LFS Details

  • SHA256: 115e5737159f00e17f2caf5cb3d54d620c8a2dc4b82ba6a0c0ee870985f5a708
  • Pointer size: 132 Bytes
  • Size of remote file: 1.12 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0175.png ADDED

Git LFS Details

  • SHA256: 4f5e62c9bd0ce6d96ee116aa6868f9f019e68f559ffaf95beaf90be0ccd5f1e3
  • Pointer size: 132 Bytes
  • Size of remote file: 1.07 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0201.png ADDED

Git LFS Details

  • SHA256: f7948936cb2b6bf2f53d91989392562913ce2b776b7e5967ba5187019bc2f014
  • Pointer size: 132 Bytes
  • Size of remote file: 1.1 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0212.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0215.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0247.png ADDED

Git LFS Details

  • SHA256: 7dca620b9efc6938c2387cb97c9009d71e1ff9c6175748992361928302c61e7b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0253.png ADDED

Git LFS Details

  • SHA256: 8722b303e89a89709da982588024d9f0c0a5ed729aa0dd3a3150409c546606b2
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0269.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0284.png ADDED

Git LFS Details

  • SHA256: a5d96653613e86536173fa00e277bfd12c8f5ff5b7f432e50f2edd38826d3b75
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0287.png ADDED

Git LFS Details

  • SHA256: 2cfefd9dbab07d563d5d78c58fb26062610cf291c02648f351a3337344113614
  • Pointer size: 132 Bytes
  • Size of remote file: 1.09 MB
EMTD_dataset/ref_imgs_by_FLUX/woman/0430.png ADDED
EMTD_dataset/ref_imgs_by_FLUX/woman/0588.png ADDED
EMTD_dataset/slice.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ root=path_to_download_video_splits
2
+ target=path_to_save_sliced_videos
3
+ mkdir ${root}/${target}_segs
4
+ for file in $(ls ${root}/${target}/); do
5
+ scenedetect --input ${root}/${target}/${file} --output ${root}/${target}_segs/ detect-content split-video
6
+ done
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
ORIGINAL_README.md ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align='center'>EchoMimicV2: Towards Striking, Simplified, and Semi-Body Human Animation</h1>
2
+
3
+ <div align='center'>
4
+ <a href='https://github.com/mengrang' target='_blank'>Rang Meng</a><sup></sup>&emsp;
5
+ <a href='https://github.com/' target='_blank'>Xingyu Zhang</a><sup></sup>&emsp;
6
+ <a href='https://lymhust.github.io/' target='_blank'>Yuming Li</a><sup></sup>&emsp;
7
+ <a href='https://github.com/' target='_blank'>Chenguang Ma</a><sup></sup>
8
+ </div>
9
+
10
+
11
+ <div align='center'>
12
+ Terminal Technology Department, Alipay, Ant Group.
13
+ </div>
14
+ <br>
15
+ <div align='center'>
16
+ <a href='https://antgroup.github.io/ai/echomimic_v2/'><img src='https://img.shields.io/badge/Project-Page-blue'></a>
17
+ <a href='https://huggingface.co/BadToBest/EchoMimicV2'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Model-yellow'></a>
18
+ <!--<a href='https://antgroup.github.io/ai/echomimic_v2/'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Demo-yellow'></a>-->
19
+ <a href='https://modelscope.cn/models/BadToBest/EchoMimicV2'><img src='https://img.shields.io/badge/ModelScope-Model-purple'></a>
20
+ <!--<a href='https://antgroup.github.io/ai/echomimic_v2/'><img src='https://img.shields.io/badge/ModelScope-Demo-purple'></a>-->
21
+ <a href='https://arxiv.org/abs/2411.10061'><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a>
22
+ <a href='https://github.com/antgroup/echomimic_v2/blob/main/assets/halfbody_demo/wechat_group.png'><img src='https://badges.aleen42.com/src/wechat.svg'></a>
23
+ </div>
24
+ <div align='center'>
25
+ <a href='https://github.com/antgroup/echomimic_v2/discussions/53'><img src='https://img.shields.io/badge/English-Common Problems-orange'></a>
26
+ <a href='https://github.com/antgroup/echomimic_v2/discussions/40'><img src='https://img.shields.io/badge/中文版-常见问题汇总-orange'></a>
27
+ </div>
28
+
29
+ ## &#x1F680; EchoMimic Series
30
+ * EchoMimicV1: Lifelike Audio-Driven Portrait Animations through Editable Landmark Conditioning. [GitHub](https://github.com/antgroup/echomimic)
31
+ * EchoMimicV2: Towards Striking, Simplified, and Semi-Body Human Animation. [GitHub](https://github.com/antgroup/echomimic_v2)
32
+
33
+ ## &#x1F4E3; Updates
34
+ * [2024.11.27] 🔥 Thanks [AiMotionStudio](https://www.youtube.com/@AiMotionStudio) for the [installation tutorial](https://www.youtube.com/watch?v=2ab6U1-nVTQ).
35
+ * [2024.11.22] 🔥 [GradioUI](https://github.com/antgroup/echomimic_v2/blob/main/app.py) is now available. Thanks @gluttony-10 for the contribution.
36
+ * [2024.11.22] 🔥 [ComfyUI](https://github.com/smthemex/ComfyUI_EchoMimic) is now available. Thanks @smthemex for the contribution.
37
+ * [2024.11.21] 🔥 We release the EMTD dataset list and processing scripts.
38
+ * [2024.11.21] 🔥 We release our [EchoMimicV2](https://github.com/antgroup/echomimic_v2) codes and models.
39
+ * [2024.11.15] 🔥 Our [paper](https://arxiv.org/abs/2411.10061) is in public on arxiv.
40
+
41
+ ## &#x1F305; Gallery
42
+ ### Introduction
43
+ <table class="center">
44
+ <tr>
45
+ <td width=50% style="border: none">
46
+ <video controls loop src="https://github.com/user-attachments/assets/f544dfc0-7d1a-4c2c-83c0-608f28ffda25" muted="false"></video>
47
+ </td>
48
+ <td width=50% style="border: none">
49
+ <video controls loop src="https://github.com/user-attachments/assets/7f626b65-725c-4158-a96b-062539874c63" muted="false"></video>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+
54
+ ### English Driven Audio
55
+ <table class="center">
56
+ <tr>
57
+ <td width=100% style="border: none">
58
+ <video controls loop src="https://github.com/user-attachments/assets/3d5ac52c-62e4-41bc-8b27-96f005bbd781" muted="false"></video>
59
+ </td>
60
+ </tr>
61
+ </table>
62
+ <table class="center">
63
+ <tr>
64
+ <td width=30% style="border: none">
65
+ <video controls loop src="https://github.com/user-attachments/assets/e8dd6919-665e-4343-931f-54c93dc49a7d" muted="false"></video>
66
+ </td>
67
+ <td width=30% style="border: none">
68
+ <video controls loop src="https://github.com/user-attachments/assets/2a377391-a0d3-4a9d-8dde-cc59006e7e5b" muted="false"></video>
69
+ </td>
70
+ <td width=30% style="border: none">
71
+ <video controls loop src="https://github.com/user-attachments/assets/462bf3bb-0af2-43e2-a2dc-559e79953f3c" muted="false"></video>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <td width=30% style="border: none">
76
+ <video controls loop src="https://github.com/user-attachments/assets/0e988e7f-6346-4b54-9061-9cfc7a80e9c8" muted="false"></video>
77
+ </td>
78
+ <td width=30% style="border: none">
79
+ <video controls loop src="https://github.com/user-attachments/assets/56f739bd-afbf-4ed3-ab15-73a811c1bc46" muted="false"></video>
80
+ </td>
81
+ <td width=30% style="border: none">
82
+ <video controls loop src="https://github.com/user-attachments/assets/1b2f7827-111d-4fc0-a773-e1731bba285d" muted="false"></video>
83
+ </td>
84
+ </tr>
85
+ <tr>
86
+ <td width=30% style="border: none">
87
+ <video controls loop src="https://github.com/user-attachments/assets/a76b6cc8-89b9-4f7e-b1ce-c85a657b6dc7" muted="false"></video>
88
+ </td>
89
+ <td width=30% style="border: none">
90
+ <video controls loop src="https://github.com/user-attachments/assets/bf03b407-5033-4a30-aa59-b8680a515181" muted="false"></video>
91
+ </td>
92
+ <td width=30% style="border: none">
93
+ <video controls loop src="https://github.com/user-attachments/assets/f98b3985-572c-499f-ae1a-1b9befe3086f" muted="false"></video>
94
+ </td>
95
+ </tr>
96
+ </table>
97
+
98
+ ### Chinese Driven Audio
99
+ <table class="center">
100
+ <tr>
101
+ <td width=30% style="border: none">
102
+ <video controls loop src="https://github.com/user-attachments/assets/a940a332-2fd1-48e7-b3c4-f88f63fd1c9d" muted="false"></video>
103
+ </td>
104
+ <td width=30% style="border: none">
105
+ <video controls loop src="https://github.com/user-attachments/assets/8f185829-c67f-45f4-846c-fcbe012c3acf" muted="false"></video>
106
+ </td>
107
+ <td width=30% style="border: none">
108
+ <video controls loop src="https://github.com/user-attachments/assets/a49ab9be-f17b-41c5-96dd-20dc8d759b45" muted="false"></video>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td width=30% style="border: none">
113
+ <video controls loop src="https://github.com/user-attachments/assets/1136ec68-a13c-4ee7-ab31-5621530bf9df" muted="false"></video>
114
+ </td>
115
+ <td width=30% style="border: none">
116
+ <video controls loop src="https://github.com/user-attachments/assets/fc16d512-8806-4662-ae07-8fcf45c75a83" muted="false"></video>
117
+ </td>
118
+ <td width=30% style="border: none">
119
+ <video controls loop src="https://github.com/user-attachments/assets/f8559cd1-f555-4781-9251-dfcef10b5b01" muted="false"></video>
120
+ </td>
121
+ </tr>
122
+ <tr>
123
+ <td width=30% style="border: none">
124
+ <video controls loop src="https://github.com/user-attachments/assets/c7473e3a-ab51-4ad5-be96-6c4691fc0c6e" muted="false"></video>
125
+ </td>
126
+ <td width=30% style="border: none">
127
+ <video controls loop src="https://github.com/user-attachments/assets/ca69eac0-5126-41ee-8cac-c9722004d771" muted="false"></video>
128
+ </td>
129
+ <td width=30% style="border: none">
130
+ <video controls loop src="https://github.com/user-attachments/assets/e66f1712-b66d-46b5-8bbd-811fbcfea4fd" muted="false"></video>
131
+ </td>
132
+ </tr>
133
+ </table>
134
+
135
+ ## ⚒️ Installation
136
+ ### Download the Codes
137
+
138
+ ```bash
139
+ git clone https://github.com/antgroup/echomimic_v2
140
+ cd echomimic_v2
141
+ ```
142
+
143
+ ### Python Environment Setup
144
+
145
+ - Tested System Environment: Centos 7.2/Ubuntu 22.04, Cuda >= 11.7
146
+ - Tested GPUs: A100(80G) / RTX4090D (24G) / V100(16G)
147
+ - Tested Python Version: 3.8 / 3.10 / 3.11
148
+
149
+ Create conda environment (Recommended):
150
+
151
+ ```bash
152
+ conda create -n echomimic python=3.10
153
+ conda activate echomimic
154
+ ```
155
+
156
+ Install packages with `pip`
157
+ ```bash
158
+ pip install pip -U
159
+ pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 xformers==0.0.28.post3 --index-url https://download.pytorch.org/whl/cu124
160
+ pip install torchao --index-url https://download.pytorch.org/whl/nightly/cu124
161
+ pip install -r requirements.txt
162
+ pip install --no-deps facenet_pytorch==2.6.0
163
+ ```
164
+
165
+ ### Download ffmpeg-static
166
+ Download and decompress [ffmpeg-static](https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.4-amd64-static.tar.xz), then
167
+ ```
168
+ export FFMPEG_PATH=/path/to/ffmpeg-4.4-amd64-static
169
+ ```
170
+
171
+ ### Download pretrained weights
172
+
173
+ ```shell
174
+ git lfs install
175
+ git clone https://huggingface.co/BadToBest/EchoMimicV2 pretrained_weights
176
+ ```
177
+
178
+ The **pretrained_weights** is organized as follows.
179
+
180
+ ```
181
+ ./pretrained_weights/
182
+ ├── denoising_unet.pth
183
+ ├── reference_unet.pth
184
+ ├── motion_module.pth
185
+ ├── pose_encoder.pth
186
+ ├── sd-vae-ft-mse
187
+ │ └── ...
188
+ ├── sd-image-variations-diffusers
189
+ │ └── ...
190
+ └── audio_processor
191
+ └── tiny.pt
192
+ ```
193
+
194
+ In which **denoising_unet.pth** / **reference_unet.pth** / **motion_module.pth** / **pose_encoder.pth** are the main checkpoints of **EchoMimic**. Other models in this hub can be also downloaded from it's original hub, thanks to their brilliant works:
195
+ - [sd-vae-ft-mse](https://huggingface.co/stabilityai/sd-vae-ft-mse)
196
+ - [sd-image-variations-diffusers](https://huggingface.co/lambdalabs/sd-image-variations-diffusers)
197
+ - [audio_processor(whisper)](https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt)
198
+
199
+ ### Inference on Demo
200
+ Run the gradio:
201
+ ```bash
202
+ python app.py
203
+ ```
204
+ Run the python inference script:
205
+ ```bash
206
+ python infer.py --config='./configs/prompts/infer.yaml'
207
+ ```
208
+
209
+ ### EMTD Dataset
210
+ Download dataset:
211
+ ```bash
212
+ python ./EMTD_dataset/download.py
213
+ ```
214
+ Slice dataset:
215
+ ```bash
216
+ bash ./EMTD_dataset/slice.sh
217
+ ```
218
+ Process dataset:
219
+ ```bash
220
+ python ./EMTD_dataset/preprocess.py
221
+ ```
222
+
223
+ ## 📝 Release Plans
224
+
225
+ | Status | Milestone | ETA |
226
+ |:--------:|:-------------------------------------------------------------------------|:--:|
227
+ | ✅ | The inference source code of EchoMimicV2 meet everyone on GitHub | 21st Nov, 2024 |
228
+ | ✅ | Pretrained models trained on English and Mandarin Chinese on HuggingFace | 21st Nov, 2024 |
229
+ | ✅ | Pretrained models trained on English and Mandarin Chinese on ModelScope | 21st Nov, 2024 |
230
+ | ✅ | EMTD dataset list and processing scripts | 21st Nov, 2024 |
231
+ | 🚀 | Accelerated models to be released | TBD |
232
+ | 🚀 | Online Demo on ModelScope to be released | TBD |
233
+ | 🚀 | Online Demo on HuggingFace to be released | TBD |
234
+
235
+ ## ⚖️ Disclaimer
236
+ This project is intended for academic research, and we explicitly disclaim any responsibility for user-generated content. Users are solely liable for their actions while using the generative model. The project contributors have no legal affiliation with, nor accountability for, users' behaviors. It is imperative to use the generative model responsibly, adhering to both ethical and legal standards.
237
+
238
+ ## 🙏🏻 Acknowledgements
239
+
240
+ We would like to thank the contributors to the [MimicMotion](https://github.com/Tencent/MimicMotion) and [Moore-AnimateAnyone](https://github.com/MooreThreads/Moore-AnimateAnyone) repositories, for their open research and exploration.
241
+
242
+ We are also grateful to [CyberHost](https://cyberhost.github.io/) and [Vlogger](https://enriccorona.github.io/vlogger/) for their outstanding work in the area of audio-driven human animation.
243
+
244
+ If we missed any open-source projects or related articles, we would like to complement the acknowledgement of this specific work immediately.
245
+
246
+ ## &#x1F4D2; Citation
247
+
248
+ If you find our work useful for your research, please consider citing the paper :
249
+
250
+ ```
251
+ @misc{meng2024echomimic,
252
+ title={EchoMimicV2: Towards Striking, Simplified, and Semi-Body Human Animation},
253
+ author={Rang Meng, Xingyu Zhang, Yuming Li, Chenguang Ma},
254
+ year={2024},
255
+ eprint={2411.10061},
256
+ archivePrefix={arXiv},
257
+ primaryClass={cs.CV}
258
+ }
259
+ ```
260
+
261
+ ## &#x1F31F; Star History
262
+ [![Star History Chart](https://api.star-history.com/svg?repos=antgroup/echomimic_v2&type=Date)](https://star-history.com/#antgroup/echomimic_v2&Date)
app.py ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ from diffusers import AutoencoderKL, DDIMScheduler
7
+ from PIL import Image
8
+ from src.models.unet_2d_condition import UNet2DConditionModel
9
+ from src.models.unet_3d_emo import EMOUNet3DConditionModel
10
+ from src.models.whisper.audio2feature import load_audio_model
11
+ from src.pipelines.pipeline_echomimicv2 import EchoMimicV2Pipeline
12
+ from src.utils.util import save_videos_grid
13
+ from src.models.pose_encoder import PoseEncoder
14
+ from src.utils.dwpose_util import draw_pose_select_v2
15
+ from moviepy.editor import VideoFileClip, AudioFileClip
16
+
17
+ import gradio as gr
18
+ from datetime import datetime
19
+ from torchao.quantization import quantize_, int8_weight_only
20
+ import gc
21
+
22
+ total_vram_in_gb = torch.cuda.get_device_properties(0).total_memory / 1073741824
23
+ print(f'\033[32mCUDA版本:{torch.version.cuda}\033[0m')
24
+ print(f'\033[32mPytorch版本:{torch.__version__}\033[0m')
25
+ print(f'\033[32m显卡型号:{torch.cuda.get_device_name()}\033[0m')
26
+ print(f'\033[32m显存大小:{total_vram_in_gb:.2f}GB\033[0m')
27
+ print(f'\033[32m精度:float16\033[0m')
28
+ dtype = torch.float16
29
+ if torch.cuda.is_available():
30
+ device = "cuda"
31
+ else:
32
+ print("cuda not available, using cpu")
33
+ device = "cpu"
34
+
35
+ ffmpeg_path = os.getenv('FFMPEG_PATH')
36
+ if ffmpeg_path is None:
37
+ print("please download ffmpeg-static and export to FFMPEG_PATH. \nFor example: export FFMPEG_PATH=./ffmpeg-4.4-amd64-static")
38
+ elif ffmpeg_path not in os.getenv('PATH'):
39
+ print("add ffmpeg to path")
40
+ os.environ["PATH"] = f"{ffmpeg_path}:{os.environ['PATH']}"
41
+
42
+
43
+ def generate(image_input, audio_input, pose_input, width, height, length, steps, sample_rate, cfg, fps, context_frames, context_overlap, quantization_input, seed):
44
+ gc.collect()
45
+ torch.cuda.empty_cache()
46
+ torch.cuda.ipc_collect()
47
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
48
+ save_dir = Path("outputs")
49
+ save_dir.mkdir(exist_ok=True, parents=True)
50
+
51
+ ############# model_init started #############
52
+ ## vae init
53
+ vae = AutoencoderKL.from_pretrained("./pretrained_weights/sd-vae-ft-mse").to(device, dtype=dtype)
54
+ if quantization_input:
55
+ quantize_(vae, int8_weight_only())
56
+ print("使用int8量化")
57
+
58
+ ## reference net init
59
+ reference_unet = UNet2DConditionModel.from_pretrained("./pretrained_weights/sd-image-variations-diffusers", subfolder="unet", use_safetensors=False).to(dtype=dtype, device=device)
60
+ reference_unet.load_state_dict(torch.load("./pretrained_weights/reference_unet.pth", weights_only=True))
61
+ if quantization_input:
62
+ quantize_(reference_unet, int8_weight_only())
63
+
64
+ ## denoising net init
65
+ if os.path.exists("./pretrained_weights/motion_module.pth"):
66
+ print('using motion module')
67
+ else:
68
+ exit("motion module not found")
69
+ ### stage1 + stage2
70
+ denoising_unet = EMOUNet3DConditionModel.from_pretrained_2d(
71
+ "./pretrained_weights/sd-image-variations-diffusers",
72
+ "./pretrained_weights/motion_module.pth",
73
+ subfolder="unet",
74
+ unet_additional_kwargs = {
75
+ "use_inflated_groupnorm": True,
76
+ "unet_use_cross_frame_attention": False,
77
+ "unet_use_temporal_attention": False,
78
+ "use_motion_module": True,
79
+ "cross_attention_dim": 384,
80
+ "motion_module_resolutions": [
81
+ 1,
82
+ 2,
83
+ 4,
84
+ 8
85
+ ],
86
+ "motion_module_mid_block": True ,
87
+ "motion_module_decoder_only": False,
88
+ "motion_module_type": "Vanilla",
89
+ "motion_module_kwargs":{
90
+ "num_attention_heads": 8,
91
+ "num_transformer_block": 1,
92
+ "attention_block_types": [
93
+ 'Temporal_Self',
94
+ 'Temporal_Self'
95
+ ],
96
+ "temporal_position_encoding": True,
97
+ "temporal_position_encoding_max_len": 32,
98
+ "temporal_attention_dim_div": 1,
99
+ }
100
+ },
101
+ ).to(dtype=dtype, device=device)
102
+ denoising_unet.load_state_dict(torch.load("./pretrained_weights/denoising_unet.pth", weights_only=True),strict=False)
103
+
104
+ # pose net init
105
+ pose_net = PoseEncoder(320, conditioning_channels=3, block_out_channels=(16, 32, 96, 256)).to(dtype=dtype, device=device)
106
+ pose_net.load_state_dict(torch.load("./pretrained_weights/pose_encoder.pth", weights_only=True))
107
+
108
+ ### load audio processor params
109
+ audio_processor = load_audio_model(model_path="./pretrained_weights/audio_processor/tiny.pt", device=device)
110
+
111
+ ############# model_init finished #############
112
+ sched_kwargs = {
113
+ "beta_start": 0.00085,
114
+ "beta_end": 0.012,
115
+ "beta_schedule": "linear",
116
+ "clip_sample": False,
117
+ "steps_offset": 1,
118
+ "prediction_type": "v_prediction",
119
+ "rescale_betas_zero_snr": True,
120
+ "timestep_spacing": "trailing"
121
+ }
122
+ scheduler = DDIMScheduler(**sched_kwargs)
123
+
124
+ pipe = EchoMimicV2Pipeline(
125
+ vae=vae,
126
+ reference_unet=reference_unet,
127
+ denoising_unet=denoising_unet,
128
+ audio_guider=audio_processor,
129
+ pose_encoder=pose_net,
130
+ scheduler=scheduler,
131
+ )
132
+
133
+ pipe = pipe.to(device, dtype=dtype)
134
+
135
+ if seed is not None and seed > -1:
136
+ generator = torch.manual_seed(seed)
137
+ else:
138
+ seed = random.randint(100, 1000000)
139
+ generator = torch.manual_seed(seed)
140
+
141
+ inputs_dict = {
142
+ "refimg": image_input,
143
+ "audio": audio_input,
144
+ "pose": pose_input,
145
+ }
146
+
147
+ print('Pose:', inputs_dict['pose'])
148
+ print('Reference:', inputs_dict['refimg'])
149
+ print('Audio:', inputs_dict['audio'])
150
+
151
+ save_name = f"{save_dir}/{timestamp}"
152
+
153
+ ref_image_pil = Image.open(inputs_dict['refimg']).resize((width, height))
154
+ audio_clip = AudioFileClip(inputs_dict['audio'])
155
+
156
+ length = min(length, int(audio_clip.duration * fps), len(os.listdir(inputs_dict['pose'])))
157
+
158
+ start_idx = 0
159
+
160
+ pose_list = []
161
+ for index in range(start_idx, start_idx + length):
162
+ tgt_musk = np.zeros((width, height, 3)).astype('uint8')
163
+ tgt_musk_path = os.path.join(inputs_dict['pose'], "{}.npy".format(index))
164
+ detected_pose = np.load(tgt_musk_path, allow_pickle=True).tolist()
165
+ imh_new, imw_new, rb, re, cb, ce = detected_pose['draw_pose_params']
166
+ im = draw_pose_select_v2(detected_pose, imh_new, imw_new, ref_w=800)
167
+ im = np.transpose(np.array(im),(1, 2, 0))
168
+ tgt_musk[rb:re,cb:ce,:] = im
169
+
170
+ tgt_musk_pil = Image.fromarray(np.array(tgt_musk)).convert('RGB')
171
+ pose_list.append(torch.Tensor(np.array(tgt_musk_pil)).to(dtype=dtype, device=device).permute(2,0,1) / 255.0)
172
+
173
+ poses_tensor = torch.stack(pose_list, dim=1).unsqueeze(0)
174
+ audio_clip = AudioFileClip(inputs_dict['audio'])
175
+
176
+ audio_clip = audio_clip.set_duration(length / fps)
177
+ video = pipe(
178
+ ref_image_pil,
179
+ inputs_dict['audio'],
180
+ poses_tensor[:,:,:length,...],
181
+ width,
182
+ height,
183
+ length,
184
+ steps,
185
+ cfg,
186
+ generator=generator,
187
+ audio_sample_rate=sample_rate,
188
+ context_frames=context_frames,
189
+ fps=fps,
190
+ context_overlap=context_overlap,
191
+ start_idx=start_idx,
192
+ ).videos
193
+
194
+ final_length = min(video.shape[2], poses_tensor.shape[2], length)
195
+ video_sig = video[:, :, :final_length, :, :]
196
+
197
+ save_videos_grid(
198
+ video_sig,
199
+ save_name + "_woa_sig.mp4",
200
+ n_rows=1,
201
+ fps=fps,
202
+ )
203
+
204
+ video_clip_sig = VideoFileClip(save_name + "_woa_sig.mp4",)
205
+ video_clip_sig = video_clip_sig.set_audio(audio_clip)
206
+ video_clip_sig.write_videofile(save_name + "_sig.mp4", codec="libx264", audio_codec="aac", threads=2)
207
+ video_output = save_name + "_sig.mp4"
208
+ seed_text = gr.update(visible=True, value=seed)
209
+ return video_output, seed_text
210
+
211
+
212
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
213
+ gr.Markdown("""
214
+ <div>
215
+ <h2 style="font-size: 30px;text-align: center;">EchoMimicV2</h2>
216
+ </div>
217
+ <div style="text-align: center;">
218
+ <a href="https://github.com/antgroup/echomimic_v2">🌐 Github</a> |
219
+ <a href="https://arxiv.org/abs/2411.10061">📜 arXiv </a>
220
+ </div>
221
+ <div style="text-align: center; font-weight: bold; color: red;">
222
+ ⚠️ 该演示仅供学术研究和体验使用。
223
+ </div>
224
+
225
+ """)
226
+ with gr.Column():
227
+ with gr.Row():
228
+ with gr.Column():
229
+ with gr.Group():
230
+ image_input = gr.Image(label="图像输入(自动缩放)", type="filepath")
231
+ audio_input = gr.Audio(label="音频输入", type="filepath")
232
+ pose_input = gr.Textbox(label="姿态输入(目录地址)", placeholder="请输入姿态数据的目录地址", value="assets/halfbody_demo/pose/01")
233
+ with gr.Group():
234
+ with gr.Row():
235
+ width = gr.Number(label="宽度(16的倍数,推荐768)", value=768)
236
+ height = gr.Number(label="高度(16的倍数,推荐768)", value=768)
237
+ length = gr.Number(label="视频长度,推荐240)", value=240)
238
+ with gr.Row():
239
+ steps = gr.Number(label="步骤(推荐30)", value=20)
240
+ sample_rate = gr.Number(label="采样率(推荐16000)", value=16000)
241
+ cfg = gr.Number(label="cfg(推荐2.5)", value=2.5, step=0.1)
242
+ with gr.Row():
243
+ fps = gr.Number(label="帧率(推荐24)", value=24)
244
+ context_frames = gr.Number(label="上下文框架(推荐12)", value=12)
245
+ context_overlap = gr.Number(label="上下文重叠(推荐3)", value=3)
246
+ with gr.Row():
247
+ quantization_input = gr.Checkbox(label="int8量化(推荐显存12G的用户开启,并使用不超过5秒的音频)", value=False)
248
+ seed = gr.Number(label="种子(-1为随机)", value=-1)
249
+ generate_button = gr.Button("🎬 生成视频")
250
+ with gr.Column():
251
+ video_output = gr.Video(label="输出视频")
252
+ seed_text = gr.Textbox(label="种子", interactive=False, visible=False)
253
+ gr.Examples(
254
+ examples=[
255
+ ["EMTD_dataset/ref_imgs_by_FLUX/man/0001.png", "assets/halfbody_demo/audio/chinese/echomimicv2_man.wav"],
256
+ ["EMTD_dataset/ref_imgs_by_FLUX/woman/0077.png", "assets/halfbody_demo/audio/chinese/echomimicv2_woman.wav"],
257
+ ["EMTD_dataset/ref_imgs_by_FLUX/man/0003.png", "assets/halfbody_demo/audio/chinese/fighting.wav"],
258
+ ["EMTD_dataset/ref_imgs_by_FLUX/woman/0033.png", "assets/halfbody_demo/audio/chinese/good.wav"],
259
+ ["EMTD_dataset/ref_imgs_by_FLUX/man/0010.png", "assets/halfbody_demo/audio/chinese/news.wav"],
260
+ ["EMTD_dataset/ref_imgs_by_FLUX/man/1168.png", "assets/halfbody_demo/audio/chinese/no_smoking.wav"],
261
+ ["EMTD_dataset/ref_imgs_by_FLUX/woman/0057.png", "assets/halfbody_demo/audio/chinese/ultraman.wav"]
262
+ ],
263
+ inputs=[image_input, audio_input],
264
+ label="预设人物及音频",
265
+ )
266
+
267
+ generate_button.click(
268
+ generate,
269
+ inputs=[image_input, audio_input, pose_input, width, height, length, steps, sample_rate, cfg, fps, context_frames, context_overlap, quantization_input, seed],
270
+ outputs=[video_output, seed_text],
271
+ )
272
+
273
+
274
+
275
+ if __name__ == "__main__":
276
+ demo.queue()
277
+ demo.launch(inbrowser=True)
assets/halfbody_demo/audio/chinese/echomimicv2_man.wav ADDED
Binary file (922 kB). View file
 
assets/halfbody_demo/audio/chinese/echomimicv2_woman.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52c828b9587a441881cbf5275c4ea65ed2a893129c585759c582a2e2e7e86718
3
+ size 1096748