deepsafe commited on
Commit
5207201
·
verified ·
1 Parent(s): 8886d5d

chore: remove non-weight files (batch 6)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. video/dfd-fcg/model_code/configs/robustness/CC(3).yaml +0 -14
  2. video/dfd-fcg/model_code/configs/robustness/CC(4).yaml +0 -14
  3. video/dfd-fcg/model_code/configs/robustness/CC(5).yaml +0 -14
  4. video/dfd-fcg/model_code/configs/robustness/CS(1).yaml +0 -14
  5. video/dfd-fcg/model_code/configs/robustness/CS(2).yaml +0 -14
  6. video/dfd-fcg/model_code/configs/robustness/CS(3).yaml +0 -14
  7. video/dfd-fcg/model_code/configs/robustness/CS(4).yaml +0 -14
  8. video/dfd-fcg/model_code/configs/robustness/CS(5).yaml +0 -14
  9. video/dfd-fcg/model_code/configs/robustness/GB(1).yaml +0 -14
  10. video/dfd-fcg/model_code/configs/robustness/GB(2).yaml +0 -14
  11. video/dfd-fcg/model_code/configs/robustness/GB(3).yaml +0 -14
  12. video/dfd-fcg/model_code/configs/robustness/GB(4).yaml +0 -14
  13. video/dfd-fcg/model_code/configs/robustness/GB(5).yaml +0 -14
  14. video/dfd-fcg/model_code/configs/robustness/GNC(1).yaml +0 -14
  15. video/dfd-fcg/model_code/configs/robustness/GNC(2).yaml +0 -14
  16. video/dfd-fcg/model_code/configs/robustness/GNC(3).yaml +0 -14
  17. video/dfd-fcg/model_code/configs/robustness/GNC(4).yaml +0 -14
  18. video/dfd-fcg/model_code/configs/robustness/GNC(5).yaml +0 -14
  19. video/dfd-fcg/model_code/configs/robustness/JPEG(1).yaml +0 -14
  20. video/dfd-fcg/model_code/configs/robustness/JPEG(2).yaml +0 -14
  21. video/dfd-fcg/model_code/configs/robustness/JPEG(3).yaml +0 -14
  22. video/dfd-fcg/model_code/configs/robustness/JPEG(4).yaml +0 -14
  23. video/dfd-fcg/model_code/configs/robustness/JPEG(5).yaml +0 -14
  24. video/dfd-fcg/model_code/configs/robustness/VC(1).yaml +0 -14
  25. video/dfd-fcg/model_code/configs/robustness/VC(2).yaml +0 -14
  26. video/dfd-fcg/model_code/configs/robustness/VC(3).yaml +0 -14
  27. video/dfd-fcg/model_code/configs/robustness/VC(4).yaml +0 -14
  28. video/dfd-fcg/model_code/configs/robustness/VC(5).yaml +0 -14
  29. video/dfd-fcg/model_code/configs/scenario/LOO/DF.yaml +0 -32
  30. video/dfd-fcg/model_code/configs/scenario/LOO/F2F.yaml +0 -32
  31. video/dfd-fcg/model_code/configs/scenario/LOO/FS.yaml +0 -32
  32. video/dfd-fcg/model_code/configs/scenario/LOO/NT.yaml +0 -32
  33. video/dfd-fcg/model_code/configs/scenario/compression/c40.yaml +0 -55
  34. video/dfd-fcg/model_code/configs/scenario/compression/raw.yaml +0 -55
  35. video/dfd-fcg/model_code/configs/scenario/partial/10.yaml +0 -56
  36. video/dfd-fcg/model_code/configs/scenario/partial/25.yaml +0 -56
  37. video/dfd-fcg/model_code/configs/scenario/partial/50.yaml +0 -56
  38. video/dfd-fcg/model_code/configs/scenario/partial/75.yaml +0 -56
  39. video/dfd-fcg/model_code/configs/scenario/robust/robust.yaml +0 -33
  40. video/dfd-fcg/model_code/configs/test.yaml +0 -14
  41. video/dfd-fcg/model_code/demo.py +0 -192
  42. video/dfd-fcg/model_code/environment.yml +0 -129
  43. video/dfd-fcg/model_code/inference.py +0 -187
  44. video/dfd-fcg/model_code/main.py +0 -123
  45. video/dfd-fcg/model_code/misc/20words_mean_face.npy +0 -3
  46. video/dfd-fcg/model_code/misc/L14_real_semantic_patches_v4_2000.pickle +0 -3
  47. video/dfd-fcg/model_code/readme.md +0 -275
  48. video/dfd-fcg/model_code/resources/videos/000.mp4 +0 -3
  49. video/dfd-fcg/model_code/resources/videos/000_003.mp4 +0 -3
  50. video/dfd-fcg/model_code/scripts/ablation/ffg.sh +0 -6
