simbahuang commited on
Commit
c611595
·
verified ·
1 Parent(s): 6532007

Add files using upload-large-folder tool

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 +3 -0
  2. download_datasets.py +42 -0
  3. opensource_dataset/Cartoon/000002_pose.npy +3 -0
  4. opensource_dataset/Cartoon/000014_pose.npy +3 -0
  5. opensource_dataset/Cartoon/000017_pose.npy +3 -0
  6. opensource_dataset/Cartoon/000018.mp4 +3 -0
  7. opensource_dataset/Cartoon/000019_pose.npy +3 -0
  8. opensource_dataset/Cartoon/000020_pose.npy +3 -0
  9. opensource_dataset/Cartoon/000021.mp4 +3 -0
  10. opensource_dataset/Cartoon/000022_pose.npy +3 -0
  11. opensource_dataset/Cartoon/000023.mp4 +3 -0
  12. opensource_dataset/Cartoon/000027.mp4 +3 -0
  13. opensource_dataset/Cartoon/000030.mp4 +3 -0
  14. opensource_dataset/Cartoon/000032.mp4 +3 -0
  15. opensource_dataset/Cartoon/000037.mp4 +3 -0
  16. opensource_dataset/Cartoon/000040_pose.npy +3 -0
  17. opensource_dataset/Cartoon/000046_pose.npy +3 -0
  18. opensource_dataset/Cartoon/000053_pose.npy +3 -0
  19. opensource_dataset/Cartoon/000066_pose.npy +3 -0
  20. opensource_dataset/Cartoon/000068_pose.npy +3 -0
  21. opensource_dataset/Cartoon/000072_pose.npy +3 -0
  22. opensource_dataset/Cartoon/000082.mp4 +3 -0
  23. opensource_dataset/Cartoon/000085_pose.npy +3 -0
  24. opensource_dataset/Cartoon/000087.mp4 +3 -0
  25. opensource_dataset/Cartoon/000089.mp4 +3 -0
  26. opensource_dataset/Cartoon/000109_pose.npy +3 -0
  27. opensource_dataset/Cartoon/000111.mp4 +3 -0
  28. opensource_dataset/Cartoon/000125_pose.npy +3 -0
  29. opensource_dataset/Cartoon/000126.mp4 +3 -0
  30. opensource_dataset/Cartoon/000131.mp4 +3 -0
  31. opensource_dataset/Cartoon/000137_pose.npy +3 -0
  32. opensource_dataset/Cartoon/000142_pose.npy +3 -0
  33. opensource_dataset/Cartoon/000149_pose.npy +3 -0
  34. opensource_dataset/Cartoon/000151_pose.npy +3 -0
  35. opensource_dataset/Cartoon/000157.mp4 +3 -0
  36. opensource_dataset/Cartoon/000158.mp4 +3 -0
  37. opensource_dataset/Cartoon/000159.mp4 +3 -0
  38. opensource_dataset/Cartoon/000171.mp4 +3 -0
  39. opensource_dataset/Cartoon/000182.mp4 +3 -0
  40. opensource_dataset/Cartoon/000184_pose.npy +3 -0
  41. opensource_dataset/Cartoon/000185.mp4 +3 -0
  42. opensource_dataset/Cartoon/000187.mp4 +3 -0
  43. opensource_dataset/Cartoon/000191_pose.npy +3 -0
  44. opensource_dataset/Cartoon/000193_pose.npy +3 -0
  45. opensource_dataset/combined_imgvid_dataset.csv +3 -0
  46. opensource_dataset/fashion/all_data_png/.DS_Store +0 -0
  47. opensource_dataset/opensource_data_fashion_img.csv +3 -0
  48. opensource_dataset/opensource_data_vid.csv +3 -0
  49. prepare_pose_pool.py +41 -0
  50. prepare_training_data.py +174 -0
.gitattributes CHANGED
@@ -58,3 +58,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ opensource_dataset/opensource_data_fashion_img.csv filter=lfs diff=lfs merge=lfs -text
62
+ opensource_dataset/opensource_data_vid.csv filter=lfs diff=lfs merge=lfs -text
63
+ opensource_dataset/combined_imgvid_dataset.csv filter=lfs diff=lfs merge=lfs -text
download_datasets.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ # Set HuggingFace mirror
3
+ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
4
+
5
+ from huggingface_hub import snapshot_download
6
+
7
+ os.makedirs("opensource_dataset", exist_ok=True)
8
+ os.makedirs("opensource_pose_pool", exist_ok=True)
9
+
10
+ print("Using HF Mirror: https://hf-mirror.com")
11
+ print("="*50)
12
+
13
+ try:
14
+ # 1. Download training datasets
15
+ print("\n[1/2] Downloading training datasets...")
16
+ snapshot_download(
17
+ repo_id="MochunniaN1/One-to-All-sub",
18
+ allow_patterns="opensource_dataset/*",
19
+ local_dir="./",
20
+ local_dir_use_symlinks=False,
21
+ repo_type="dataset"
22
+ )
23
+ print("✓ Training datasets downloaded successfully!")
24
+
25
+ # 2. Download pose pool
26
+ print("\n[2/2] Downloading pose pool...")
27
+ snapshot_download(
28
+ repo_id="MochunniaN1/One-to-All-sub",
29
+ allow_patterns="opensource_pose_pool/*",
30
+ local_dir="./",
31
+ local_dir_use_symlinks=False,
32
+ repo_type="dataset"
33
+ )
34
+ print("✓ Pose pool downloaded successfully!")
35
+
36
+ print("\n" + "="*50)
37
+ print("All downloads completed successfully!")
38
+ print("="*50)
39
+
40
+ except Exception as e:
41
+ print(f"\n❌ Error occurred: {str(e)}")
42
+ print("Please check your internet connection.")
opensource_dataset/Cartoon/000002_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:058cd76893e4ea0ba72b9284b67fa6da62da75a1854c03897c95de848fff094d
3
+ size 446141
opensource_dataset/Cartoon/000014_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72cd6f7155b36128ef9f0bb648bf0779eb86fb97d82290f8775ca69f59410e60
3
+ size 446141
opensource_dataset/Cartoon/000017_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3c64a3145825279f6f329b8a2c46f4e61c7b7f6361acd91ade2cdfa03e61dab
3
+ size 446141
opensource_dataset/Cartoon/000018.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:801c3e28d28bf1e554239152fe006d01b143892b92a93cc5508d27363cd57c43
3
+ size 5961980
opensource_dataset/Cartoon/000019_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3ff32a1f3b5dcc7f7121d40b7f06b73dc031396ff2e33a57bddd32d4a55c2d2
3
+ size 446141
opensource_dataset/Cartoon/000020_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:074ef160cd275ad06d74d7bb4e6da84fd1387c8174c7689e1111718453b19d56
3
+ size 446141
opensource_dataset/Cartoon/000021.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f0a490f2f20af28623c409291fc7583521132b5b390f73ff68a3d2e5a9b315b
3
+ size 6428438
opensource_dataset/Cartoon/000022_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75ecab059dbd21c4e015a6ade2417613ae045d9e32078f9b4faf3db6a27ab569
3
+ size 446141
opensource_dataset/Cartoon/000023.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:911577872f9e8d4dad9935a64ba51e7573d9d4d0cdc68e58309d4f9038ec8df2
3
+ size 4518804
opensource_dataset/Cartoon/000027.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd309e847597e7b0b90ca92bf23d2bd1e8f691a5c3f1fcefed62d73eb75f7eeb
3
+ size 6169177
opensource_dataset/Cartoon/000030.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b4950bc354563b0ea1dbe84086de0d0df60b0b6e1d9129af982ab84d66aa69f
3
+ size 5586478
opensource_dataset/Cartoon/000032.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3eeb4873a27acb6c4a227dcd9da438471abcf6e1556c38c9b700898979b7177
3
+ size 4763336
opensource_dataset/Cartoon/000037.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95903d2b0bdefd08a7d73d94b12b3324a504219f06faaba407dd54d64780bc8a
3
+ size 4312375
opensource_dataset/Cartoon/000040_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:169d06afac8af9f2b24770a6bc5d5a706b925f4644d931ffd1ac75fdac206ca3
3
+ size 446141
opensource_dataset/Cartoon/000046_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8781ecb3878613a78ae9c92acec084eef46936246b15af6c4f16329fac31df02
3
+ size 446141
opensource_dataset/Cartoon/000053_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3782fd812dd6340e2de0f39598592b52f0a968c700a40d104d00647221f90ed
3
+ size 446141
opensource_dataset/Cartoon/000066_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48116a8bccfbb3c4a951628591499105d870aca409b524bb0a4567e0b411ed50
3
+ size 446141
opensource_dataset/Cartoon/000068_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c477f9eff48467e66e6c6f4bb318133bb9af6bf7e7a767c5667552441257c63
3
+ size 446141
opensource_dataset/Cartoon/000072_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b4308b07b625e021968b47e3d8985188638a0558b1f7e8c39fc5cec2ee17366
3
+ size 446141
opensource_dataset/Cartoon/000082.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27ccd2d96cb99ae41ac9ff37c7a1f26d66e19706e5950fbe26cd037c8e4c51c9
3
+ size 9534378
opensource_dataset/Cartoon/000085_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1d869abc0f843d6a93c10f31ce7b87d826ef03e605db53b1f20bb621853a3da
3
+ size 446141
opensource_dataset/Cartoon/000087.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d937ec5c429162313c0e83729aa966f982342ecc686ff6e6b003a6798cc9139
3
+ size 6099072
opensource_dataset/Cartoon/000089.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78faac4bf0d62d55b7f007f9f3653b9401ba4229aaeef3389cee2ff297d748a2
3
+ size 3778560
opensource_dataset/Cartoon/000109_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e829e877e89e16d5862845a4d1e2bb4f3ac50b03d07badaf53e60a1133892bb6
3
+ size 446141
opensource_dataset/Cartoon/000111.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b299268df0eca4e92423fdf9b96b783fcf3ccf05f94ca4fbb8cd92d341ec1bbf
3
+ size 6050031
opensource_dataset/Cartoon/000125_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f6559a44fd4017d5252a6af9b4b81652ac78afec38b70b54e1a2a3574cd332f
3
+ size 446141
opensource_dataset/Cartoon/000126.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46c8487bf94e9fb8627953306be48e4550775d03edad4322cd76a7ccb7c5f494
3
+ size 5075880
opensource_dataset/Cartoon/000131.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dccde5ee91c6ddee5eada9d96abdb3f923cd423248144f4e9fec5494c970986a
3
+ size 5904860
opensource_dataset/Cartoon/000137_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54e9e829fa2812330f792d0c362221d85bd71472428e6a0622bad0e67ae48d84
3
+ size 446141
opensource_dataset/Cartoon/000142_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d3f1323a4f0ed670998e03811ceac971c08eb6d93eb16d154d976158e5c7b61
3
+ size 446141
opensource_dataset/Cartoon/000149_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11f0cf290b3af45dcac88414d5848d2e54b7c36a90787b9ff25cc2d0af4062b9
3
+ size 446141
opensource_dataset/Cartoon/000151_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d24efcba6def9afe45591292286f9bf20c843a1098f3d6a8c27c3da5c4d09c0c
3
+ size 446141
opensource_dataset/Cartoon/000157.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6e3b11bc38d67ea4c2a5dc781dcf29b392f759b5e894a2d78ec4966bd801251
3
+ size 6622330
opensource_dataset/Cartoon/000158.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1077ed412bf51dc1ffd971f483d84a5e5a8714513fbd7e3513117384935779e
3
+ size 10850361
opensource_dataset/Cartoon/000159.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34b032086f85935bdd75a8a7e1e9452c61fd22d4b3e0a0264384921b04a73f86
3
+ size 4462376
opensource_dataset/Cartoon/000171.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba0f2ed453ebfb42b03f3a844d473af5baf1a6a5d32e58ef9bef59844d412983
3
+ size 6275912
opensource_dataset/Cartoon/000182.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98ef85f4046d1a338bc3cc2fa206e901d21f07840a0fb83705d10a9025ea0d45
3
+ size 6429923
opensource_dataset/Cartoon/000184_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1308750cb686a2b774d77c6fa7453d40bb36754d0a1dcab3566d24f8c8fde5d
3
+ size 446141
opensource_dataset/Cartoon/000185.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb2098800319dc0e6f511acc004044a8b8b8c87a548cfd66a6a358ed920a61e4
3
+ size 5866712
opensource_dataset/Cartoon/000187.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:414f931576e14d8788114342033d42c6c04a1c1915f600698c9cbb3ca504fa46
3
+ size 4462886
opensource_dataset/Cartoon/000191_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c82c9697d8cdf2da1bf3acefb55b0566e5e051994929ea54e005a635d164209
3
+ size 446141
opensource_dataset/Cartoon/000193_pose.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:614c000a5692cb6dcebfc0d2ec64d8ae257cd7900bc71da282d6b52861bb0918
3
+ size 446141
opensource_dataset/combined_imgvid_dataset.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a184a880d71495549b6dc2bf2b9e5a8a65893c2a99f0c79e64258288c3e99609
3
+ size 83419327
opensource_dataset/fashion/all_data_png/.DS_Store ADDED
Binary file (6.15 kB). View file
 