video/dfd-fcg/model_code/configs/robustness/CC(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CC/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CC(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CC/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CC(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CC/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CS(1).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CS/1/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CS(2).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CS/2/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CS(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CS/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CS(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CS/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/CS(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/CS/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GB(1).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GB/1/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GB(2).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GB/2/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GB(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GB/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GB(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GB/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GB(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GB/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GNC(1).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GNC/1/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GNC(2).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GNC/2/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GNC(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GNC/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GNC(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GNC/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/GNC(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/GNC/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/JPEG(1).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/JPEG/1/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/JPEG(2).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/JPEG/2/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/JPEG(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/JPEG/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/JPEG(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/JPEG/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/JPEG(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/JPEG/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/VC(1).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/VC/1/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/VC(2).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/VC/2/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/VC(3).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/VC/3/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/VC(4).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/VC/4/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/robustness/VC(5).yaml DELETED
@@ -1,14 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- test_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- df_types: ['REAL','DF','FS','F2F','NT']
8
- compressions: ['c23']
9
- strategy: NORMAL
10
- augmentations:
11
- - NONE
12
- force_random_speed: null
13
- data_dir: 'datasets/robustness/VC/5/'
14
- vid_ext: .avi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/LOO/DF.yaml DELETED
@@ -1,32 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- train_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- batch_size: 30
8
- df_types: ['REAL','FS','F2F','NT']
9
- compressions: ['c23']
10
- strategy: FORCE_PAIR
11
- augmentations:
12
- - NORMAL
13
- - VIDEO
14
- - VIDEO_RRC
15
- - FRAME
16
- force_random_speed: null
17
- data_dir: 'datasets/ffpp/'
18
- vid_ext: '.avi'
19
- pack: false
20
- max_clips: 3
21
- val_datamodules:
22
- - class_path: src.dataset.ffpp.FFPPDataModule
23
- init_args:
24
- df_types: ['REAL','NT','FS','F2F']
25
- compressions: ['c23']
26
- strategy: NORMAL
27
- augmentations:
28
- - NONE
29
- data_dir: 'datasets/ffpp/'
30
- vid_ext: '.avi'
31
- pack: false
32
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/LOO/F2F.yaml DELETED
@@ -1,32 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- train_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- batch_size: 30
8
- df_types: ['REAL','DF','FS','NT']
9
- compressions: ['c23']
10
- strategy: FORCE_PAIR
11
- augmentations:
12
- - NORMAL
13
- - VIDEO
14
- - VIDEO_RRC
15
- - FRAME
16
- force_random_speed: null
17
- data_dir: 'datasets/ffpp/'
18
- vid_ext: '.avi'
19
- pack: false
20
- max_clips: 3
21
- val_datamodules:
22
- - class_path: src.dataset.ffpp.FFPPDataModule
23
- init_args:
24
- df_types: ['REAL','DF','FS','NT']
25
- compressions: ['c23']
26
- strategy: NORMAL
27
- augmentations:
28
- - NONE
29
- data_dir: 'datasets/ffpp/'
30
- vid_ext: '.avi'
31
- pack: false
32
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/LOO/FS.yaml DELETED
@@ -1,32 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- train_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- batch_size: 30
8
- df_types: ['REAL','DF','F2F','NT']
9
- compressions: ['c23']
10
- strategy: FORCE_PAIR
11
- augmentations:
12
- - NORMAL
13
- - VIDEO
14
- - VIDEO_RRC
15
- - FRAME
16
- force_random_speed: null
17
- data_dir: 'datasets/ffpp/'
18
- vid_ext: '.avi'
19
- pack: false
20
- max_clips: 3
21
- val_datamodules:
22
- - class_path: src.dataset.ffpp.FFPPDataModule
23
- init_args:
24
- df_types: ['REAL','DF','F2F','NT']
25
- compressions: ['c23']
26
- strategy: NORMAL
27
- augmentations:
28
- - NONE
29
- data_dir: 'datasets/ffpp/'
30
- vid_ext: '.avi'
31
- pack: false
32
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/LOO/NT.yaml DELETED
@@ -1,32 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- train_datamodules:
5
- - class_path: src.dataset.ffpp.FFPPDataModule
6
- init_args:
7
- batch_size: 30
8
- df_types: ['REAL','DF','FS','F2F']
9
- compressions: ['c23']
10
- strategy: FORCE_PAIR
11
- augmentations:
12
- - NORMAL
13
- - VIDEO
14
- - VIDEO_RRC
15
- - FRAME
16
- force_random_speed: null
17
- data_dir: 'datasets/ffpp/'
18
- vid_ext: '.avi'
19
- pack: false
20
- max_clips: 3
21
- val_datamodules:
22
- - class_path: src.dataset.ffpp.FFPPDataModule
23
- init_args:
24
- df_types: ['REAL','DF','FS','F2F']
25
- compressions: ['c23']
26
- strategy: NORMAL
27
- augmentations:
28
- - NONE
29
- data_dir: 'datasets/ffpp/'
30
- vid_ext: '.avi'
31
- pack: false
32
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/compression/c40.yaml DELETED
@@ -1,55 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c40']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- max_clips: 3
25
- val_datamodules:
26
- - class_path: src.dataset.ffpp.FFPPDataModule
27
- init_args:
28
- df_types: ['REAL','DF','FS','F2F','NT']
29
- compressions: ['c40']
30
- strategy: NORMAL
31
- augmentations:
32
- - NONE
33
- data_dir: 'datasets/ffpp/'
34
- vid_ext: '.avi'
35
- pack: false
36
- max_clips: 1
37
- - class_path: src.dataset.cdf.CDFDataModule
38
- init_args:
39
- data_dir: 'datasets/cdf/'
40
- vid_ext: '.avi'
41
- pack: false
42
- max_clips: 1
43
- - class_path: src.dataset.dfdc.DFDCDataModule
44
- init_args:
45
- data_dir: 'datasets/dfdc/'
46
- vid_ext: '.avi'
47
- pack: false
48
- max_clips: 1
49
- - class_path: src.dataset.fsh.FShDataModule
50
- init_args:
51
- compressions: ['c40']
52
- data_dir: 'datasets/ffpp/'
53
- vid_ext: '.avi'
54
- pack: false
55
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/compression/raw.yaml DELETED
@@ -1,55 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['raw']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- max_clips: 3
25
- val_datamodules:
26
- - class_path: src.dataset.ffpp.FFPPDataModule
27
- init_args:
28
- df_types: ['REAL','DF','FS','F2F','NT']
29
- compressions: ['raw']
30
- strategy: NORMAL
31
- augmentations:
32
- - NONE
33
- data_dir: 'datasets/ffpp/'
34
- vid_ext: '.avi'
35
- pack: false
36
- max_clips: 1
37
- - class_path: src.dataset.cdf.CDFDataModule
38
- init_args:
39
- data_dir: 'datasets/cdf/'
40
- vid_ext: '.avi'
41
- pack: false
42
- max_clips: 1
43
- - class_path: src.dataset.dfdc.DFDCDataModule
44
- init_args:
45
- data_dir: 'datasets/dfdc/'
46
- vid_ext: '.avi'
47
- pack: false
48
- max_clips: 1
49
- - class_path: src.dataset.fsh.FShDataModule
50
- init_args:
51
- compressions: ['raw']
52
- data_dir: 'datasets/ffpp/'
53
- vid_ext: '.avi'
54
- pack: false
55
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/partial/10.yaml DELETED
@@ -1,56 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c23']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- ratio: 0.1
25
- max_clips: 3
26
- val_datamodules:
27
- - class_path: src.dataset.ffpp.FFPPDataModule
28
- init_args:
29
- df_types: ['REAL','DF','FS','F2F','NT']
30
- compressions: ['c23']
31
- strategy: NORMAL
32
- augmentations:
33
- - NONE
34
- data_dir: 'datasets/ffpp/'
35
- vid_ext: '.avi'
36
- pack: false
37
- max_clips: 1
38
- - class_path: src.dataset.cdf.CDFDataModule
39
- init_args:
40
- data_dir: 'datasets/cdf/'
41
- vid_ext: '.avi'
42
- pack: false
43
- max_clips: 1
44
- - class_path: src.dataset.dfdc.DFDCDataModule
45
- init_args:
46
- data_dir: 'datasets/dfdc/'
47
- vid_ext: '.avi'
48
- pack: false
49
- max_clips: 1
50
- - class_path: src.dataset.fsh.FShDataModule
51
- init_args:
52
- compressions: ['c23']
53
- data_dir: 'datasets/ffpp/'
54
- vid_ext: '.avi'
55
- pack: false
56
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/partial/25.yaml DELETED
@@ -1,56 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c23']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- ratio: 0.25
25
- max_clips: 3
26
- val_datamodules:
27
- - class_path: src.dataset.ffpp.FFPPDataModule
28
- init_args:
29
- df_types: ['REAL','DF','FS','F2F','NT']
30
- compressions: ['c23']
31
- strategy: NORMAL
32
- augmentations:
33
- - NONE
34
- data_dir: 'datasets/ffpp/'
35
- vid_ext: '.avi'
36
- pack: false
37
- max_clips: 1
38
- - class_path: src.dataset.cdf.CDFDataModule
39
- init_args:
40
- data_dir: 'datasets/cdf/'
41
- vid_ext: '.avi'
42
- pack: false
43
- max_clips: 1
44
- - class_path: src.dataset.dfdc.DFDCDataModule
45
- init_args:
46
- data_dir: 'datasets/dfdc/'
47
- vid_ext: '.avi'
48
- pack: false
49
- max_clips: 1
50
- - class_path: src.dataset.fsh.FShDataModule
51
- init_args:
52
- compressions: ['c23']
53
- data_dir: 'datasets/ffpp/'
54
- vid_ext: '.avi'
55
- pack: false
56
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/partial/50.yaml DELETED
@@ -1,56 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c23']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- ratio: 0.50
25
- max_clips: 3
26
- val_datamodules:
27
- - class_path: src.dataset.ffpp.FFPPDataModule
28
- init_args:
29
- df_types: ['REAL','DF','FS','F2F','NT']
30
- compressions: ['c23']
31
- strategy: NORMAL
32
- augmentations:
33
- - NONE
34
- data_dir: 'datasets/ffpp/'
35
- vid_ext: '.avi'
36
- pack: false
37
- max_clips: 1
38
- - class_path: src.dataset.cdf.CDFDataModule
39
- init_args:
40
- data_dir: 'datasets/cdf/'
41
- vid_ext: '.avi'
42
- pack: false
43
- max_clips: 1
44
- - class_path: src.dataset.dfdc.DFDCDataModule
45
- init_args:
46
- data_dir: 'datasets/dfdc/'
47
- vid_ext: '.avi'
48
- pack: false
49
- max_clips: 1
50
- - class_path: src.dataset.fsh.FShDataModule
51
- init_args:
52
- compressions: ['c23']
53
- data_dir: 'datasets/ffpp/'
54
- vid_ext: '.avi'
55
- pack: false
56
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/partial/75.yaml DELETED
@@ -1,56 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c23']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - NORMAL
17
- - VIDEO
18
- - VIDEO_RRC
19
- - FRAME
20
- force_random_speed: null
21
- data_dir: 'datasets/ffpp/'
22
- vid_ext: '.avi'
23
- pack: false
24
- ratio: 0.75
25
- max_clips: 3
26
- val_datamodules:
27
- - class_path: src.dataset.ffpp.FFPPDataModule
28
- init_args:
29
- df_types: ['REAL','DF','FS','F2F','NT']
30
- compressions: ['c23']
31
- strategy: NORMAL
32
- augmentations:
33
- - NONE
34
- data_dir: 'datasets/ffpp/'
35
- vid_ext: '.avi'
36
- pack: false
37
- max_clips: 1
38
- - class_path: src.dataset.cdf.CDFDataModule
39
- init_args:
40
- data_dir: 'datasets/cdf/'
41
- vid_ext: '.avi'
42
- pack: false
43
- max_clips: 1
44
- - class_path: src.dataset.dfdc.DFDCDataModule
45
- init_args:
46
- data_dir: 'datasets/dfdc/'
47
- vid_ext: '.avi'
48
- pack: false
49
- max_clips: 1
50
- - class_path: src.dataset.fsh.FShDataModule
51
- init_args:
52
- compressions: ['c23']
53
- data_dir: 'datasets/ffpp/'
54
- vid_ext: '.avi'
55
- pack: false
56
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/scenario/robust/robust.yaml DELETED
@@ -1,33 +0,0 @@
1
- data:
2
- class_path: src.dataset.base.ODDeepFakeDataModule
3
- init_args:
4
- batch_size: 20
5
- num_workers: 4
6
- clip_duration: 3
7
- num_frames: 10
8
- train_datamodules:
9
- - class_path: src.dataset.ffpp.FFPPDataModule
10
- init_args:
11
- batch_size: 30
12
- df_types: ['REAL','DF','FS','F2F','NT']
13
- compressions: ['c23']
14
- strategy: FORCE_PAIR
15
- augmentations:
16
- - ROBUSTNESS
17
- force_random_speed: null
18
- data_dir: 'datasets/ffpp/'
19
- vid_ext: '.avi'
20
- pack: false
21
- max_clips: 3
22
- val_datamodules:
23
- - class_path: src.dataset.ffpp.FFPPDataModule
24
- init_args:
25
- df_types: ['REAL','DF','FS','F2F','NT']
26
- compressions: ['c23']
27
- strategy: NORMAL
28
- augmentations:
29
- - NONE
30
- data_dir: 'datasets/ffpp/'
31
- vid_ext: '.avi'
32
- pack: false
33
- max_clips: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/configs/test.yaml DELETED
@@ -1,14 +0,0 @@
1
- trainer:
2
- logger:
3
- init_args:
4
- offline: true
5
- limit_train_batches: 30
6
- limit_val_batches: 30
7
- accumulate_grad_batches: 1
8
- data:
9
- init_args:
10
- batch_size: 1
11
- num_workers: 0
12
- train_datamodules:
13
- - init_args:
14
- batch_size: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/demo.py DELETED
@@ -1,192 +0,0 @@
1
- import os
2
- import cv2
3
- import sys
4
- import yaml
5
- import json
6
- import math
7
- import torch
8
- import pickle
9
- import shutil
10
- import logging
11
- import warnings
12
- import argparse
13
- import numpy as np
14
-
15
-
16
- from os import path
17
- from datetime import datetime
18
- from torchvision.io import VideoReader
19
- from src.utility.builtin import ODTrainer, ODLightningCLI
20
-
21
-
22
- def parse_args(args=None):
23
- parser = argparse.ArgumentParser()
24
- parser.add_argument("model_cfg_path", type=str)
25
- parser.add_argument("model_ckpt_path", type=str)
26
- parser.add_argument("video_path", type=str)
27
- parser.add_argument("--out_path", type=str, default=None)
28
- parser.add_argument("--threshold", type=float, default=0.5)
29
- parser.add_argument("--precision", type=str, default="16")
30
- parser.add_argument("--batch_size", type=int, default=30)
31
- return parser.parse_args(args=args)
32
-
33
-
34
- def configure_logging():
35
- logging_fmt = "[%(levelname)s][%(filename)s:%(lineno)d]: %(message)s"
36
- logging.basicConfig(level="INFO", format=logging_fmt)
37
- warnings.filterwarnings(action="ignore")
38
-
39
-
40
- @torch.inference_mode()
41
- def demo_driver(cli, ckpt_path, video_path, out_path, batch_size, threshold):
42
- # setup model
43
- model = cli.model
44
-
45
- try:
46
- model = model.__class__.load_from_checkpoint(ckpt_path)
47
- except Exception as e:
48
- print(f"Unable to load model from checkpoint in strict mode: {e}")
49
- print(f"Loading model from checkpoint in non-strict mode.")
50
- model = model.__class__.load_from_checkpoint(ckpt_path, strict=False)
51
-
52
- model.eval()
53
- transforms = model.transform
54
-
55
- BATCH = batch_size
56
- stride = 0.333
57
-
58
- # load original video
59
- vid_reader = VideoReader(video_path, "video", num_threads=1)
60
- vid_ext = os.path.splitext(video_path)[-1]
61
- vid_name = os.path.split(video_path)[1].replace(vid_ext, "")
62
- fps = vid_reader.get_metadata()["video"]["fps"][0]
63
-
64
- frames = []
65
- for frame_data in vid_reader:
66
- frames.append(frame_data["data"])
67
- frames = torch.stack(frames)
68
- del vid_reader
69
- _, H, W = frames[0].shape
70
-
71
- # load bboxes of original video
72
- with open(video_path.replace("videos", "frame_data").replace(vid_ext, ".pickle"), "rb") as f:
73
- fdata = pickle.load(f)
74
- bboxes = []
75
- for data in fdata:
76
- data["bboxes"] = [
77
- bbox.reshape(2, -1)
78
- if len(bbox.shape) == 1 else bbox
79
- for bbox in data["bboxes"]
80
- ]
81
- face_idx = np.argsort([
82
- np.linalg.norm((bbox[0] - bbox[1])) for bbox in data["bboxes"]
83
- ])[-1]
84
- bboxes.append(data["bboxes"][face_idx])
85
-
86
- # load face cropped video
87
- vid_reader = VideoReader(
88
- video_path.replace("/videos", "/cropped/videos").replace(vid_ext, ".avi"),
89
- "video",
90
- num_threads=1
91
- )
92
- cropped_frames = []
93
- for frame_data in vid_reader:
94
- cropped_frames.append(frame_data["data"])
95
- cropped_frames = torch.stack(cropped_frames)
96
- del vid_reader
97
-
98
- # sample frames and inference
99
- indices = torch.tensor([int(math.floor(i * stride * fps)) for i in range(10)], dtype=torch.long)
100
- probs = []
101
- i = 0
102
- clip_count = len(cropped_frames) - indices[-1]
103
- while (i < clip_count):
104
- batch = min(clip_count - i, BATCH)
105
- clips = torch.stack([
106
- transforms(cropped_frames[indices + i + j]) for j in range(batch)
107
- ]).to("cuda")
108
- results = model.evaluate(clips)
109
- probs.extend(results["logits"].softmax(dim=-1)[:, 1].flatten().cpu().tolist())
110
- i += batch
111
-
112
- # draw and write to video
113
- bbox_frames = []
114
- for frame, bbox, prob in zip(frames[indices[-1]:], bboxes[indices[-1]:], probs):
115
- frame = frame.permute(1, 2, 0).numpy()
116
- frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
117
- thickness = int(np.linalg.norm(bbox[0] - bbox[1]) * 0.01)
118
- color = (0, 255, 0) if prob < threshold else (0, 0, 255)
119
- category = "REAL" if prob < threshold else "FAKE"
120
- frame = cv2.rectangle(
121
- frame,
122
- bbox[0].astype(int),
123
- bbox[1].astype(int),
124
- color,
125
- thickness
126
- )
127
- frame = cv2.putText(
128
- frame,
129
- f'{round(prob,2)}',
130
- [int(bbox[0][0]), int(bbox[1][1] - thickness)],
131
- cv2.FONT_HERSHEY_SIMPLEX,
132
- 1, color, thickness, cv2.LINE_AA
133
- )
134
-
135
- frame = cv2.putText(
136
- frame,
137
- category,
138
- [int(bbox[0][0]), int(bbox[0][1] - thickness)],
139
- cv2.FONT_HERSHEY_SIMPLEX,
140
- 1, color, thickness, cv2.LINE_AA
141
- )
142
-
143
- bbox_frames.append(frame)
144
-
145
- out_path = (f'pred_{vid_name}.avi' if out_path is None else out_path)
146
-
147
- writer = cv2.VideoWriter(
148
- out_path,
149
- cv2.VideoWriter_fourcc('X', 'V', 'I', 'D'),
150
- fps,
151
- (W, H)
152
- )
153
-
154
- for frame in bbox_frames:
155
- writer.write(frame)
156
-
157
- writer.release()
158
-
159
-
160
- if __name__ == "__main__":
161
- configure_logging()
162
-
163
- params = parse_args()
164
-
165
- cli = ODLightningCLI(
166
- run=False,
167
- trainer_class=ODTrainer,
168
- save_config_callback=None,
169
- parser_kwargs={
170
- "parser_mode": "omegaconf"
171
- },
172
- auto_configure_optimizers=False,
173
- seed_everything_default=1019,
174
- args=[
175
- '-c', params.model_cfg_path,
176
- '--trainer.logger=null',
177
- f'--trainer.devices=1',
178
- f'--trainer.precision={params.precision}',
179
- ],
180
- )
181
-
182
- ckpt_path = params.model_ckpt_path
183
- video_path = params.video_path
184
-
185
- demo_driver(
186
- cli=cli,
187
- ckpt_path=ckpt_path,
188
- video_path=video_path,
189
- batch_size=params.batch_size,
190
- threshold=params.threshold,
191
- out_path=params.out_path
192
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/environment.yml DELETED
@@ -1,129 +0,0 @@
1
- name: dfd-fcg
2
- channels:
3
- - defaults
4
- dependencies:
5
- - _libgcc_mutex=0.1
6
- - _openmp_mutex=5.1
7
- - ca-certificates=2023.12.12
8
- - ld_impl_linux-64=2.38
9
- - libffi=3.4.4
10
- - libgcc-ng=11.2.0
11
- - libgomp=11.2.0
12
- - libstdcxx-ng=11.2.0
13
- - ncurses=6.4
14
- - openssl=3.0.13
15
- - pip=23.3.1
16
- - python=3.8.18
17
- - readline=8.2
18
- - setuptools=68.2.2
19
- - sqlite=3.41.2
20
- - tk=8.6.12
21
- - wheel=0.41.2
22
- - xz=5.4.6
23
- - zlib=1.2.13
24
- - pip:
25
- - aiohttp==3.9.3
26
- - aiosignal==1.3.1
27
- - albumentations==1.4.0
28
- - antlr4-python3-runtime==4.9.3
29
- - appdirs==1.4.4
30
- - async-timeout==4.0.3
31
- - attrs==23.2.0
32
- - av==11.0.0
33
- - bitsandbytes==0.41.0
34
- - certifi==2024.2.2
35
- - charset-normalizer==3.3.2
36
- - click==8.1.7
37
- - contourpy==1.1.1
38
- - cycler==0.12.1
39
- - docker-pycreds==0.4.0
40
- - docstring-parser==0.15
41
- - face-alignment==1.4.1
42
- - filelock==3.13.1
43
- - fonttools==4.49.0
44
- - frozenlist==1.4.1
45
- - fsspec==2024.2.0
46
- - ftfy==6.1.3
47
- - gitdb==4.0.11
48
- - gitpython==3.1.42
49
- - huggingface-hub==0.21.3
50
- - hydra-core==1.3.2
51
- - idna==3.6
52
- - imageio==2.34.0
53
- - importlib-resources==6.1.2
54
- - jinja2==3.1.3
55
- - joblib==1.3.2
56
- - jsonargparse==4.27.5
57
- - kiwisolver==1.4.5
58
- - lazy-loader==0.3
59
- - lightning==2.2.0.post0
60
- - lightning-utilities==0.10.1
61
- - markdown-it-py==3.0.0
62
- - markupsafe==2.1.5
63
- - matplotlib==3.7.5
64
- - mdurl==0.1.2
65
- - mpmath==1.3.0
66
- - multidict==6.0.5
67
- - networkx==3.1
68
- - numpy==1.24.4
69
- - nvidia-cublas-cu12==12.1.3.1
70
- - nvidia-cuda-cupti-cu12==12.1.105
71
- - nvidia-cuda-nvrtc-cu12==12.1.105
72
- - nvidia-cuda-runtime-cu12==12.1.105
73
- - nvidia-cudnn-cu12==8.9.2.26
74
- - nvidia-cufft-cu12==11.0.2.54
75
- - nvidia-curand-cu12==10.3.2.106
76
- - nvidia-cusolver-cu12==11.4.5.107
77
- - nvidia-cusparse-cu12==12.1.0.106
78
- - nvidia-nccl-cu12==2.19.3
79
- - nvidia-nvjitlink-cu12==12.3.101
80
- - nvidia-nvtx-cu12==12.1.105
81
- - omegaconf==2.3.0
82
- - open-clip-torch==2.24.0
83
- - opencv-python==4.9.0.80
84
- - opencv-python-headless==4.9.0.80
85
- - packaging==23.2
86
- - pandas==2.0.3
87
- - pillow==10.2.0
88
- - protobuf==4.25.3
89
- - psutil==5.9.8
90
- - pygments==2.17.2
91
- - pyparsing==3.1.1
92
- - python-dateutil==2.9.0.post0
93
- - pytorch-lightning==2.2.0.post0
94
- - pytz==2024.1
95
- - pywavelets==1.4.1
96
- - pyyaml==6.0.1
97
- - qudida==0.0.4
98
- - regex==2023.12.25
99
- - requests==2.31.0
100
- - rich==13.7.1
101
- - safetensors==0.4.2
102
- - scikit-image==0.21.0
103
- - scikit-learn==1.3.2
104
- - scipy==1.10.1
105
- - sentencepiece==0.2.0
106
- - sentry-sdk==1.40.6
107
- - setproctitle==1.3.3
108
- - six==1.16.0
109
- - smmap==5.0.1
110
- - sympy==1.12
111
- - tensorboardx==2.6.2.2
112
- - threadpoolctl==3.3.0
113
- - tifffile==2023.7.10
114
- - timm==0.9.16
115
- - torch==2.2.1
116
- - torchaudio==2.2.1
117
- - torchmetrics==1.3.1
118
- - torchvision==0.17.1
119
- - tqdm==4.66.2
120
- - triton==2.2.0
121
- - typeshed-client==2.5.1
122
- - typing-extensions==4.10.0
123
- - tzdata==2024.1
124
- - urllib3==2.2.1
125
- - wandb==0.16.3
126
- - wcwidth==0.2.13
127
- - yarl==1.9.4
128
- - zipp==3.17.0
129
- prefix: /home/od/miniconda3/envs/dfd-fcg
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/inference.py DELETED
@@ -1,187 +0,0 @@
1
- import os
2
- import sys
3
- import yaml
4
- import json
5
- import torch
6
- import pickle
7
- import shutil
8
- import logging
9
- import warnings
10
- import argparse
11
-
12
-
13
- from os import path
14
- from datetime import datetime
15
- from torchmetrics.classification import AUROC, Accuracy
16
- from src.utility.builtin import ODTrainer, ODLightningCLI
17
-
18
-
19
- def parse_args(args=None):
20
- parser = argparse.ArgumentParser()
21
- parser.add_argument("model_cfg_path", type=str)
22
- parser.add_argument("data_cfg_path", type=str)
23
- parser.add_argument("model_ckpt_path", type=str)
24
- parser.add_argument("--precision", type=str, default="16")
25
- parser.add_argument("--devices", type=int, default=-1)
26
- parser.add_argument("--notes", type=str, default='')
27
- return parser.parse_args(args=args)
28
-
29
-
30
- class StatsRecorder:
31
- def __init__(self, label):
32
- self.label = label
33
- self.prob = 0
34
- self.count = 0
35
-
36
- def update(self, prob, label):
37
- assert label == self.label
38
- self.prob += prob
39
- self.count += 1
40
-
41
- def compute(self):
42
- return {
43
- "label": self.label,
44
- "prob": self.prob / self.count
45
- }
46
-
47
-
48
- def configure_logging():
49
- logging_fmt = "[%(levelname)s][%(filename)s:%(lineno)d]: %(message)s"
50
- logging.basicConfig(level="INFO", format=logging_fmt)
51
- warnings.filterwarnings(action="ignore")
52
-
53
-
54
- @torch.inference_mode()
55
- def inference_driver(cli, cfg_dir, ckpt_path, notes=None):
56
-
57
- timestamp = datetime.now().strftime("%m%dT%H%M%S")
58
-
59
- trainer = cli.trainer
60
-
61
- # setup model
62
- model = cli.model
63
-
64
- try:
65
- model = model.__class__.load_from_checkpoint(ckpt_path)
66
- except Exception as e:
67
- print(f"Unable to load model from checkpoint in strict mode: {e}")
68
- print(f"Loading model from checkpoint in non-strict mode.")
69
- model = model.__class__.load_from_checkpoint(ckpt_path, strict=False)
70
-
71
- model.eval()
72
-
73
- # setup dataset
74
- datamodule = cli.datamodule
75
- datamodule.prepare_data()
76
- datamodule.affine_model(cli.model)
77
- datamodule.setup('test')
78
-
79
- stats = {}
80
- report = {}
81
-
82
- test_dataloaders = datamodule.test_dataloader()
83
-
84
- for dts_name, dataloader in test_dataloaders.items():
85
- # iterate all videos
86
- auc_calc = AUROC(task="BINARY", num_classes=2)
87
- acc_calc = Accuracy(task="BINARY", num_classes=2)
88
- dataset = dataloader.dataset
89
- dts_stats = {}
90
-
91
- # perform ddp prediction
92
- batch_results = trainer.predict(
93
- model=model,
94
- dataloaders=[dataloader]
95
- )
96
-
97
- gathered_results = [None] * torch.distributed.get_world_size()
98
- torch.distributed.all_gather_object(gathered_results, batch_results)
99
- torch.distributed.barrier()
100
-
101
- if (trainer.is_global_zero):
102
- # fetch predict results and aggregate.
103
- for batch_results in gathered_results:
104
- for batch_result in batch_results:
105
- probs = batch_result["probs"]
106
- names = batch_result["names"]
107
- y = batch_result["y"]
108
- for prob, label, name in zip(probs, y, names):
109
- if (not name in dts_stats):
110
- dts_stats[name] = StatsRecorder(label)
111
- dts_stats[name].update(prob, label)
112
-
113
- # compute the average probability.
114
- for k in dts_stats:
115
- dts_stats[k] = dts_stats[k].compute()
116
-
117
- # add straying videos into metric calculation
118
- for k, v in dataset.stray_videos.items():
119
- dts_stats[k] = dict(
120
- label=v,
121
- prob=0.5,
122
- stray=1
123
- )
124
-
125
- # compute the metric scores
126
- dataset_labels = []
127
- dataset_probs = []
128
- for v in dts_stats.values():
129
- dataset_labels.append(v["label"])
130
- dataset_probs.append(v["prob"])
131
- dataset_labels = torch.tensor(dataset_labels)
132
- dataset_probs = torch.tensor(dataset_probs)
133
- accuracy = acc_calc(dataset_probs, dataset_labels).item()
134
- roc_auc = auc_calc(dataset_probs, dataset_labels).item()
135
- accuracy = round(accuracy, 3)
136
- roc_auc = round(roc_auc, 3)
137
- logging.info(f'[{dts_name}] accuracy: {accuracy}, roc_auc: {roc_auc}')
138
- stats[dts_name] = dts_stats
139
- report[dts_name] = {
140
- "accuracy": accuracy,
141
- "roc_auc": roc_auc
142
- }
143
-
144
- if (trainer.is_global_zero):
145
- # save report and stats.
146
- with open(path.join(cfg_dir, f'report_{timestamp}.json'), "w") as f:
147
- json.dump(report, f, sort_keys=True, indent=4, separators=(',', ': '))
148
-
149
- with open(path.join(cfg_dir, f'stats_{timestamp}.pickle'), "wb") as f:
150
- pickle.dump(stats, f)
151
-
152
- return report
153
-
154
-
155
- if __name__ == "__main__":
156
- configure_logging()
157
-
158
- params = parse_args()
159
-
160
- cli = ODLightningCLI(
161
- run=False,
162
- trainer_class=ODTrainer,
163
- save_config_callback=None,
164
- parser_kwargs={
165
- "parser_mode": "omegaconf"
166
- },
167
- auto_configure_optimizers=False,
168
- seed_everything_default=1019,
169
- args=[
170
- '-c', params.model_cfg_path,
171
- '-c', params.data_cfg_path,
172
- '--trainer.logger=null',
173
- f'--trainer.devices={params.devices}',
174
- f'--trainer.precision={params.precision}',
175
- ],
176
- )
177
-
178
- cfg_dir = os.path.split(params.model_cfg_path)[0]
179
- ckpt_path = params.model_ckpt_path
180
- notes = params.notes
181
-
182
- inference_driver(
183
- cli=cli,
184
- cfg_dir=cfg_dir,
185
- ckpt_path=ckpt_path,
186
- notes=notes
187
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/main.py DELETED
@@ -1,123 +0,0 @@
1
- import os
2
- import gc
3
- import json
4
- import torch
5
- import logging
6
- import warnings
7
- import lightning.pytorch as pl
8
-
9
- from lightning.pytorch.utilities import rank_zero_only
10
- from src.utility.builtin import ODTrainer, ODLightningCLI
11
- from inference import inference_driver
12
- torch.set_float32_matmul_precision('high')
13
-
14
-
15
- def configure_logging():
16
- logging_fmt = "[%(levelname)s][%(filename)s:%(lineno)d]: %(message)s"
17
- logging.basicConfig(level="INFO", format=logging_fmt)
18
- warnings.filterwarnings(action="ignore")
19
-
20
- # disable warnings from the xformers efficient attention module due to torch.user_deterministic_algorithms(True,warn_only=True)
21
- warnings.filterwarnings(
22
- action="ignore",
23
- message=".*efficient_attention_forward_cutlass.*",
24
- category=UserWarning
25
- )
26
-
27
- # logging.basicConfig(level="DEBUG", format=logging_fmt)
28
-
29
-
30
- def configure_cli():
31
- return ODLightningCLI(
32
- run=False,
33
- trainer_class=ODTrainer,
34
- save_config_kwargs={
35
- 'config_filename': 'setting.yaml'
36
- },
37
- auto_configure_optimizers=True,
38
- seed_everything_default=1019
39
- )
40
-
41
-
42
- def inference(cli):
43
- # inference the best model
44
- cfg_dir = cli.trainer.log_dir
45
- ckpt_path = cli.trainer.checkpoint_callback.best_model_path
46
-
47
- results = inference_driver(
48
- cli=cli,
49
- cfg_dir=cfg_dir,
50
- ckpt_path=ckpt_path,
51
- )
52
-
53
- # log inference results
54
- cli.trainer.logger.experiment.log(
55
- {
56
- "/".join(["infer", dts_name, metric]): value
57
- for dts_name, metrics in results.items()
58
- for metric, value in metrics.items()
59
- },
60
- commit=True
61
- )
62
-
63
- return results
64
-
65
-
66
- def cli_main():
67
- # logging configuration
68
- configure_logging()
69
-
70
- # initialize cli
71
- cli = configure_cli()
72
-
73
- # update experiment notes
74
- cli.trainer.logger.experiment.notes = cli.config.notes
75
- cli.trainer.logger.experiment.save()
76
-
77
- # monitor model gradient and parameter histograms
78
- # (this severely slow down the training speed)
79
- # cli.trainer.logger.experiment.watch(cli.model, log='all', log_graph=False)
80
-
81
- # load & configure datasets
82
- cli.datamodule.affine_model(cli.model)
83
- cli.datamodule.affine_trainer(cli.trainer)
84
-
85
- # determine the purpose of the given checkpoint
86
- cont_ckpt_path = None
87
- if not cli.config.ckpt_path is None:
88
- if cli.config.ckpt_mode == "cont":
89
- cont_ckpt_path = cli.config.ckpt_path
90
- elif cli.config.ckpt_mode == "tune":
91
- cli.model.load_state_dict(torch.load(cli.config.ckpt_path)["state_dict"])
92
- else:
93
- raise NotImplementedError()
94
-
95
- # run
96
- cli.trainer.fit(
97
- cli.model,
98
- datamodule=cli.datamodule,
99
- ckpt_path=cont_ckpt_path
100
- )
101
-
102
- # after training:
103
- # 1. unwatch model
104
- # cli.trainer.logger.experiment.unwatch(cli.model)
105
- # 2. save the config
106
- cli.trainer.logger.experiment.save(
107
- glob_str=os.path.join(cli.trainer.log_dir, 'setting.yaml'),
108
- base_path=cli.trainer.log_dir,
109
- policy="now"
110
- )
111
-
112
- gc.collect()
113
- torch.cuda.empty_cache()
114
-
115
- # inference the best model.
116
- scores = inference(cli=cli)
117
-
118
- # finally
119
- cli.trainer.logger.experiment.finish()
120
-
121
-
122
- if __name__ == "__main__":
123
- cli_main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/misc/20words_mean_face.npy DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:dbf68b2044171e1160716df7c53e8bbfaa0ee8c61fb41171d04cb6092bb81422
3
- size 1168
 
 
 
 
video/dfd-fcg/model_code/misc/L14_real_semantic_patches_v4_2000.pickle DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:438555d515700f0fdc4a1f2af2ca620d879fa7c91ca7018579e23aae94f0f72a
3
- size 2100301
 
 
 
 
video/dfd-fcg/model_code/readme.md DELETED
@@ -1,275 +0,0 @@
1
- <p align="center">
2
- <h1 align="center">[CVPR'25] Towards More General Video-based Deepfake Detection through Facial Component Guided Adaptation for Foundation Model (DFD-FCG)</h1>
3
-
4
- <p align="center">
5
- <a href="https://github.com/ODD2"><strong>Yue-Hua Han</strong></a>
6
- <sup>1,3,4</sup>
7
- &nbsp;&nbsp;
8
- <a href="https://github.com/Teddy12155555"><strong>Tai-Ming Huang</strong></a>
9
- <sup>1,3,4</sup>
10
- &nbsp;&nbsp;
11
- <a href="https://scholar.google.com/citations?user=nnzQtDAAAAAJ&hl=zh-TW"><strong>Kai-Lung Hua</strong></a>
12
- <sup>2,4</sup>
13
- &nbsp;&nbsp;
14
- <a href="https://scholar.google.com.au/citations?user=3x9KITUAAAAJ&hl=en"><strong> Jun-Cheng Chen</strong></a>
15
- <sup>1</sup>
16
- <br>
17
- <!-- <sup>1</sup>Academia Sinica&nbsp;
18
- <sup>2</sup>Microsoft&nbsp;
19
- <sup>3</sup>National Taiwan University&nbsp;
20
- <br>
21
- <sup>4</sup>National Taiwan University of Science and Technology&nbsp; -->
22
- <sup>1</sup>Academia Sinica,</span>&nbsp;
23
- <sup>2</sup>Microsoft,</span>&nbsp;
24
- <sup>3</sup>National Taiwan University,</span>&nbsp;
25
- <br>
26
- <sup>4</sup>National Taiwan University of Science and Technology</span>&nbsp;
27
- <br>
28
- <a href='https://arxiv.org/abs/2404.05583'><img src='https://img.shields.io/badge/ArXiv-2404.05583-red'></a>&nbsp;
29
- <img src="assets/teaser.png">
30
- </p>
31
- </p>
32
-
33
- ## 🥇Abstract
34
- <div style="text-align: justify">
35
- Generative models have enabled the creation of highly realistic facial-synthetic images, raising significant concerns due to their potential for misuse. Despite rapid advancements in the field of deepfake detection, developing efficient approaches to leverage foundation models for improved generalizability to unseen forgery samples remains challenging. To address this challenge, we propose a novel side-network-based decoder that extracts spatial and temporal cues using the CLIP image encoder for generalized video-based Deepfake detection. Additionally, we introduce Facial Component Guidance (FCG) to enhance spatial learning generalizability by encouraging the model to focus on key facial regions. By leveraging the generic features of a vision-language foundation model, our approach demonstrates promising generalizability on challenging Deepfake datasets while also exhibiting superiority in training data efficiency, parameter efficiency, and model robustness.
36
- </div>
37
-
38
- ## 📝TODOs
39
- - [x] Training + Evaluation Code
40
- - [x] Model Weights
41
- - [x] Inference Code
42
- - [ ] HeyGen Evaluation Dataset
43
-
44
-
45
- ## 🙌News
46
- - June 08: We have released the [model checkpoint](https://drive.google.com/file/d/1ydD5rnaaF0i2zLE7NidLtAhjonHoVQOk/view?usp=sharing) and provided inference code for single videos! Checkout [this section](#inference---demo-video) for further details!
47
-
48
- ## 🚀Installation
49
- ```shell
50
- # conda environment
51
- conda env create -f environment.yml
52
- ```
53
-
54
- ## 📂Dataset Structure
55
- The structure of the **pre-processed datasets** for our project, the video files (*.avi) have been processed to only retain the aligned face. We use soft-links **(ln -s)** to manage and link the folders containing pre-processed videos on different drives.
56
- ```shell
57
- datasets
58
- ├── cdf
59
- │ ├── FAKE
60
- │ │ └── videos
61
- │ │ └── *.avi
62
- │ ├── REAL
63
- │ │ └── videos
64
- │ │ └── *.avi
65
- │ └── csv_files
66
- │ ├── test_fake.csv
67
- │ └── test_real.csv
68
- ├── dfdc
69
- │ ├── csv_files
70
- │ │ └── test.csv
71
- │ └── videos
72
- ├── dfo
73
- │ ├── FAKE
74
- │ │ └── videos
75
- │ │ └── *.avi
76
- │ ├── REAL
77
- │ │ └── videos
78
- │ │ └── *.avi
79
- │ └── csv_files
80
- │ ├── test_fake.csv
81
- │ └── test_real.csv
82
- ├── ffpp
83
- │ ├── DF
84
- │ │ ├── c23
85
- │ │ │ └── videos
86
- │ │ │ └── *.avi
87
- │ │ ├── c40
88
- │ │ │ └── videos
89
- │ │ │ └── *.avi
90
- │ │ └── raw
91
- │ │ └── videos
92
- │ │ │ └── *.avi
93
- │ ├── F2F ...
94
- │ ├── FS ...
95
- │ ├── FSh ...
96
- │ ├── NT ...
97
- │ ├── real ...
98
- │ └── csv_files
99
- │ ├── test.json
100
- │ ├── train.json
101
- │ └── val.json
102
- |
103
- └── robustness
104
- ├── BW
105
- │ ├── 1
106
- │ │ ├── DF
107
- │ │ │ └── c23
108
- │ │ │ └── videos
109
- │ │ │ └── *.avi
110
- │ │ ├── F2F ...
111
- │ │ ├── FS ...
112
- │ │ ├── FSh ...
113
- │ │ ├── NT ...
114
- │ │ ├── real ...
115
- │ │ │
116
- │ │ └── csv_files
117
- │ │ ├── test.json
118
- │ │ ├── train.json
119
- │ │ └── val.json
120
- │ │
121
- │ │
122
- │ │
123
- . .
124
- . .
125
- . .
126
- ```
127
-
128
-
129
- ## 🔧Dataset Pre-processing
130
- ### Generic Pre-processing
131
- This phase performs the required pre-processing for our method, this includes *facial alignment (using the mean face from LRW)* and *facial cropping*.
132
- ```bash
133
- # First, fetch all the landmarks & bboxes of the video frames.
134
- python -m src.preprocess.fetch_landmark_bbox \
135
- --root-dir="/storage/FaceForensicC23" \ # The root folder of the dataset
136
- --video-dir="videos" \ # The root folder of the videos
137
- --fdata-dir="frame_data" \ # The folder to save the extracted frame data
138
- --glob-exp="*/*" \ # The glob expression to search through the root video folder
139
- --split-num=1 \ # Split the dataset into several parts for parallel process.
140
- --part-num=1 \ # The part of dataset to process for parallel process.
141
- --batch=1 \ # The batch size for the 2D-FAN face data extraction. (suggestion: 1)
142
- --max-res=800 # The maximum resolution for either side of the image
143
-
144
- # Then, crop all the faces from the original videos.
145
- python -m src.preprocess.crop_main_face \
146
- --root-dir="/storage/FaceForensicC23/" \ # The root folder of the dataset
147
- --video-dir="videos" \ # The root folder of the videos
148
- --fdata-dir="frame_data" \ # The folder to fetch the frame data for landmarks and bboxes
149
- --glob-exp="*/*" \ # The glob expression to search through the root video folder
150
- --crop-dir="cropped" \ # The folder to save the cropped videos
151
- --crop-width=150 \ # The width for the cropped videos
152
- --crop-height=150 \ # The height for the cropped videos
153
- --mean-face="./misc/20words_mean_face.npy" # The mean face for face aligned cropping.
154
- --replace \ # Control whether to replace existing cropped videos
155
- --workers=1 # Number of works to perform parallel process (default: cpu / 2 )
156
- ```
157
-
158
-
159
- ### Robustness Pre-processing
160
- This phase requires the pre-processed facial landmarks to perform facial cropping, please refer to the **Generic Pre-processing** for further detail.
161
- ```bash
162
- # First, we add perturbation to all the videos.
163
- python -m src.preprocess.phase1_apply_all_to_videos \
164
- --dts-root="/storage/FaceForensicC23" \ # The root folder of the dataset
165
- --vid-dir="videos" \ # The root folder of the videos
166
- --rob-dir="robustness" \ # The folder to save the perturbed videos
167
- --glob-exp="*/*.mp4" \ # The glob expression to search through the root video folder
168
- --split=1 \ # Split the dataset into several parts for parallel process.
169
- --part=1 \ # The part of dataset to process for parallel process.
170
- --workers=1 # Number of works to perform parallel process (default: cpu / 2 )
171
-
172
- # Then, crop all the faces from the perturbed videos.
173
- python -m src.preprocess.phase2_face_crop_all_videos \
174
- (setup/run/clean) # the three phase operations
175
- --root-dir="/storage/FaceForensicC23/" \ # The root folder of the dataset
176
- --rob-dir="videos" \ # The root folder of the robustness videos
177
- --fd-dir="frame_data" \ # The folder to fetch the frame data for landmarks and bboxes
178
- --glob-exp="*/*/*/*.mp4" \ # The glob expression to search through the root video folder
179
- --crop-dir="cropped_robust" \ # The folder to save the cropped videos
180
- --mean-face="./misc/20words_mean_face.npy" \ # The mean face for face aligned cropping.
181
- --workers=1 # Number of works to perform parallel process (default: cpu / 2 )
182
- ```
183
-
184
- ## 🤖Training & Evaluation
185
- ### Training - Preset Settings
186
- In `./scripts`, scripts are provided to start the training process for the settings mentioned in our paper.
187
- These settings are configured to run on a cluster with `V100*4`.
188
- ```bash
189
- bash ./scripts/model/ffg_l14.sh # begin training process
190
- ```
191
- ### Training - Custom Settings
192
- Our project is built on `pytorch-lightning (2.2.0)`, please refer the [official manual](https://lightning.ai/docs/pytorch/2.2.0/common/trainer.html#trainer-class-api) and adjust the following files for advance configurations:
193
- ```bash
194
- ./configs/base.yaml # major training settings (e.g. epochs, optimizer, batch size, mixed-precision ...)
195
- ./configs/data.yaml # settings for the training & validation dataset
196
- ./configs/inference.yaml # settings for the evaluation dataset (extension of data.yaml)
197
- ./configs/logger.yaml # settings for the WandB logger
198
- ./configs/clip/L14/ffg.yaml # settings for the main model
199
- ./configs/test.yaml # settings for debugging (offline logging, small batch size, short epochs ...)
200
- ```
201
- The following command starts the training process with the provided settings:
202
- ```bash
203
- # For debugging, add '--config configs/test.yaml' after the '--config configs/clip/L14/ffg.yaml'.
204
- python main.py \
205
- --config configs/base.yaml \
206
- --config configs/clip/L14/ffg.yaml
207
-
208
- # Fine-grained control is supported with the pytorch-lightning-cli.
209
- python main.py \
210
- --config configs/base.yaml \
211
- --config configs/clip/L14/ffg.yaml \
212
- --optimizer.lr=1e-5 \
213
- --trainer.max_epochs=10 \
214
- --data.init_args.train_datamodules.init_args.batch_size=5
215
- ```
216
- ### Evaluation - Standard
217
- To perform evaluation on datasets, run the following command:
218
- ```bash
219
- python inference.py \
220
- "logs/fcg_l14/setting.yaml" \ # model settings
221
- "./configs/inference.yaml" \ # evaluation dataset settings
222
- "logs/fcg_l14/checkpoint.ckpt" \ # model checkpoint
223
- "--devices=4" # number of devices to compute in parallel
224
- ```
225
- ### Evaluation - Robustness
226
- We provide tools in `./scripts/tools/` to simplify the robustness evaluation task: `create-robust-config.sh` creates an evaluation config for each perturbation types and `inference-robust.sh` runs through all the datasets with the specified model.
227
-
228
- ## 😎Inference - Demo Video
229
- To run inference on a single video with an indicator, please download our model checkpoint and execute the following commands:
230
- ```bash
231
- # Pre-Processing: fetch facial landmark and bounding box
232
- python -m src.preprocess.fetch_landmark_bbox \
233
- --root-dir="./resources" \
234
- --video-dir="videos" \
235
- --fdata-dir="frame_data" \
236
- --glob-exp="*"
237
- # Pre-Processing: crop out the facial regions
238
- python -m src.preprocess.crop_main_face \
239
- --root-dir="./resources" \
240
- --video-dir="videos" \
241
- --fdata-dir="frame_data" \
242
- --crop-dir="cropped" \
243
- --glob-exp="*"
244
- # Main Process
245
- python -m demo \
246
- "checkpoint/setting.yaml" \ # the model setting of the checkpoint
247
- "checkpoint/weights.ckpt" \ # the model weights of the checkpoint
248
- "resources/videos/000_003.mp4" \ # the video to process
249
- --out_path="test.avi" \ # the output path of the processed video
250
- --threshold=0.5 \ # the threshold for the real/fake indicator
251
- --batch_size=30 # the input batch size of the model (~10G VRAM when batch_size=30 )
252
- ```
253
- The following is a sample frame from the processed video:
254
- <p align="center">
255
- <img src="assets/demo.png">
256
- </p>
257
-
258
-
259
- <!-- ## 🔥 Inference -->
260
- ## 🔗 BibTeX
261
- If you find our efforts helpful, please cite our paper and leave a star for further updates!
262
- ```bibtex
263
-
264
- @inproceedings{cvpr25_dfd_fcg,
265
- title={Towards More General Video-based Deepfake Detection through Facial Component Guided Adaptation for Foundation Model},
266
- author={Yue-Hua Han, Tai-Ming Huang, Kai-Lung Hua, Jun-Cheng Chen},
267
- booktitle={Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR)},
268
- year={2025}
269
- }
270
- ```
271
-
272
-
273
- ## 📭 Contact
274
- The provided code and weights are only available for research purpose only.
275
- If you have further questions (including commercial use), please contact [Dr. Jun-Cheng Chen](pullpull@citi.sinica.edu.tw).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
video/dfd-fcg/model_code/resources/videos/000.mp4 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:0e51b9b46acc7eaeca62022e1b869541406d2ca887cd401dcc03cc5db28bc8ed
3
- size 894312
 
 
 
 
video/dfd-fcg/model_code/resources/videos/000_003.mp4 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6e83d0e0c51a0f7cdf2db48f796617db43148b3390011555dfa758f2b7ab811b
3
- size 891837
 
 
 
 
video/dfd-fcg/model_code/scripts/ablation/ffg.sh DELETED
@@ -1,6 +0,0 @@
1
- python -m main \
2
- --config configs/base.yaml \
3
- --config configs/models/svl.yaml \
4
- --model.init_args.num_synos=4 \
5
- --config configs/generic/inference.yaml \
6
- --notes="no ffg guidance"