opensource_dataset/opensource_data_fashion_img.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad7388b8c14679126f5a33ff9adeecc551842ae6f732fee8b31bda763833ca3d
3
+ size 22734878
opensource_dataset/opensource_data_vid.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0720c03c7cd4cc13015042b5bc739d2bc4960a0e2d6cd1fe3d0a895ef6c300a9
3
+ size 31427019
prepare_pose_pool.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import os
3
+
4
+ WORK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'opensource_pose_pool')
5
+ os.makedirs(WORK_DIR, exist_ok=True)
6
+ os.chdir(WORK_DIR)
7
+ print(f"📂 工作目录: {os.getcwd()}")
8
+
9
+ CSV_A = 'images_pose_pool_18_16pt.csv'
10
+ CSV_B = 'images_pose_pool_24_18pt.csv'
11
+
12
+
13
+ print(f"\n📊 读取 CSV 文件...")
14
+ df_a = pd.read_csv(CSV_A)
15
+ df_b = pd.read_csv(CSV_B)
16
+
17
+
18
+ print(f"\n🔄 转换为绝对路径...")
19
+ for col in ['pose_path']:
20
+ df_a[col] = df_a[col].apply(lambda x: os.path.abspath(x) if isinstance(x, str) else x)
21
+ df_b[col] = df_b[col].apply(lambda x: os.path.abspath(x) if isinstance(x, str) else x)
22
+
23
+
24
+ print(f"\n✅ 检查文件是否存在...")
25
+ for col in ['pose_path']:
26
+ df_a[col + '_exists'] = df_a[col].apply(lambda x: os.path.exists(x) if isinstance(x, str) else False)
27
+ print(f" {CSV_A} 存在文件数量: {df_a[col + '_exists'].sum()} / {len(df_a)}")
28
+ df_b[col + '_exists'] = df_b[col].apply(lambda x: os.path.exists(x) if isinstance(x, str) else False)
29
+ print(f" {CSV_B} 存在文件数量: {df_b[col + '_exists'].sum()} / {len(df_b)}")
30
+
31
+ df_a.drop(columns=[c for c in df_a.columns if c.endswith('_exists')], inplace=True)
32
+ df_b.drop(columns=[c for c in df_b.columns if c.endswith('_exists')], inplace=True)
33
+
34
+ output_a = CSV_A.replace(".csv", "_abs.csv")
35
+ output_b = CSV_B.replace(".csv", "_abs.csv")
36
+
37
+ df_a.to_csv(output_a, index=False)
38
+ df_b.to_csv(output_b, index=False)
39
+
40
+ print(f" {os.path.abspath(output_a)}")
41
+ print(f" {os.path.abspath(output_b)}")
prepare_training_data.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import os
3
+ from pandarallel import pandarallel
4
+ import zipfile
5
+ from concurrent.futures import ThreadPoolExecutor, as_completed
6
+
7
+ pandarallel.initialize(progress_bar=True)
8
+
9
+ WORK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'opensource_dataset')
10
+ os.makedirs(WORK_DIR, exist_ok=True)
11
+ os.chdir(WORK_DIR)
12
+ print(f"📂 工作目录: {os.getcwd()}")
13
+
14
+ def unzip_one(zip_path, extract_dir):
15
+ zip_name = os.path.splitext(os.path.basename(zip_path))[0]
16
+ with zipfile.ZipFile(zip_path, 'r') as zf:
17
+ names = zf.namelist()
18
+ common_prefix = os.path.commonprefix(names).split('/')[0] if names else ''
19
+ if common_prefix.lower() == zip_name.lower():
20
+ target_dir = extract_dir
21
+ else:
22
+ target_dir = os.path.join(extract_dir, zip_name)
23
+ os.makedirs(target_dir, exist_ok=True)
24
+
25
+ zf.extractall(target_dir)
26
+ return f"✅ {zip_name}.zip 已解压到 {target_dir}"
27
+
28
+ def unzip_all(base_dir=".", extract_dir=None, max_workers=8):
29
+ if extract_dir is None:
30
+ extract_dir = base_dir
31
+
32
+ zip_files = [
33
+ os.path.join(base_dir, f)
34
+ for f in os.listdir(base_dir)
35
+ if f.endswith(".zip")
36
+ ]
37
+
38
+ if not zip_files:
39
+ print("⚠️ 未找到 zip 文件")
40
+ return
41
+
42
+ print(f"🔍 共发现 {len(zip_files)} 个 zip 文件,开始多线程解压…")
43
+
44
+ results = []
45
+ with ThreadPoolExecutor(max_workers=max_workers) as executor:
46
+ futures = {executor.submit(unzip_one, z, extract_dir): z for z in zip_files}
47
+ for future in as_completed(futures):
48
+ try:
49
+ result = future.result()
50
+ print(result)
51
+ results.append(result)
52
+ except Exception as e:
53
+ print(f"❌ 解压失败: {futures[future]} - {e}")
54
+
55
+ print("🎉 所有文件已解压完成!")
56
+
57
+ # unzip
58
+ unzip_all(base_dir=".", max_workers=8)
59
+
60
+ VID_CSV = 'opensource_data_vid.csv'
61
+ IMG_CSV = 'opensource_data_fashion_img.csv'
62
+ OUTPUT_CSV = 'combined_imgvid_dataset.csv'
63
+
64
+ # vid:img = 6:1
65
+ GROUP_RATIO = 6
66
+
67
+ # -----------------------------
68
+ # 读取数据
69
+ # -----------------------------
70
+ print(f"\n📊 读取数据...")
71
+ df_vid = pd.read_csv(VID_CSV)
72
+ df_img = pd.read_csv(IMG_CSV)
73
+
74
+ # -----------------------------
75
+ # 转为绝对路径
76
+ # -----------------------------
77
+ print(f"🔄 转换为绝对路径...")
78
+ for col in ['path', 'pose_path']:
79
+ df_vid[col] = df_vid[col].apply(lambda x: os.path.abspath(x) if isinstance(x, str) else x)
80
+
81
+ for col in ['path', 'target_path', 'pose_path']:
82
+ df_img[col] = df_img[col].apply(lambda x: os.path.abspath(x) if isinstance(x, str) else x)
83
+
84
+ # 检查文件是否存在
85
+ print(f"\n✅ 检查视频文件是否存在...")
86
+ for col in ['path', 'pose_path']:
87
+ df_vid[col + '_exists'] = df_vid[col].parallel_apply(lambda x: os.path.exists(x) if isinstance(x, str) else False)
88
+ print(f" {col} 存在文件数量: {df_vid[col + '_exists'].sum()} / {len(df_vid)}")
89
+
90
+ print(f"\n✅ 检查图片文件是否存在...")
91
+ for col in ['path', 'target_path', 'pose_path']:
92
+ df_img[col + '_exists'] = df_img[col].parallel_apply(lambda x: os.path.exists(x) if isinstance(x, str) else False)
93
+ print(f" {col} 存在文件数量: {df_img[col + '_exists'].sum()} / {len(df_img)}")
94
+
95
+ df_vid.drop(columns=[c for c in df_vid.columns if c.endswith('_exists')], inplace=True)
96
+ df_img.drop(columns=[c for c in df_img.columns if c.endswith('_exists')], inplace=True)
97
+
98
+
99
+ n_vid = len(df_vid)
100
+ n_img = len(df_img)
101
+
102
+ GROUP_NUMBER = int(n_vid / GROUP_RATIO)
103
+ GROUP_SIZE = max(1, n_img // GROUP_NUMBER)
104
+
105
+ print(f"\n📈 视频数量: {n_vid}, 图片数量: {n_img}")
106
+ print(f"📈 计算得到 GROUP_SIZE: {GROUP_SIZE}")
107
+
108
+ # -----------------------------
109
+ # 对 img 数据分组
110
+ # -----------------------------
111
+ print(f"\n🔄 对图片数据进行分组...")
112
+ fields = ['height', 'width', 'aspect_ratio', 'resolution']
113
+ df_img_sorted = df_img.sort_values(fields + ['path']).reset_index(drop=True)
114
+
115
+ group_rows = []
116
+ bad_rows = []
117
+ group_id_counter = 0
118
+
119
+ for combo, subdf in df_img_sorted.groupby(fields, sort=False):
120
+ n = len(subdf)
121
+ n_groups = n // GROUP_SIZE
122
+ remainder = n % GROUP_SIZE
123
+ idxs = subdf.index.to_list()
124
+
125
+ for g in range(n_groups):
126
+ slice_idx = idxs[g*GROUP_SIZE:(g+1)*GROUP_SIZE]
127
+ group = subdf.loc[slice_idx]
128
+
129
+ first = group.iloc[0]
130
+
131
+ img_pairs = [
132
+ {
133
+ 'src_path' : row['path'],
134
+ 'tgt_path' : row['target_path'],
135
+ 'tgt_pose_path': row['pose_path'],
136
+ 'qwen_caption' : row['qwen_caption'] if 'qwen_caption' in row and pd.notnull(row['qwen_caption']) else "",
137
+ 'text' : row['text'] if 'text' in row and pd.notnull(row['text']) else ""
138
+ }
139
+ for _, row in group.iterrows()
140
+ ]
141
+
142
+ group_rows.append(
143
+ {
144
+ 'path' : f'image_{group_id_counter+2800:05d}',
145
+ 'img_pairs' : img_pairs,
146
+ 'height' : int(first['height']),
147
+ 'width' : int(first['width']),
148
+ 'aspect_ratio' : first['aspect_ratio'],
149
+ 'resolution' : first['resolution'],
150
+ 'num_frames' : 1
151
+ }
152
+ )
153
+ group_id_counter += 1
154
+
155
+ if remainder:
156
+ bad_rows.extend(subdf.loc[idxs[-remainder:]].to_dict('records'))
157
+
158
+ df_groups = pd.DataFrame(group_rows)
159
+ df_bad = pd.DataFrame(bad_rows)
160
+
161
+ print(f"📊 生成 df_groups: {len(df_groups)} 条, df_bad: {len(df_bad)} 条")
162
+
163
+ # -----------------------------
164
+ # 合并数据
165
+ # -----------------------------
166
+ df_final = pd.concat([df_groups, df_vid], ignore_index=True, sort=False)
167
+ print(f"📊 最终合并后的数据集: {len(df_final)} 条")
168
+
169
+ # -----------------------------
170
+ # 保存 CSV
171
+ # -----------------------------
172
+ df_final.to_csv(OUTPUT_CSV, index=False)
173
+ print(f"\n✅ 已保存为 {OUTPUT_CSV}")
174
+ print(f"📂 完整路径: {os.path.abspath(OUTPUT_CSV)}")