Spaces:
Running
Running
Sync from GitHub via hub-sync
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +25 -0
- models/icpr2020dfdc/.gitignore +5 -0
- models/icpr2020dfdc/.travis.yml +15 -0
- models/icpr2020dfdc/LICENSE +674 -0
- models/icpr2020dfdc/README.md +120 -0
- models/icpr2020dfdc/architectures/__init__.py +0 -0
- models/icpr2020dfdc/architectures/externals/__init__.py +1 -0
- models/icpr2020dfdc/architectures/externals/xception.py +236 -0
- models/icpr2020dfdc/architectures/fornet.py +245 -0
- models/icpr2020dfdc/architectures/tripletnet.py +44 -0
- models/icpr2020dfdc/architectures/weights.py +24 -0
- models/icpr2020dfdc/assets/cnfidfeyln_face.gif +3 -0
- models/icpr2020dfdc/assets/cnfidfeyln_face_att.gif +3 -0
- models/icpr2020dfdc/assets/faces_attention.png +3 -0
- models/icpr2020dfdc/assets/mqzvfufzoq_face.gif +3 -0
- models/icpr2020dfdc/assets/mqzvfufzoq_face_att.gif +3 -0
- models/icpr2020dfdc/blazeface/__init__.py +3 -0
- models/icpr2020dfdc/blazeface/anchors.npy +3 -0
- models/icpr2020dfdc/blazeface/blazeface.pth +3 -0
- models/icpr2020dfdc/blazeface/blazeface.py +417 -0
- models/icpr2020dfdc/blazeface/face_extract.py +470 -0
- models/icpr2020dfdc/blazeface/read_video.py +213 -0
- models/icpr2020dfdc/environment.yml +25 -0
- models/icpr2020dfdc/extract_faces.py +346 -0
- models/icpr2020dfdc/index_celebdf.py +85 -0
- models/icpr2020dfdc/index_dfdc.py +94 -0
- models/icpr2020dfdc/index_ffpp.py +92 -0
- models/icpr2020dfdc/isplutils/__init__.py +0 -0
- models/icpr2020dfdc/isplutils/data.py +263 -0
- models/icpr2020dfdc/isplutils/data_siamese.py +78 -0
- models/icpr2020dfdc/isplutils/split.py +135 -0
- models/icpr2020dfdc/isplutils/utils.py +247 -0
- models/icpr2020dfdc/notebook/Analyze results net fusion paper.ipynb +0 -0
- models/icpr2020dfdc/notebook/Analyze results.ipynb +193 -0
- models/icpr2020dfdc/notebook/Image prediction and attention.ipynb +0 -0
- models/icpr2020dfdc/notebook/Image prediction.ipynb +0 -0
- models/icpr2020dfdc/notebook/Video prediction.ipynb +0 -0
- models/icpr2020dfdc/notebook/Visualise attention and features.ipynb +0 -0
- models/icpr2020dfdc/notebook/Xception train val curves.ipynb +0 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-10fpv_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-10fpv_face-scale_size-224_seed-41-tag-val_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-15fpv_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-15fpv_face-scale_size-224_seed-41-tag-val_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-20fpv_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-20fpv_face-scale_size-224_seed-41-tag-val_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-25fpv_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-25fpv_face-scale_size-224_seed-41-tag-val_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-5fpv_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-5fpv_face-scale_size-224_seed-41-tag-val_loss.json +1 -0
- models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140_face-scale_size-224_seed-41-tag-train_loss.json +1 -0
.gitattributes
CHANGED
|
@@ -37,3 +37,28 @@ media/2f/2f7d41a5b57702a9a238409e6a1b973b4398f94c51fdf447e11782ed07693f06.jpg fi
|
|
| 37 |
media/63/635f21138244fc1dcbff5d0525b3c0a8187b1b9cc0ad90b5bb297a76e7b3850c.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
media/7b/7b626d0ddff59ca602e2e1eb02e62e21093aa647ab53c200ca5203f7fc17f6dd.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
media/c0/c064c839c9469d7b616db135f08e09235abd3d73f0889d978d1f92243226a028.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
media/63/635f21138244fc1dcbff5d0525b3c0a8187b1b9cc0ad90b5bb297a76e7b3850c.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
media/7b/7b626d0ddff59ca602e2e1eb02e62e21093aa647ab53c200ca5203f7fc17f6dd.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
media/c0/c064c839c9469d7b616db135f08e09235abd3d73f0889d978d1f92243226a028.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
models/icpr2020dfdc/assets/cnfidfeyln_face.gif filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
models/icpr2020dfdc/assets/cnfidfeyln_face_att.gif filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
models/icpr2020dfdc/assets/faces_attention.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
models/icpr2020dfdc/assets/mqzvfufzoq_face.gif filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
models/icpr2020dfdc/assets/mqzvfufzoq_face_att.gif filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
models/icpr2020dfdc/notebook/samples/lynaeydofd.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
models/icpr2020dfdc/notebook/samples/lynaeydofd_fr0.jpg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
models/icpr2020dfdc/notebook/samples/mqzvfufzoq.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
models/icpr2020dfdc/notebook/samples/mqzvfufzoq_fr0.jpg filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_0/awnfpubqmo.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_0/brtujopkby.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_1/vtfpbtmgfh.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_1/zvqinhzeah.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_10/widuwuoiur.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
models/icpr2020dfdc/test/data/dfdc/dfdc_train_part_10/yhffcuhhjy.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
models/icpr2020dfdc/test/data/ffpp/manipulated_sequences/DeepFakeDetection/c23/videos/24_23__outside_talking_still_laughing__YR5OVD4S.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
models/icpr2020dfdc/test/data/ffpp/manipulated_sequences/Deepfakes/c23/videos/519_515.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
models/icpr2020dfdc/test/data/ffpp/manipulated_sequences/Face2Face/c23/videos/750_743.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
models/icpr2020dfdc/test/data/ffpp/manipulated_sequences/FaceSwap/c23/videos/634_660.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
models/icpr2020dfdc/test/data/ffpp/manipulated_sequences/NeuralTextures/c23/videos/004_982.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
models/icpr2020dfdc/test/data/ffpp/original_sequences/actors/c23/videos/24__outside_talking_still_laughing.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
models/icpr2020dfdc/test/data/ffpp/original_sequences/youtube/c23/videos/004.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
models/icpr2020dfdc/test/data/ffpp/original_sequences/youtube/c23/videos/519.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
models/icpr2020dfdc/test/data/ffpp/original_sequences/youtube/c23/videos/634.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
models/icpr2020dfdc/test/data/ffpp/original_sequences/youtube/c23/videos/750.mp4 filter=lfs diff=lfs merge=lfs -text
|
models/icpr2020dfdc/.gitignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
.idea/
|
| 3 |
+
.DS_Store
|
| 4 |
+
.ipynb_checkpoints/
|
| 5 |
+
__pycache__/
|
models/icpr2020dfdc/.travis.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
language: python
|
| 2 |
+
python:
|
| 3 |
+
- "3.6.9"
|
| 4 |
+
install:
|
| 5 |
+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/miniconda.sh
|
| 6 |
+
- bash $HOME/miniconda.sh -bfp $HOME/miniconda3
|
| 7 |
+
- export PATH=$HOME/miniconda3/bin:$PATH
|
| 8 |
+
- conda env create -f environment.yml
|
| 9 |
+
before_script:
|
| 10 |
+
- source activate icpr2020
|
| 11 |
+
- cd test
|
| 12 |
+
script:
|
| 13 |
+
- python -m unittest test_dfdc.TestDFDC
|
| 14 |
+
- python -m unittest test_ffpp.TestFFPP
|
| 15 |
+
|
models/icpr2020dfdc/LICENSE
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 29 June 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 635 |
+
Copyright (C) <year> <name of author>
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
<program> Copyright (C) <year> <name of author>
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<https://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
models/icpr2020dfdc/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Video Face Manipulation Detection Through Ensemble of CNNs
|
| 2 |
+
[](https://paperswithcode.com/sota/deepfake-detection-on-dfdc?p=video-face-manipulation-detection-through)
|
| 3 |
+
[](https://paperswithcode.com/sota/deepfake-detection-on-faceforensics-1?p=video-face-manipulation-detection-through)
|
| 4 |
+
[](https://travis-ci.org/polimi-ispl/icpr2020dfdc)
|
| 5 |
+
|
| 6 |
+

|
| 7 |
+
|
| 8 |
+
<p align='center'>
|
| 9 |
+
<img src='assets/mqzvfufzoq_face.gif'/>
|
| 10 |
+
<img src='assets/mqzvfufzoq_face_att.gif'/>
|
| 11 |
+
</p>
|
| 12 |
+
|
| 13 |
+
This is the official repository of **Video Face Manipulation Detection Through Ensemble of CNNs**,
|
| 14 |
+
presented at [ICPR2020](https://www.micc.unifi.it/icpr2020/) and currently available on [IEEExplore](https://ieeexplore.ieee.org/document/9412711) and [arXiv](https://arxiv.org/abs/2004.07676).
|
| 15 |
+
If you use this repository for your research, please consider citing our paper. Refer to [How to cite](https://github.com/polimi-ispl/icpr2020dfdc#how-to-cite) section to get the correct entry for your bibliography.
|
| 16 |
+
|
| 17 |
+
We participated as the **ISPL** team in the [Kaggle Deepfake Detection Challenge](https://www.kaggle.com/c/deepfake-detection-challenge/).
|
| 18 |
+
With this implementation, we reached the 41st position over 2116 teams (**top 2%**) on the [private leaderboard](https://www.kaggle.com/c/deepfake-detection-challenge/leaderboard).
|
| 19 |
+
|
| 20 |
+
This repository is currently under maintenance, if you are experiencing any problems, please open an [issue](https://github.com/polimi-ispl/icpr2020dfdc/issues).
|
| 21 |
+
## Getting started
|
| 22 |
+
|
| 23 |
+
### Prerequisites
|
| 24 |
+
- Install [conda](https://docs.conda.io/en/latest/miniconda.html)
|
| 25 |
+
- Create the `icpr2020` environment with *environment.yml*
|
| 26 |
+
```bash
|
| 27 |
+
$ conda env create -f environment.yml
|
| 28 |
+
$ conda activate icpr2020
|
| 29 |
+
```
|
| 30 |
+
- Download and unzip the [datasets](#datasets)
|
| 31 |
+
|
| 32 |
+
### Quick run
|
| 33 |
+
If you just want to test the pre-trained models against your own videos or images:
|
| 34 |
+
- [Video prediction notebook](https://github.com/polimi-ispl/icpr2020dfdc/blob/master/notebook/Video%20prediction.ipynb) <a target="_blank" href="https://colab.research.google.com/drive/12WnvmerHBNbJ49HdoH1lli_O8SwaFPjv?usp=sharing">
|
| 35 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
| 36 |
+
</a>
|
| 37 |
+
|
| 38 |
+
- [Image prediction notebook](https://github.com/polimi-ispl/icpr2020dfdc/blob/master/notebook/Image%20prediction.ipynb) <a target="_blank" href="https://colab.research.google.com/drive/19oVKlzEr58VZfRnSq-nW8kFYuxkh3GM8?usp=sharing">
|
| 39 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
| 40 |
+
</a>
|
| 41 |
+
|
| 42 |
+
- [Image prediction with attention](notebook/Image%20prediction%20and%20attention.ipynb) <a target="_blank" href="https://colab.research.google.com/drive/1zcglis2Qx2vtJhrogn8aKA-mbUotLZLK?usp=sharing">
|
| 43 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
| 44 |
+
</a>
|
| 45 |
+
|
| 46 |
+
### The whole pipeline
|
| 47 |
+
You need to preprocess the datasets in order to index all the samples and extract faces. Just run the script [make_dataset.sh](scripts/make_dataset.sh)
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
$ ./scripts/make_dataset.sh
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Please note that we use only 32 frames per video. You can easily tweak this parameter in [extract_faces.py](extract_faces.py)
|
| 54 |
+
Also, please note that **for the DFDC** we have resorted to _the training split_ exclusively!
|
| 55 |
+
In `scripts/make_dataset.sh` the value of `DFDC_SRC` should point to the directory containing the DFDC train split.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
### Celeb-DF (v2)
|
| 59 |
+
Altough **we did not use this dataset in the paper**, we provide a script [index_celebdf.py](index_celebdf.py) to index the videos similarly to
|
| 60 |
+
DFDC and FF++. Once you have the index, you can proceed with the pipeline starting from [extract_faces.py](extract_faces.py). You can also use the
|
| 61 |
+
split `celebdf` during training/testing.
|
| 62 |
+
|
| 63 |
+
### Train
|
| 64 |
+
In [train_all.sh](scripts/train_all.sh) you can find a comprehensive list of all the commands to train the models presented in the paper.
|
| 65 |
+
Please refer to the comments in the script for hints on their usage.
|
| 66 |
+
|
| 67 |
+
#### Training a single model
|
| 68 |
+
If you want to train some models without lunching the script:
|
| 69 |
+
- for the **non-siamese** architectures (e.g. EfficientNetB4, EfficientNetB4Att), you can simply specify the model in [train_binclass.py](train_binclass.py) with the *--net* parameter;
|
| 70 |
+
- for the **siamese** architectures (e.g. EfficientNetB4ST, EfficientNetB4AttST), you have to:
|
| 71 |
+
1. train the architecture as a feature extractor first, using the [train_triplet.py](train_triplet.py) script and being careful of specifying its name with the *--net* parameter **without** the ST suffix. For instance, for training the EfficientNetB4ST you will have to first run `python train_triplet.py --net EfficientNetB4 --otherparams`;
|
| 72 |
+
2. finetune the model using [train_binclass.py](train_binclass.py), being careful this time to specify the architecture's name **with** the ST suffix and to insert as *--init* argument the path to the weights of the feature extractor trained at the previous step. You will end up running something like `python train_binclass.py --net EfficientNetB4ST --init path/to/EfficientNetB4/weights/trained/with/train_triplet/weights.pth --otherparams`
|
| 73 |
+
|
| 74 |
+
### Test
|
| 75 |
+
In [test_all.sh](scripts/test_all.sh) you can find a comprehensive list of all the commands for testing the models presented in the paper.
|
| 76 |
+
|
| 77 |
+
#### Pretrained weights
|
| 78 |
+
We also provide pretrained weights for all the architectures presented in the paper.
|
| 79 |
+
Please refer to this [Dropbox link](https://www.dropbox.com/sh/cesamx5ytd5j08c/AADG_eEmhskliMaT0Gbk-yHDa?dl=0).
|
| 80 |
+
Each directory is named `$NETWORK_$DATASET` where `$NETWORK` is the architecture name and `$DATASET` is the training dataset.
|
| 81 |
+
In each directory, you can find `bestval.pth` which are the best network weights according to the validation set.
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
Additionally, you can find Jupyter notebooks for results computations in the [notebook](notebook) folder.
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
## Datasets
|
| 88 |
+
- [Facebook's DeepFake Detection Challenge (DFDC) train dataset](https://www.kaggle.com/c/deepfake-detection-challenge/data) | [arXiv paper](https://arxiv.org/abs/2006.07397)
|
| 89 |
+
- [FaceForensics++](https://github.com/ondyari/FaceForensics/blob/master/dataset/README.md) | [arXiv paper](https://arxiv.org/abs/1901.08971)
|
| 90 |
+
- [Celeb-DF (v2)](http://www.cs.albany.edu/~lsw/celeb-deepfakeforensics.html) | [arXiv paper](https://arxiv.org/abs/1909.12962) (**Just for reference, not used in the paper**)
|
| 91 |
+
|
| 92 |
+
## References
|
| 93 |
+
- [EfficientNet PyTorch](https://github.com/lukemelas/EfficientNet-PyTorch)
|
| 94 |
+
- [Xception PyTorch](https://github.com/tstandley/Xception-PyTorch)
|
| 95 |
+
|
| 96 |
+
## How to cite
|
| 97 |
+
Plain text:
|
| 98 |
+
```
|
| 99 |
+
N. Bonettini, E. D. Cannas, S. Mandelli, L. Bondi, P. Bestagini and S. Tubaro, "Video Face Manipulation Detection Through Ensemble of CNNs," 2020 25th International Conference on Pattern Recognition (ICPR), 2021, pp. 5012-5019, doi: 10.1109/ICPR48806.2021.9412711.
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Bibtex:
|
| 103 |
+
```bibtex
|
| 104 |
+
@INPROCEEDINGS{9412711,
|
| 105 |
+
author={Bonettini, Nicolò and Cannas, Edoardo Daniele and Mandelli, Sara and Bondi, Luca and Bestagini, Paolo and Tubaro, Stefano},
|
| 106 |
+
booktitle={2020 25th International Conference on Pattern Recognition (ICPR)},
|
| 107 |
+
title={Video Face Manipulation Detection Through Ensemble of CNNs},
|
| 108 |
+
year={2021},
|
| 109 |
+
volume={},
|
| 110 |
+
number={},
|
| 111 |
+
pages={5012-5019},
|
| 112 |
+
doi={10.1109/ICPR48806.2021.9412711}}
|
| 113 |
+
```
|
| 114 |
+
## Credits
|
| 115 |
+
[Image and Sound Processing Lab - Politecnico di Milano](http://ispl.deib.polimi.it/)
|
| 116 |
+
- Nicolò Bonettini
|
| 117 |
+
- Edoardo Daniele Cannas
|
| 118 |
+
- Sara Mandelli
|
| 119 |
+
- Luca Bondi
|
| 120 |
+
- Paolo Bestagini
|
models/icpr2020dfdc/architectures/__init__.py
ADDED
|
File without changes
|
models/icpr2020dfdc/architectures/externals/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from .xception import xception
|
models/icpr2020dfdc/architectures/externals/xception.py
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch)
|
| 3 |
+
|
| 4 |
+
@author: tstandley
|
| 5 |
+
Adapted by cadene
|
| 6 |
+
|
| 7 |
+
Creates an Xception Model as defined in:
|
| 8 |
+
|
| 9 |
+
Francois Chollet
|
| 10 |
+
Xception: Deep Learning with Depthwise Separable Convolutions
|
| 11 |
+
https://arxiv.org/pdf/1610.02357.pdf
|
| 12 |
+
|
| 13 |
+
This weights ported from the Keras implementation. Achieves the following performance on the validation set:
|
| 14 |
+
|
| 15 |
+
Loss:0.9173 Prec@1:78.892 Prec@5:94.292
|
| 16 |
+
|
| 17 |
+
REMEMBER to set your image size to 3x299x299 for both test and validation
|
| 18 |
+
|
| 19 |
+
normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5],
|
| 20 |
+
std=[0.5, 0.5, 0.5])
|
| 21 |
+
|
| 22 |
+
The resize parameter of the validation transform should be 333, and make sure to center crop at 299x299
|
| 23 |
+
"""
|
| 24 |
+
from __future__ import print_function, division, absolute_import
|
| 25 |
+
|
| 26 |
+
import torch.nn as nn
|
| 27 |
+
import torch.nn.functional as F
|
| 28 |
+
import torch.utils.model_zoo as model_zoo
|
| 29 |
+
|
| 30 |
+
__all__ = ['xception']
|
| 31 |
+
|
| 32 |
+
pretrained_settings = {
|
| 33 |
+
'xception': {
|
| 34 |
+
'imagenet': {
|
| 35 |
+
'url': 'http://data.lip6.fr/cadene/pretrainedmodels/xception-43020ad28.pth',
|
| 36 |
+
'input_space': 'RGB',
|
| 37 |
+
'input_size': [3, 299, 299],
|
| 38 |
+
'input_range': [0, 1],
|
| 39 |
+
'mean': [0.5, 0.5, 0.5],
|
| 40 |
+
'std': [0.5, 0.5, 0.5],
|
| 41 |
+
'num_classes': 1000,
|
| 42 |
+
'scale': 0.8975
|
| 43 |
+
# The resize parameter of the validation transform should be 333, and make sure to center crop at 299x299
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class SeparableConv2d(nn.Module):
|
| 50 |
+
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=False):
|
| 51 |
+
super(SeparableConv2d, self).__init__()
|
| 52 |
+
|
| 53 |
+
self.conv1 = nn.Conv2d(in_channels, in_channels, kernel_size, stride, padding, dilation, groups=in_channels,
|
| 54 |
+
bias=bias)
|
| 55 |
+
self.pointwise = nn.Conv2d(in_channels, out_channels, 1, 1, 0, 1, 1, bias=bias)
|
| 56 |
+
|
| 57 |
+
def forward(self, x):
|
| 58 |
+
x = self.conv1(x)
|
| 59 |
+
x = self.pointwise(x)
|
| 60 |
+
return x
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class Block(nn.Module):
|
| 64 |
+
def __init__(self, in_filters, out_filters, reps, strides=1, start_with_relu=True, grow_first=True):
|
| 65 |
+
super(Block, self).__init__()
|
| 66 |
+
|
| 67 |
+
if out_filters != in_filters or strides != 1:
|
| 68 |
+
self.skip = nn.Conv2d(in_filters, out_filters, 1, stride=strides, bias=False)
|
| 69 |
+
self.skipbn = nn.BatchNorm2d(out_filters)
|
| 70 |
+
else:
|
| 71 |
+
self.skip = None
|
| 72 |
+
|
| 73 |
+
rep = []
|
| 74 |
+
|
| 75 |
+
filters = in_filters
|
| 76 |
+
if grow_first:
|
| 77 |
+
rep.append(nn.ReLU(inplace=True))
|
| 78 |
+
rep.append(SeparableConv2d(in_filters, out_filters, 3, stride=1, padding=1, bias=False))
|
| 79 |
+
rep.append(nn.BatchNorm2d(out_filters))
|
| 80 |
+
filters = out_filters
|
| 81 |
+
|
| 82 |
+
for i in range(reps - 1):
|
| 83 |
+
rep.append(nn.ReLU(inplace=True))
|
| 84 |
+
rep.append(SeparableConv2d(filters, filters, 3, stride=1, padding=1, bias=False))
|
| 85 |
+
rep.append(nn.BatchNorm2d(filters))
|
| 86 |
+
|
| 87 |
+
if not grow_first:
|
| 88 |
+
rep.append(nn.ReLU(inplace=True))
|
| 89 |
+
rep.append(SeparableConv2d(in_filters, out_filters, 3, stride=1, padding=1, bias=False))
|
| 90 |
+
rep.append(nn.BatchNorm2d(out_filters))
|
| 91 |
+
|
| 92 |
+
if not start_with_relu:
|
| 93 |
+
rep = rep[1:]
|
| 94 |
+
else:
|
| 95 |
+
rep[0] = nn.ReLU(inplace=False)
|
| 96 |
+
|
| 97 |
+
if strides != 1:
|
| 98 |
+
rep.append(nn.MaxPool2d(3, strides, 1))
|
| 99 |
+
self.rep = nn.Sequential(*rep)
|
| 100 |
+
|
| 101 |
+
def forward(self, inp):
|
| 102 |
+
x = self.rep(inp)
|
| 103 |
+
|
| 104 |
+
if self.skip is not None:
|
| 105 |
+
skip = self.skip(inp)
|
| 106 |
+
skip = self.skipbn(skip)
|
| 107 |
+
else:
|
| 108 |
+
skip = inp
|
| 109 |
+
|
| 110 |
+
x += skip
|
| 111 |
+
return x
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class Xception(nn.Module):
|
| 115 |
+
"""
|
| 116 |
+
Xception optimized for the ImageNet dataset, as specified in
|
| 117 |
+
https://arxiv.org/pdf/1610.02357.pdf
|
| 118 |
+
"""
|
| 119 |
+
|
| 120 |
+
def __init__(self, num_classes=1000):
|
| 121 |
+
""" Constructor
|
| 122 |
+
Args:
|
| 123 |
+
num_classes: number of classes
|
| 124 |
+
"""
|
| 125 |
+
super(Xception, self).__init__()
|
| 126 |
+
self.num_classes = num_classes
|
| 127 |
+
|
| 128 |
+
self.conv1 = nn.Conv2d(3, 32, 3, 2, 0, bias=False)
|
| 129 |
+
self.bn1 = nn.BatchNorm2d(32)
|
| 130 |
+
self.relu1 = nn.ReLU(inplace=True)
|
| 131 |
+
|
| 132 |
+
self.conv2 = nn.Conv2d(32, 64, 3, bias=False)
|
| 133 |
+
self.bn2 = nn.BatchNorm2d(64)
|
| 134 |
+
self.relu2 = nn.ReLU(inplace=True)
|
| 135 |
+
# do relu here
|
| 136 |
+
|
| 137 |
+
self.block1 = Block(64, 128, 2, 2, start_with_relu=False, grow_first=True)
|
| 138 |
+
self.block2 = Block(128, 256, 2, 2, start_with_relu=True, grow_first=True)
|
| 139 |
+
self.block3 = Block(256, 728, 2, 2, start_with_relu=True, grow_first=True)
|
| 140 |
+
|
| 141 |
+
self.block4 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 142 |
+
self.block5 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 143 |
+
self.block6 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 144 |
+
self.block7 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 145 |
+
|
| 146 |
+
self.block8 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 147 |
+
self.block9 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 148 |
+
self.block10 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 149 |
+
self.block11 = Block(728, 728, 3, 1, start_with_relu=True, grow_first=True)
|
| 150 |
+
|
| 151 |
+
self.block12 = Block(728, 1024, 2, 2, start_with_relu=True, grow_first=False)
|
| 152 |
+
|
| 153 |
+
self.conv3 = SeparableConv2d(1024, 1536, 3, 1, 1)
|
| 154 |
+
self.bn3 = nn.BatchNorm2d(1536)
|
| 155 |
+
self.relu3 = nn.ReLU(inplace=True)
|
| 156 |
+
|
| 157 |
+
# do relu here
|
| 158 |
+
self.conv4 = SeparableConv2d(1536, 2048, 3, 1, 1)
|
| 159 |
+
self.bn4 = nn.BatchNorm2d(2048)
|
| 160 |
+
|
| 161 |
+
self.fc = nn.Linear(2048, num_classes)
|
| 162 |
+
|
| 163 |
+
# #------- init weights --------
|
| 164 |
+
# for m in self.modules():
|
| 165 |
+
# if isinstance(m, nn.Conv2d):
|
| 166 |
+
# n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
|
| 167 |
+
# m.weight.data.normal_(0, math.sqrt(2. / n))
|
| 168 |
+
# elif isinstance(m, nn.BatchNorm2d):
|
| 169 |
+
# m.weight.data.fill_(1)
|
| 170 |
+
# m.bias.data.zero_()
|
| 171 |
+
# #-----------------------------
|
| 172 |
+
|
| 173 |
+
def features(self, input):
|
| 174 |
+
x = self.conv1(input)
|
| 175 |
+
x = self.bn1(x)
|
| 176 |
+
x = self.relu1(x)
|
| 177 |
+
|
| 178 |
+
x = self.conv2(x)
|
| 179 |
+
x = self.bn2(x)
|
| 180 |
+
x = self.relu2(x)
|
| 181 |
+
|
| 182 |
+
x = self.block1(x)
|
| 183 |
+
x = self.block2(x)
|
| 184 |
+
x = self.block3(x)
|
| 185 |
+
x = self.block4(x)
|
| 186 |
+
x = self.block5(x)
|
| 187 |
+
x = self.block6(x)
|
| 188 |
+
x = self.block7(x)
|
| 189 |
+
x = self.block8(x)
|
| 190 |
+
x = self.block9(x)
|
| 191 |
+
x = self.block10(x)
|
| 192 |
+
x = self.block11(x)
|
| 193 |
+
x = self.block12(x)
|
| 194 |
+
|
| 195 |
+
x = self.conv3(x)
|
| 196 |
+
x = self.bn3(x)
|
| 197 |
+
x = self.relu3(x)
|
| 198 |
+
|
| 199 |
+
x = self.conv4(x)
|
| 200 |
+
x = self.bn4(x)
|
| 201 |
+
return x
|
| 202 |
+
|
| 203 |
+
def logits(self, features):
|
| 204 |
+
x = nn.ReLU(inplace=True)(features)
|
| 205 |
+
|
| 206 |
+
x = F.adaptive_avg_pool2d(x, (1, 1))
|
| 207 |
+
x = x.view(x.size(0), -1)
|
| 208 |
+
x = self.last_linear(x)
|
| 209 |
+
return x
|
| 210 |
+
|
| 211 |
+
def forward(self, input):
|
| 212 |
+
x = self.features(input)
|
| 213 |
+
x = self.logits(x)
|
| 214 |
+
return x
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def xception(num_classes=1000, pretrained='imagenet'):
|
| 218 |
+
model = Xception(num_classes=num_classes)
|
| 219 |
+
if pretrained:
|
| 220 |
+
settings = pretrained_settings['xception'][pretrained]
|
| 221 |
+
assert num_classes == settings['num_classes'], \
|
| 222 |
+
"num_classes should be {}, but is {}".format(settings['num_classes'], num_classes)
|
| 223 |
+
|
| 224 |
+
model = Xception(num_classes=num_classes)
|
| 225 |
+
model.load_state_dict(model_zoo.load_url(settings['url']))
|
| 226 |
+
|
| 227 |
+
model.input_space = settings['input_space']
|
| 228 |
+
model.input_size = settings['input_size']
|
| 229 |
+
model.input_range = settings['input_range']
|
| 230 |
+
model.mean = settings['mean']
|
| 231 |
+
model.std = settings['std']
|
| 232 |
+
|
| 233 |
+
# TODO: ugly
|
| 234 |
+
model.last_linear = model.fc
|
| 235 |
+
del model.fc
|
| 236 |
+
return model
|
models/icpr2020dfdc/architectures/fornet.py
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
from collections import OrderedDict
|
| 13 |
+
|
| 14 |
+
import torch
|
| 15 |
+
from efficientnet_pytorch import EfficientNet
|
| 16 |
+
from torch import nn as nn
|
| 17 |
+
from torch.nn import functional as F
|
| 18 |
+
from torchvision import transforms
|
| 19 |
+
|
| 20 |
+
from . import externals
|
| 21 |
+
|
| 22 |
+
"""
|
| 23 |
+
Feature Extractor
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class FeatureExtractor(nn.Module):
|
| 28 |
+
"""
|
| 29 |
+
Abstract class to be extended when supporting features extraction.
|
| 30 |
+
It also provides standard normalized and parameters
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def features(self, x: torch.Tensor) -> torch.Tensor:
|
| 34 |
+
raise NotImplementedError
|
| 35 |
+
|
| 36 |
+
def get_trainable_parameters(self):
|
| 37 |
+
return self.parameters()
|
| 38 |
+
|
| 39 |
+
@staticmethod
|
| 40 |
+
def get_normalizer():
|
| 41 |
+
return transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
"""
|
| 45 |
+
EfficientNet
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class EfficientNetGen(FeatureExtractor):
|
| 50 |
+
def __init__(self, model: str):
|
| 51 |
+
super(EfficientNetGen, self).__init__()
|
| 52 |
+
|
| 53 |
+
self.efficientnet = EfficientNet.from_pretrained(model)
|
| 54 |
+
self.classifier = nn.Linear(self.efficientnet._conv_head.out_channels, 1)
|
| 55 |
+
del self.efficientnet._fc
|
| 56 |
+
|
| 57 |
+
def features(self, x: torch.Tensor) -> torch.Tensor:
|
| 58 |
+
x = self.efficientnet.extract_features(x)
|
| 59 |
+
x = self.efficientnet._avg_pooling(x)
|
| 60 |
+
x = x.flatten(start_dim=1)
|
| 61 |
+
return x
|
| 62 |
+
|
| 63 |
+
def forward(self, x):
|
| 64 |
+
x = self.features(x)
|
| 65 |
+
x = self.efficientnet._dropout(x)
|
| 66 |
+
x = self.classifier(x)
|
| 67 |
+
return x
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class EfficientNetB4(EfficientNetGen):
|
| 71 |
+
def __init__(self):
|
| 72 |
+
super(EfficientNetB4, self).__init__(model='efficientnet-b4')
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
"""
|
| 76 |
+
EfficientNetAutoAtt
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class EfficientNetAutoAtt(EfficientNet):
|
| 81 |
+
def init_att(self, model: str, width: int):
|
| 82 |
+
"""
|
| 83 |
+
Initialize attention
|
| 84 |
+
:param model: efficientnet-bx, x \in {0,..,7}
|
| 85 |
+
:param depth: attention width
|
| 86 |
+
:return:
|
| 87 |
+
"""
|
| 88 |
+
if model == 'efficientnet-b4':
|
| 89 |
+
self.att_block_idx = 9
|
| 90 |
+
if width == 0:
|
| 91 |
+
self.attconv = nn.Conv2d(kernel_size=1, in_channels=56, out_channels=1)
|
| 92 |
+
else:
|
| 93 |
+
attconv_layers = []
|
| 94 |
+
for i in range(width):
|
| 95 |
+
attconv_layers.append(
|
| 96 |
+
('conv{:d}'.format(i), nn.Conv2d(kernel_size=3, padding=1, in_channels=56, out_channels=56)))
|
| 97 |
+
attconv_layers.append(
|
| 98 |
+
('relu{:d}'.format(i), nn.ReLU(inplace=True)))
|
| 99 |
+
attconv_layers.append(('conv_out', nn.Conv2d(kernel_size=1, in_channels=56, out_channels=1)))
|
| 100 |
+
self.attconv = nn.Sequential(OrderedDict(attconv_layers))
|
| 101 |
+
else:
|
| 102 |
+
raise ValueError('Model not valid: {}'.format(model))
|
| 103 |
+
|
| 104 |
+
def get_attention(self, x: torch.Tensor) -> torch.Tensor:
|
| 105 |
+
|
| 106 |
+
# Placeholder
|
| 107 |
+
att = None
|
| 108 |
+
|
| 109 |
+
# Stem
|
| 110 |
+
x = self._swish(self._bn0(self._conv_stem(x)))
|
| 111 |
+
|
| 112 |
+
# Blocks
|
| 113 |
+
for idx, block in enumerate(self._blocks):
|
| 114 |
+
drop_connect_rate = self._global_params.drop_connect_rate
|
| 115 |
+
if drop_connect_rate:
|
| 116 |
+
drop_connect_rate *= float(idx) / len(self._blocks)
|
| 117 |
+
x = block(x, drop_connect_rate=drop_connect_rate)
|
| 118 |
+
if idx == self.att_block_idx:
|
| 119 |
+
att = torch.sigmoid(self.attconv(x))
|
| 120 |
+
break
|
| 121 |
+
|
| 122 |
+
return att
|
| 123 |
+
|
| 124 |
+
def extract_features(self, x: torch.Tensor) -> torch.Tensor:
|
| 125 |
+
# Stem
|
| 126 |
+
x = self._swish(self._bn0(self._conv_stem(x)))
|
| 127 |
+
|
| 128 |
+
# Blocks
|
| 129 |
+
for idx, block in enumerate(self._blocks):
|
| 130 |
+
drop_connect_rate = self._global_params.drop_connect_rate
|
| 131 |
+
if drop_connect_rate:
|
| 132 |
+
drop_connect_rate *= float(idx) / len(self._blocks)
|
| 133 |
+
x = block(x, drop_connect_rate=drop_connect_rate)
|
| 134 |
+
if idx == self.att_block_idx:
|
| 135 |
+
att = torch.sigmoid(self.attconv(x))
|
| 136 |
+
x = x * att
|
| 137 |
+
|
| 138 |
+
# Head
|
| 139 |
+
x = self._swish(self._bn1(self._conv_head(x)))
|
| 140 |
+
|
| 141 |
+
return x
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class EfficientNetGenAutoAtt(FeatureExtractor):
|
| 145 |
+
def __init__(self, model: str, width: int):
|
| 146 |
+
super(EfficientNetGenAutoAtt, self).__init__()
|
| 147 |
+
|
| 148 |
+
self.efficientnet = EfficientNetAutoAtt.from_pretrained(model)
|
| 149 |
+
self.efficientnet.init_att(model, width)
|
| 150 |
+
self.classifier = nn.Linear(self.efficientnet._conv_head.out_channels, 1)
|
| 151 |
+
del self.efficientnet._fc
|
| 152 |
+
|
| 153 |
+
def features(self, x: torch.Tensor) -> torch.Tensor:
|
| 154 |
+
x = self.efficientnet.extract_features(x)
|
| 155 |
+
x = self.efficientnet._avg_pooling(x)
|
| 156 |
+
x = x.flatten(start_dim=1)
|
| 157 |
+
return x
|
| 158 |
+
|
| 159 |
+
def forward(self, x):
|
| 160 |
+
x = self.features(x)
|
| 161 |
+
x = self.efficientnet._dropout(x)
|
| 162 |
+
x = self.classifier(x)
|
| 163 |
+
return x
|
| 164 |
+
|
| 165 |
+
def get_attention(self, x: torch.Tensor) -> torch.Tensor:
|
| 166 |
+
return self.efficientnet.get_attention(x)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class EfficientNetAutoAttB4(EfficientNetGenAutoAtt):
|
| 170 |
+
def __init__(self):
|
| 171 |
+
super(EfficientNetAutoAttB4, self).__init__(model='efficientnet-b4', width=0)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
"""
|
| 175 |
+
Xception
|
| 176 |
+
"""
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
class Xception(FeatureExtractor):
|
| 180 |
+
def __init__(self):
|
| 181 |
+
super(Xception, self).__init__()
|
| 182 |
+
self.xception = externals.xception()
|
| 183 |
+
self.xception.last_linear = nn.Linear(2048, 1)
|
| 184 |
+
|
| 185 |
+
def features(self, x: torch.Tensor) -> torch.Tensor:
|
| 186 |
+
x = self.xception.features(x)
|
| 187 |
+
x = nn.ReLU(inplace=True)(x)
|
| 188 |
+
x = F.adaptive_avg_pool2d(x, (1, 1))
|
| 189 |
+
x = x.view(x.size(0), -1)
|
| 190 |
+
return x
|
| 191 |
+
|
| 192 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
| 193 |
+
return self.xception.forward(x)
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
"""
|
| 197 |
+
Siamese tuning
|
| 198 |
+
"""
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class SiameseTuning(FeatureExtractor):
|
| 202 |
+
def __init__(self, feat_ext: FeatureExtractor, num_feat: int, lastonly: bool = True):
|
| 203 |
+
super(SiameseTuning, self).__init__()
|
| 204 |
+
self.feat_ext = feat_ext()
|
| 205 |
+
if not hasattr(self.feat_ext, 'features'):
|
| 206 |
+
raise NotImplementedError('The provided feature extractor needs to provide a features() method')
|
| 207 |
+
self.lastonly = lastonly
|
| 208 |
+
self.classifier = nn.Sequential(
|
| 209 |
+
nn.BatchNorm1d(num_features=num_feat),
|
| 210 |
+
nn.Linear(in_features=num_feat, out_features=1),
|
| 211 |
+
)
|
| 212 |
+
|
| 213 |
+
def features(self, x):
|
| 214 |
+
x = self.feat_ext.features(x)
|
| 215 |
+
return x
|
| 216 |
+
|
| 217 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
| 218 |
+
if self.lastonly:
|
| 219 |
+
with torch.no_grad():
|
| 220 |
+
x = self.features(x)
|
| 221 |
+
else:
|
| 222 |
+
x = self.features(x)
|
| 223 |
+
x = self.classifier(x)
|
| 224 |
+
return x
|
| 225 |
+
|
| 226 |
+
def get_trainable_parameters(self):
|
| 227 |
+
if self.lastonly:
|
| 228 |
+
return self.classifier.parameters()
|
| 229 |
+
else:
|
| 230 |
+
return self.parameters()
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class EfficientNetB4ST(SiameseTuning):
|
| 234 |
+
def __init__(self):
|
| 235 |
+
super(EfficientNetB4ST, self).__init__(feat_ext=EfficientNetB4, num_feat=1792, lastonly=True)
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
class EfficientNetAutoAttB4ST(SiameseTuning):
|
| 239 |
+
def __init__(self):
|
| 240 |
+
super(EfficientNetAutoAttB4ST, self).__init__(feat_ext=EfficientNetAutoAttB4, num_feat=1792, lastonly=True)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class XceptionST(SiameseTuning):
|
| 244 |
+
def __init__(self):
|
| 245 |
+
super(XceptionST, self).__init__(feat_ext=Xception, num_feat=2048, lastonly=True)
|
models/icpr2020dfdc/architectures/tripletnet.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
from . import fornet
|
| 13 |
+
from .fornet import FeatureExtractor
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class TripletNet(FeatureExtractor):
|
| 17 |
+
"""
|
| 18 |
+
Template class for triplet net
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
def __init__(self, feat_ext: FeatureExtractor):
|
| 22 |
+
super(TripletNet, self).__init__()
|
| 23 |
+
self.feat_ext = feat_ext()
|
| 24 |
+
if not hasattr(self.feat_ext, 'features'):
|
| 25 |
+
raise NotImplementedError('The provided feature extractor needs to provide a features() method')
|
| 26 |
+
|
| 27 |
+
def features(self, x):
|
| 28 |
+
return self.feat_ext.features(x)
|
| 29 |
+
|
| 30 |
+
def forward(self, x1, x2, x3):
|
| 31 |
+
x1 = self.features(x1)
|
| 32 |
+
x2 = self.features(x2)
|
| 33 |
+
x3 = self.features(x3)
|
| 34 |
+
return x1, x2, x3
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class EfficientNetB4(TripletNet):
|
| 38 |
+
def __init__(self):
|
| 39 |
+
super(EfficientNetB4, self).__init__(feat_ext=fornet.EfficientNetB4)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class EfficientNetAutoAttB4(TripletNet):
|
| 43 |
+
def __init__(self):
|
| 44 |
+
super(EfficientNetAutoAttB4, self).__init__(feat_ext=fornet.EfficientNetAutoAttB4)
|
models/icpr2020dfdc/architectures/weights.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
weight_url = {
|
| 14 |
+
'EfficientNetAutoAttB4ST_DFDC':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetAutoAttB4ST_DFDC_bestval-4df0ef7d2f380a5955affa78c35d0942ac1cd65229510353b252737775515a33.pth',
|
| 15 |
+
'EfficientNetAutoAttB4ST_FFPP':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetAutoAttB4ST_FFPP_bestval-ddb357503b9b902e1b925c2550415604c4252b9b9ecafeb7369dc58cc16e9edd.pth',
|
| 16 |
+
'EfficientNetAutoAttB4_DFDC':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetAutoAttB4_DFDC_bestval-72ed969b2a395fffe11a0d5bf0a635e7260ba2588c28683630d97ff7153389fc.pth',
|
| 17 |
+
'EfficientNetAutoAttB4_FFPP':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetAutoAttB4_FFPP_bestval-b0c9e9522a7143cf119843e910234be5e30f77dc527b1b427cdffa5ce3bdbc25.pth',
|
| 18 |
+
'EfficientNetB4ST_DFDC':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetB4ST_DFDC_bestval-86f0a0701b18694dfb5e7837bd09fa8e48a5146c193227edccf59f1b038181c6.pth',
|
| 19 |
+
'EfficientNetB4ST_FFPP':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetB4ST_FFPP_bestval-ccd016668071be5bf5fff68e446d055441739ec7113fb1a6eee998f08396ae92.pth',
|
| 20 |
+
'EfficientNetB4_DFDC':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetB4_DFDC_bestval-c9f3663e2116d3356d056a0ce6453e0fc412a8df68ebd0902f07104d9129a09a.pth',
|
| 21 |
+
'EfficientNetB4_FFPP':'https://f002.backblazeb2.com/file/icpr2020/EfficientNetB4_FFPP_bestval-93aaad84946829e793d1a67ed7e0309b535e2f2395acb4f8d16b92c0616ba8d7.pth',
|
| 22 |
+
'Xception_DFDC':'https://f002.backblazeb2.com/file/icpr2020/Xception_DFDC_bestval-e826cdb64d73ef491e6b8ff8fce0e1e1b7fc1d8e2715bc51a56280fff17596f9.pth',
|
| 23 |
+
'Xception_FFPP':'https://f002.backblazeb2.com/file/icpr2020/Xception_FFPP_bestval-bb119e4913cb8f816cd28a03f81f4c603d6351bf8e3f8e3eb99eebc923aecd22.pth',
|
| 24 |
+
}
|
models/icpr2020dfdc/assets/cnfidfeyln_face.gif
ADDED
|
Git LFS Details
|
models/icpr2020dfdc/assets/cnfidfeyln_face_att.gif
ADDED
|
Git LFS Details
|
models/icpr2020dfdc/assets/faces_attention.png
ADDED
|
Git LFS Details
|
models/icpr2020dfdc/assets/mqzvfufzoq_face.gif
ADDED
|
Git LFS Details
|
models/icpr2020dfdc/assets/mqzvfufzoq_face_att.gif
ADDED
|
Git LFS Details
|
models/icpr2020dfdc/blazeface/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .blazeface import BlazeFace
|
| 2 |
+
from .face_extract import FaceExtractor
|
| 3 |
+
from .read_video import VideoReader
|
models/icpr2020dfdc/blazeface/anchors.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a10bb2fb93ab54ca426d6c750bfc3aad685028a16dcf231357d03694f261fd95
|
| 3 |
+
size 28800
|
models/icpr2020dfdc/blazeface/blazeface.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54ecff653feaaaf1f7d44b6aff28fd2fc50e483a4e847563b6dd261369c43ba4
|
| 3 |
+
size 420224
|
models/icpr2020dfdc/blazeface/blazeface.py
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
import torch
|
| 5 |
+
import torch.nn as nn
|
| 6 |
+
import torch.nn.functional as F
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class BlazeBlock(nn.Module):
|
| 10 |
+
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1):
|
| 11 |
+
super(BlazeBlock, self).__init__()
|
| 12 |
+
|
| 13 |
+
self.stride = stride
|
| 14 |
+
self.channel_pad = out_channels - in_channels
|
| 15 |
+
|
| 16 |
+
# TFLite uses slightly different padding than PyTorch
|
| 17 |
+
# on the depthwise conv layer when the stride is 2.
|
| 18 |
+
if stride == 2:
|
| 19 |
+
self.max_pool = nn.MaxPool2d(kernel_size=stride, stride=stride)
|
| 20 |
+
padding = 0
|
| 21 |
+
else:
|
| 22 |
+
padding = (kernel_size - 1) // 2
|
| 23 |
+
|
| 24 |
+
self.convs = nn.Sequential(
|
| 25 |
+
nn.Conv2d(in_channels=in_channels, out_channels=in_channels,
|
| 26 |
+
kernel_size=kernel_size, stride=stride, padding=padding,
|
| 27 |
+
groups=in_channels, bias=True),
|
| 28 |
+
nn.Conv2d(in_channels=in_channels, out_channels=out_channels,
|
| 29 |
+
kernel_size=1, stride=1, padding=0, bias=True),
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
self.act = nn.ReLU(inplace=True)
|
| 33 |
+
|
| 34 |
+
def forward(self, x):
|
| 35 |
+
if self.stride == 2:
|
| 36 |
+
h = F.pad(x, (0, 2, 0, 2), "constant", 0)
|
| 37 |
+
x = self.max_pool(x)
|
| 38 |
+
else:
|
| 39 |
+
h = x
|
| 40 |
+
|
| 41 |
+
if self.channel_pad > 0:
|
| 42 |
+
x = F.pad(x, (0, 0, 0, 0, 0, self.channel_pad), "constant", 0)
|
| 43 |
+
|
| 44 |
+
return self.act(self.convs(h) + x)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class BlazeFace(nn.Module):
|
| 48 |
+
"""The BlazeFace face detection model from MediaPipe.
|
| 49 |
+
|
| 50 |
+
The version from MediaPipe is simpler than the one in the paper;
|
| 51 |
+
it does not use the "double" BlazeBlocks.
|
| 52 |
+
|
| 53 |
+
Because we won't be training this model, it doesn't need to have
|
| 54 |
+
batchnorm layers. These have already been "folded" into the conv
|
| 55 |
+
weights by TFLite.
|
| 56 |
+
|
| 57 |
+
The conversion to PyTorch is fairly straightforward, but there are
|
| 58 |
+
some small differences between TFLite and PyTorch in how they handle
|
| 59 |
+
padding on conv layers with stride 2.
|
| 60 |
+
|
| 61 |
+
This version works on batches, while the MediaPipe version can only
|
| 62 |
+
handle a single image at a time.
|
| 63 |
+
|
| 64 |
+
Based on code from https://github.com/tkat0/PyTorch_BlazeFace/ and
|
| 65 |
+
https://github.com/google/mediapipe/
|
| 66 |
+
"""
|
| 67 |
+
input_size = (128, 128)
|
| 68 |
+
|
| 69 |
+
detection_keys = [
|
| 70 |
+
'ymin', 'xmin', 'ymax', 'xmax',
|
| 71 |
+
'kp1x', 'kp1y', 'kp2x', 'kp2y', 'kp3x', 'kp3y', 'kp4x', 'kp4y', 'kp5x', 'kp5y', 'kp6x', 'kp6y',
|
| 72 |
+
'conf'
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
def __init__(self):
|
| 76 |
+
super(BlazeFace, self).__init__()
|
| 77 |
+
|
| 78 |
+
# These are the settings from the MediaPipe example graph
|
| 79 |
+
# mediapipe/graphs/face_detection/face_detection_mobile_gpu.pbtxt
|
| 80 |
+
self.num_classes = 1
|
| 81 |
+
self.num_anchors = 896
|
| 82 |
+
self.num_coords = 16
|
| 83 |
+
self.score_clipping_thresh = 100.0
|
| 84 |
+
self.x_scale = 128.0
|
| 85 |
+
self.y_scale = 128.0
|
| 86 |
+
self.h_scale = 128.0
|
| 87 |
+
self.w_scale = 128.0
|
| 88 |
+
self.min_score_thresh = 0.75
|
| 89 |
+
self.min_suppression_threshold = 0.3
|
| 90 |
+
|
| 91 |
+
self._define_layers()
|
| 92 |
+
|
| 93 |
+
def _define_layers(self):
|
| 94 |
+
self.backbone1 = nn.Sequential(
|
| 95 |
+
nn.Conv2d(in_channels=3, out_channels=24, kernel_size=5, stride=2, padding=0, bias=True),
|
| 96 |
+
nn.ReLU(inplace=True),
|
| 97 |
+
|
| 98 |
+
BlazeBlock(24, 24),
|
| 99 |
+
BlazeBlock(24, 28),
|
| 100 |
+
BlazeBlock(28, 32, stride=2),
|
| 101 |
+
BlazeBlock(32, 36),
|
| 102 |
+
BlazeBlock(36, 42),
|
| 103 |
+
BlazeBlock(42, 48, stride=2),
|
| 104 |
+
BlazeBlock(48, 56),
|
| 105 |
+
BlazeBlock(56, 64),
|
| 106 |
+
BlazeBlock(64, 72),
|
| 107 |
+
BlazeBlock(72, 80),
|
| 108 |
+
BlazeBlock(80, 88),
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
self.backbone2 = nn.Sequential(
|
| 112 |
+
BlazeBlock(88, 96, stride=2),
|
| 113 |
+
BlazeBlock(96, 96),
|
| 114 |
+
BlazeBlock(96, 96),
|
| 115 |
+
BlazeBlock(96, 96),
|
| 116 |
+
BlazeBlock(96, 96),
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
self.classifier_8 = nn.Conv2d(88, 2, 1, bias=True)
|
| 120 |
+
self.classifier_16 = nn.Conv2d(96, 6, 1, bias=True)
|
| 121 |
+
|
| 122 |
+
self.regressor_8 = nn.Conv2d(88, 32, 1, bias=True)
|
| 123 |
+
self.regressor_16 = nn.Conv2d(96, 96, 1, bias=True)
|
| 124 |
+
|
| 125 |
+
def forward(self, x):
|
| 126 |
+
# TFLite uses slightly different padding on the first conv layer
|
| 127 |
+
# than PyTorch, so do it manually.
|
| 128 |
+
x = F.pad(x, (1, 2, 1, 2), "constant", 0)
|
| 129 |
+
|
| 130 |
+
b = x.shape[0] # batch size, needed for reshaping later
|
| 131 |
+
|
| 132 |
+
x = self.backbone1(x) # (b, 88, 16, 16)
|
| 133 |
+
h = self.backbone2(x) # (b, 96, 8, 8)
|
| 134 |
+
|
| 135 |
+
# Note: Because PyTorch is NCHW but TFLite is NHWC, we need to
|
| 136 |
+
# permute the output from the conv layers before reshaping it.
|
| 137 |
+
|
| 138 |
+
c1 = self.classifier_8(x) # (b, 2, 16, 16)
|
| 139 |
+
c1 = c1.permute(0, 2, 3, 1) # (b, 16, 16, 2)
|
| 140 |
+
c1 = c1.reshape(b, -1, 1) # (b, 512, 1)
|
| 141 |
+
|
| 142 |
+
c2 = self.classifier_16(h) # (b, 6, 8, 8)
|
| 143 |
+
c2 = c2.permute(0, 2, 3, 1) # (b, 8, 8, 6)
|
| 144 |
+
c2 = c2.reshape(b, -1, 1) # (b, 384, 1)
|
| 145 |
+
|
| 146 |
+
c = torch.cat((c1, c2), dim=1) # (b, 896, 1)
|
| 147 |
+
|
| 148 |
+
r1 = self.regressor_8(x) # (b, 32, 16, 16)
|
| 149 |
+
r1 = r1.permute(0, 2, 3, 1) # (b, 16, 16, 32)
|
| 150 |
+
r1 = r1.reshape(b, -1, 16) # (b, 512, 16)
|
| 151 |
+
|
| 152 |
+
r2 = self.regressor_16(h) # (b, 96, 8, 8)
|
| 153 |
+
r2 = r2.permute(0, 2, 3, 1) # (b, 8, 8, 96)
|
| 154 |
+
r2 = r2.reshape(b, -1, 16) # (b, 384, 16)
|
| 155 |
+
|
| 156 |
+
r = torch.cat((r1, r2), dim=1) # (b, 896, 16)
|
| 157 |
+
return [r, c]
|
| 158 |
+
|
| 159 |
+
def _device(self):
|
| 160 |
+
"""Which device (CPU or GPU) is being used by this model?"""
|
| 161 |
+
return self.classifier_8.weight.device
|
| 162 |
+
|
| 163 |
+
def load_weights(self, path):
|
| 164 |
+
self.load_state_dict(torch.load(path))
|
| 165 |
+
self.eval()
|
| 166 |
+
|
| 167 |
+
def load_anchors(self, path):
|
| 168 |
+
self.anchors = torch.tensor(np.load(path), dtype=torch.float32, device=self._device())
|
| 169 |
+
assert (self.anchors.ndimension() == 2)
|
| 170 |
+
assert (self.anchors.shape[0] == self.num_anchors)
|
| 171 |
+
assert (self.anchors.shape[1] == 4)
|
| 172 |
+
|
| 173 |
+
def _preprocess(self, x):
|
| 174 |
+
"""Converts the image pixels to the range [-1, 1]."""
|
| 175 |
+
return x.float() / 127.5 - 1.0
|
| 176 |
+
|
| 177 |
+
def predict_on_image(self, img):
|
| 178 |
+
"""Makes a prediction on a single image.
|
| 179 |
+
|
| 180 |
+
Arguments:
|
| 181 |
+
img: a NumPy array of shape (H, W, 3) or a PyTorch tensor of
|
| 182 |
+
shape (3, H, W). The image's height and width should be
|
| 183 |
+
128 pixels.
|
| 184 |
+
|
| 185 |
+
Returns:
|
| 186 |
+
A tensor with face detections.
|
| 187 |
+
"""
|
| 188 |
+
if isinstance(img, np.ndarray):
|
| 189 |
+
img = torch.from_numpy(img).permute((2, 0, 1))
|
| 190 |
+
|
| 191 |
+
return self.predict_on_batch(img.unsqueeze(0))[0]
|
| 192 |
+
|
| 193 |
+
def predict_on_batch(self, x: np.ndarray or torch.Tensor, apply_nms: bool = True) -> List[torch.Tensor]:
|
| 194 |
+
"""Makes a prediction on a batch of images.
|
| 195 |
+
|
| 196 |
+
Arguments:
|
| 197 |
+
x: a NumPy array of shape (b, H, W, 3) or a PyTorch tensor of
|
| 198 |
+
shape (b, 3, H, W). The height and width should be 128 pixels.
|
| 199 |
+
apply_nms: pass False to not apply non-max suppression
|
| 200 |
+
|
| 201 |
+
Returns:
|
| 202 |
+
A list containing a tensor of face detections for each image in
|
| 203 |
+
the batch. If no faces are found for an image, returns a tensor
|
| 204 |
+
of shape (0, 17).
|
| 205 |
+
|
| 206 |
+
Each face detection is a PyTorch tensor consisting of 17 numbers:
|
| 207 |
+
- ymin, xmin, ymax, xmax
|
| 208 |
+
- x,y-coordinates for the 6 keypoints
|
| 209 |
+
- confidence score
|
| 210 |
+
"""
|
| 211 |
+
if isinstance(x, np.ndarray):
|
| 212 |
+
x = torch.from_numpy(x).permute((0, 3, 1, 2))
|
| 213 |
+
|
| 214 |
+
assert x.shape[1] == 3
|
| 215 |
+
assert x.shape[2] == 128
|
| 216 |
+
assert x.shape[3] == 128
|
| 217 |
+
|
| 218 |
+
# 1. Preprocess the images into tensors:
|
| 219 |
+
x = x.to(self._device())
|
| 220 |
+
x = self._preprocess(x)
|
| 221 |
+
|
| 222 |
+
# 2. Run the neural network:
|
| 223 |
+
with torch.no_grad():
|
| 224 |
+
out: torch.Tensor = self.__call__(x)
|
| 225 |
+
|
| 226 |
+
# 3. Postprocess the raw predictions:
|
| 227 |
+
detections = self._tensors_to_detections(out[0], out[1], self.anchors)
|
| 228 |
+
|
| 229 |
+
# 4. Non-maximum suppression to remove overlapping detections:
|
| 230 |
+
return self.nms(detections) if apply_nms else detections
|
| 231 |
+
|
| 232 |
+
def nms(self, detections: List[torch.Tensor]) -> List[torch.Tensor]:
|
| 233 |
+
"""Filters out overlapping detections."""
|
| 234 |
+
filtered_detections = []
|
| 235 |
+
for i in range(len(detections)):
|
| 236 |
+
faces = self._weighted_non_max_suppression(detections[i])
|
| 237 |
+
faces = torch.stack(faces) if len(faces) > 0 else torch.zeros((0, 17), device=self._device())
|
| 238 |
+
filtered_detections.append(faces)
|
| 239 |
+
|
| 240 |
+
return filtered_detections
|
| 241 |
+
|
| 242 |
+
def _tensors_to_detections(self, raw_box_tensor: torch.Tensor, raw_score_tensor: torch.Tensor, anchors) -> List[
|
| 243 |
+
torch.Tensor]:
|
| 244 |
+
"""The output of the neural network is a tensor of shape (b, 896, 16)
|
| 245 |
+
containing the bounding box regressor predictions, as well as a tensor
|
| 246 |
+
of shape (b, 896, 1) with the classification confidences.
|
| 247 |
+
|
| 248 |
+
This function converts these two "raw" tensors into proper detections.
|
| 249 |
+
Returns a list of (num_detections, 17) tensors, one for each image in
|
| 250 |
+
the batch.
|
| 251 |
+
|
| 252 |
+
This is based on the source code from:
|
| 253 |
+
mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.cc
|
| 254 |
+
mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.proto
|
| 255 |
+
"""
|
| 256 |
+
assert raw_box_tensor.ndimension() == 3
|
| 257 |
+
assert raw_box_tensor.shape[1] == self.num_anchors
|
| 258 |
+
assert raw_box_tensor.shape[2] == self.num_coords
|
| 259 |
+
|
| 260 |
+
assert raw_score_tensor.ndimension() == 3
|
| 261 |
+
assert raw_score_tensor.shape[1] == self.num_anchors
|
| 262 |
+
assert raw_score_tensor.shape[2] == self.num_classes
|
| 263 |
+
|
| 264 |
+
assert raw_box_tensor.shape[0] == raw_score_tensor.shape[0]
|
| 265 |
+
|
| 266 |
+
detection_boxes = self._decode_boxes(raw_box_tensor, anchors)
|
| 267 |
+
|
| 268 |
+
thresh = self.score_clipping_thresh
|
| 269 |
+
raw_score_tensor = raw_score_tensor.clamp(-thresh, thresh)
|
| 270 |
+
detection_scores = raw_score_tensor.sigmoid().squeeze(dim=-1)
|
| 271 |
+
|
| 272 |
+
# Note: we stripped off the last dimension from the scores tensor
|
| 273 |
+
# because there is only has one class. Now we can simply use a mask
|
| 274 |
+
# to filter out the boxes with too low confidence.
|
| 275 |
+
mask = detection_scores >= self.min_score_thresh
|
| 276 |
+
|
| 277 |
+
# Because each image from the batch can have a different number of
|
| 278 |
+
# detections, process them one at a time using a loop.
|
| 279 |
+
output_detections = []
|
| 280 |
+
for i in range(raw_box_tensor.shape[0]):
|
| 281 |
+
boxes = detection_boxes[i, mask[i]]
|
| 282 |
+
scores = detection_scores[i, mask[i]].unsqueeze(dim=-1)
|
| 283 |
+
output_detections.append(torch.cat((boxes, scores), dim=-1))
|
| 284 |
+
|
| 285 |
+
return output_detections
|
| 286 |
+
|
| 287 |
+
def _decode_boxes(self, raw_boxes, anchors):
|
| 288 |
+
"""Converts the predictions into actual coordinates using
|
| 289 |
+
the anchor boxes. Processes the entire batch at once.
|
| 290 |
+
"""
|
| 291 |
+
boxes = torch.zeros_like(raw_boxes)
|
| 292 |
+
|
| 293 |
+
x_center = raw_boxes[..., 0] / self.x_scale * anchors[:, 2] + anchors[:, 0]
|
| 294 |
+
y_center = raw_boxes[..., 1] / self.y_scale * anchors[:, 3] + anchors[:, 1]
|
| 295 |
+
|
| 296 |
+
w = raw_boxes[..., 2] / self.w_scale * anchors[:, 2]
|
| 297 |
+
h = raw_boxes[..., 3] / self.h_scale * anchors[:, 3]
|
| 298 |
+
|
| 299 |
+
boxes[..., 0] = y_center - h / 2. # ymin
|
| 300 |
+
boxes[..., 1] = x_center - w / 2. # xmin
|
| 301 |
+
boxes[..., 2] = y_center + h / 2. # ymax
|
| 302 |
+
boxes[..., 3] = x_center + w / 2. # xmax
|
| 303 |
+
|
| 304 |
+
for k in range(6):
|
| 305 |
+
offset = 4 + k * 2
|
| 306 |
+
keypoint_x = raw_boxes[..., offset] / self.x_scale * anchors[:, 2] + anchors[:, 0]
|
| 307 |
+
keypoint_y = raw_boxes[..., offset + 1] / self.y_scale * anchors[:, 3] + anchors[:, 1]
|
| 308 |
+
boxes[..., offset] = keypoint_x
|
| 309 |
+
boxes[..., offset + 1] = keypoint_y
|
| 310 |
+
|
| 311 |
+
return boxes
|
| 312 |
+
|
| 313 |
+
def _weighted_non_max_suppression(self, detections):
|
| 314 |
+
"""The alternative NMS method as mentioned in the BlazeFace paper:
|
| 315 |
+
|
| 316 |
+
"We replace the suppression algorithm with a blending strategy that
|
| 317 |
+
estimates the regression parameters of a bounding box as a weighted
|
| 318 |
+
mean between the overlapping predictions."
|
| 319 |
+
|
| 320 |
+
The original MediaPipe code assigns the score of the most confident
|
| 321 |
+
detection to the weighted detection, but we take the average score
|
| 322 |
+
of the overlapping detections.
|
| 323 |
+
|
| 324 |
+
The input detections should be a Tensor of shape (count, 17).
|
| 325 |
+
|
| 326 |
+
Returns a list of PyTorch tensors, one for each detected face.
|
| 327 |
+
|
| 328 |
+
This is based on the source code from:
|
| 329 |
+
mediapipe/calculators/util/non_max_suppression_calculator.cc
|
| 330 |
+
mediapipe/calculators/util/non_max_suppression_calculator.proto
|
| 331 |
+
"""
|
| 332 |
+
if len(detections) == 0: return []
|
| 333 |
+
|
| 334 |
+
output_detections = []
|
| 335 |
+
|
| 336 |
+
# Sort the detections from highest to lowest score.
|
| 337 |
+
remaining = torch.argsort(detections[:, 16], descending=True)
|
| 338 |
+
|
| 339 |
+
while len(remaining) > 0:
|
| 340 |
+
detection = detections[remaining[0]]
|
| 341 |
+
|
| 342 |
+
# Compute the overlap between the first box and the other
|
| 343 |
+
# remaining boxes. (Note that the other_boxes also include
|
| 344 |
+
# the first_box.)
|
| 345 |
+
first_box = detection[:4]
|
| 346 |
+
other_boxes = detections[remaining, :4]
|
| 347 |
+
ious = overlap_similarity(first_box, other_boxes)
|
| 348 |
+
|
| 349 |
+
# If two detections don't overlap enough, they are considered
|
| 350 |
+
# to be from different faces.
|
| 351 |
+
mask = ious > self.min_suppression_threshold
|
| 352 |
+
overlapping = remaining[mask]
|
| 353 |
+
remaining = remaining[~mask]
|
| 354 |
+
|
| 355 |
+
# Take an average of the coordinates from the overlapping
|
| 356 |
+
# detections, weighted by their confidence scores.
|
| 357 |
+
weighted_detection = detection.clone()
|
| 358 |
+
if len(overlapping) > 1:
|
| 359 |
+
coordinates = detections[overlapping, :16]
|
| 360 |
+
scores = detections[overlapping, 16:17]
|
| 361 |
+
total_score = scores.sum()
|
| 362 |
+
weighted = (coordinates * scores).sum(dim=0) / total_score
|
| 363 |
+
weighted_detection[:16] = weighted
|
| 364 |
+
weighted_detection[16] = total_score / len(overlapping)
|
| 365 |
+
|
| 366 |
+
output_detections.append(weighted_detection)
|
| 367 |
+
|
| 368 |
+
return output_detections
|
| 369 |
+
|
| 370 |
+
# IOU code from https://github.com/amdegroot/ssd.pytorch/blob/master/layers/box_utils.py
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
def intersect(box_a, box_b):
|
| 374 |
+
""" We resize both tensors to [A,B,2] without new malloc:
|
| 375 |
+
[A,2] -> [A,1,2] -> [A,B,2]
|
| 376 |
+
[B,2] -> [1,B,2] -> [A,B,2]
|
| 377 |
+
Then we compute the area of intersect between box_a and box_b.
|
| 378 |
+
Args:
|
| 379 |
+
box_a: (tensor) bounding boxes, Shape: [A,4].
|
| 380 |
+
box_b: (tensor) bounding boxes, Shape: [B,4].
|
| 381 |
+
Return:
|
| 382 |
+
(tensor) intersection area, Shape: [A,B].
|
| 383 |
+
"""
|
| 384 |
+
A = box_a.size(0)
|
| 385 |
+
B = box_b.size(0)
|
| 386 |
+
max_xy = torch.min(box_a[:, 2:].unsqueeze(1).expand(A, B, 2),
|
| 387 |
+
box_b[:, 2:].unsqueeze(0).expand(A, B, 2))
|
| 388 |
+
min_xy = torch.max(box_a[:, :2].unsqueeze(1).expand(A, B, 2),
|
| 389 |
+
box_b[:, :2].unsqueeze(0).expand(A, B, 2))
|
| 390 |
+
inter = torch.clamp((max_xy - min_xy), min=0)
|
| 391 |
+
return inter[:, :, 0] * inter[:, :, 1]
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
def jaccard(box_a, box_b):
|
| 395 |
+
"""Compute the jaccard overlap of two sets of boxes. The jaccard overlap
|
| 396 |
+
is simply the intersection over union of two boxes. Here we operate on
|
| 397 |
+
ground truth boxes and default boxes.
|
| 398 |
+
E.g.:
|
| 399 |
+
A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
|
| 400 |
+
Args:
|
| 401 |
+
box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
|
| 402 |
+
box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
|
| 403 |
+
Return:
|
| 404 |
+
jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
|
| 405 |
+
"""
|
| 406 |
+
inter = intersect(box_a, box_b)
|
| 407 |
+
area_a = ((box_a[:, 2] - box_a[:, 0]) *
|
| 408 |
+
(box_a[:, 3] - box_a[:, 1])).unsqueeze(1).expand_as(inter) # [A,B]
|
| 409 |
+
area_b = ((box_b[:, 2] - box_b[:, 0]) *
|
| 410 |
+
(box_b[:, 3] - box_b[:, 1])).unsqueeze(0).expand_as(inter) # [A,B]
|
| 411 |
+
union = area_a + area_b - inter
|
| 412 |
+
return inter / union # [A,B]
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
def overlap_similarity(box, other_boxes):
|
| 416 |
+
"""Computes the IOU between a bounding box and set of other boxes."""
|
| 417 |
+
return jaccard(box.unsqueeze(0), other_boxes).squeeze(0)
|
models/icpr2020dfdc/blazeface/face_extract.py
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from typing import Tuple, List
|
| 3 |
+
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
import torch
|
| 7 |
+
from PIL import Image
|
| 8 |
+
|
| 9 |
+
from blazeface import BlazeFace
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class FaceExtractor:
|
| 13 |
+
"""Wrapper for face extraction workflow."""
|
| 14 |
+
|
| 15 |
+
def __init__(self, video_read_fn = None, facedet: BlazeFace = None):
|
| 16 |
+
"""Creates a new FaceExtractor.
|
| 17 |
+
|
| 18 |
+
Arguments:
|
| 19 |
+
video_read_fn: a function that takes in a path to a video file
|
| 20 |
+
and returns a tuple consisting of a NumPy array with shape
|
| 21 |
+
(num_frames, H, W, 3) and a list of frame indices, or None
|
| 22 |
+
in case of an error
|
| 23 |
+
facedet: the face detector object
|
| 24 |
+
"""
|
| 25 |
+
self.video_read_fn = video_read_fn
|
| 26 |
+
self.facedet = facedet
|
| 27 |
+
|
| 28 |
+
def process_image(self, path: str = None, img: Image.Image or np.ndarray = None) -> dict:
|
| 29 |
+
"""
|
| 30 |
+
Process a single image
|
| 31 |
+
:param path: Path to the image
|
| 32 |
+
:param img: image
|
| 33 |
+
:return:
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
if img is not None and path is not None:
|
| 37 |
+
raise ValueError('Only one argument between path and img can be specified')
|
| 38 |
+
if img is None and path is None:
|
| 39 |
+
raise ValueError('At least one argument between path and img must be specified')
|
| 40 |
+
|
| 41 |
+
target_size = self.facedet.input_size
|
| 42 |
+
|
| 43 |
+
if img is None:
|
| 44 |
+
img = np.asarray(Image.open(str(path)))
|
| 45 |
+
else:
|
| 46 |
+
img = np.asarray(img)
|
| 47 |
+
|
| 48 |
+
# Split the frames into several tiles. Resize the tiles to 128x128.
|
| 49 |
+
tiles, resize_info = self._tile_frames(np.expand_dims(img, 0), target_size)
|
| 50 |
+
# tiles has shape (num_tiles, target_size, target_size, 3)
|
| 51 |
+
# resize_info is a list of four elements [resize_factor_y, resize_factor_x, 0, 0]
|
| 52 |
+
|
| 53 |
+
# Run the face detector. The result is a list of PyTorch tensors,
|
| 54 |
+
# one for each tile in the batch.
|
| 55 |
+
detections = self.facedet.predict_on_batch(tiles, apply_nms=False)
|
| 56 |
+
|
| 57 |
+
# Convert the detections from 128x128 back to the original frame size.
|
| 58 |
+
detections = self._resize_detections(detections, target_size, resize_info)
|
| 59 |
+
|
| 60 |
+
# Because we have several tiles for each frame, combine the predictions
|
| 61 |
+
# from these tiles. The result is a list of PyTorch tensors, but now one
|
| 62 |
+
# for each frame (rather than each tile).
|
| 63 |
+
num_frames = 1
|
| 64 |
+
frame_size = (img.shape[1], img.shape[0])
|
| 65 |
+
detections = self._untile_detections(num_frames, frame_size, detections)
|
| 66 |
+
|
| 67 |
+
# The same face may have been detected in multiple tiles, so filter out
|
| 68 |
+
# overlapping detections. This is done separately for each frame.
|
| 69 |
+
detections = self.facedet.nms(detections)
|
| 70 |
+
|
| 71 |
+
# Crop the faces out of the original frame.
|
| 72 |
+
frameref_detections = self._add_margin_to_detections(detections[0], frame_size, 0.2)
|
| 73 |
+
faces = self._crop_faces(img, frameref_detections)
|
| 74 |
+
kpts = self._crop_kpts(img, detections[0], 0.3)
|
| 75 |
+
|
| 76 |
+
# Add additional information about the frame and detections.
|
| 77 |
+
scores = list(detections[0][:, 16].cpu().numpy())
|
| 78 |
+
frame_dict = {"frame_w": frame_size[0],
|
| 79 |
+
"frame_h": frame_size[1],
|
| 80 |
+
"faces": faces,
|
| 81 |
+
"kpts": kpts,
|
| 82 |
+
"detections": frameref_detections.cpu().numpy(),
|
| 83 |
+
"scores": scores,
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
# Sort faces by descending confidence
|
| 87 |
+
frame_dict = self._soft_faces_by_descending_score(frame_dict)
|
| 88 |
+
|
| 89 |
+
return frame_dict
|
| 90 |
+
|
| 91 |
+
def _soft_faces_by_descending_score(self, frame_dict: dict) -> dict:
|
| 92 |
+
if len(frame_dict['scores']) > 1:
|
| 93 |
+
sort_idxs = np.argsort(frame_dict['scores'])[::-1]
|
| 94 |
+
new_faces = [frame_dict['faces'][i] for i in sort_idxs]
|
| 95 |
+
new_kpts = [frame_dict['kpts'][i] for i in sort_idxs]
|
| 96 |
+
new_detections = frame_dict['detections'][sort_idxs]
|
| 97 |
+
new_scores = [frame_dict['scores'][i] for i in sort_idxs]
|
| 98 |
+
frame_dict['faces'] = new_faces
|
| 99 |
+
frame_dict['kpts'] = new_kpts
|
| 100 |
+
frame_dict['detections'] = new_detections
|
| 101 |
+
frame_dict['scores'] = new_scores
|
| 102 |
+
return frame_dict
|
| 103 |
+
|
| 104 |
+
def process_videos(self, input_dir, filenames, video_idxs) -> List[dict]:
|
| 105 |
+
"""For the specified selection of videos, grabs one or more frames
|
| 106 |
+
from each video, runs the face detector, and tries to find the faces
|
| 107 |
+
in each frame.
|
| 108 |
+
|
| 109 |
+
The frames are split into tiles, and the tiles from the different videos
|
| 110 |
+
are concatenated into a single batch. This means the face detector gets
|
| 111 |
+
a batch of size len(video_idxs) * num_frames * num_tiles (usually 3).
|
| 112 |
+
|
| 113 |
+
Arguments:
|
| 114 |
+
input_dir: base folder where the video files are stored
|
| 115 |
+
filenames: list of all video files in the input_dir
|
| 116 |
+
video_idxs: one or more indices from the filenames list; these
|
| 117 |
+
are the videos we'll actually process
|
| 118 |
+
|
| 119 |
+
Returns a list of dictionaries, one for each frame read from each video.
|
| 120 |
+
|
| 121 |
+
This dictionary contains:
|
| 122 |
+
- video_idx: the video this frame was taken from
|
| 123 |
+
- frame_idx: the index of the frame in the video
|
| 124 |
+
- frame_w, frame_h: original dimensions of the frame
|
| 125 |
+
- faces: a list containing zero or more NumPy arrays with a face crop
|
| 126 |
+
- scores: a list array with the confidence score for each face crop
|
| 127 |
+
|
| 128 |
+
If reading a video failed for some reason, it will not appear in the
|
| 129 |
+
output array. Note that there's no guarantee a given video will actually
|
| 130 |
+
have num_frames results (as soon as a reading problem is encountered for
|
| 131 |
+
a video, we continue with the next video).
|
| 132 |
+
"""
|
| 133 |
+
target_size = self.facedet.input_size
|
| 134 |
+
|
| 135 |
+
videos_read = []
|
| 136 |
+
frames_read = []
|
| 137 |
+
frames = []
|
| 138 |
+
tiles = []
|
| 139 |
+
resize_info = []
|
| 140 |
+
|
| 141 |
+
for video_idx in video_idxs:
|
| 142 |
+
# Read the full-size frames from this video.
|
| 143 |
+
filename = filenames[video_idx]
|
| 144 |
+
video_path = os.path.join(input_dir, filename)
|
| 145 |
+
result = self.video_read_fn(video_path)
|
| 146 |
+
|
| 147 |
+
# Error? Then skip this video.
|
| 148 |
+
if result is None: continue
|
| 149 |
+
|
| 150 |
+
videos_read.append(video_idx)
|
| 151 |
+
|
| 152 |
+
# Keep track of the original frames (need them later).
|
| 153 |
+
my_frames, my_idxs = result
|
| 154 |
+
frames.append(my_frames)
|
| 155 |
+
frames_read.append(my_idxs)
|
| 156 |
+
|
| 157 |
+
# Split the frames into several tiles. Resize the tiles to 128x128.
|
| 158 |
+
my_tiles, my_resize_info = self._tile_frames(my_frames, target_size)
|
| 159 |
+
tiles.append(my_tiles)
|
| 160 |
+
resize_info.append(my_resize_info)
|
| 161 |
+
|
| 162 |
+
if len(tiles) == 0:
|
| 163 |
+
return []
|
| 164 |
+
# Put all the tiles for all the frames from all the videos into
|
| 165 |
+
# a single batch.
|
| 166 |
+
batch = np.concatenate(tiles)
|
| 167 |
+
|
| 168 |
+
# Run the face detector. The result is a list of PyTorch tensors,
|
| 169 |
+
# one for each image in the batch.
|
| 170 |
+
all_detections = self.facedet.predict_on_batch(batch, apply_nms=False)
|
| 171 |
+
|
| 172 |
+
result = []
|
| 173 |
+
offs = 0
|
| 174 |
+
for v in range(len(tiles)):
|
| 175 |
+
# Not all videos may have the same number of tiles, so find which
|
| 176 |
+
# detections go with which video.
|
| 177 |
+
num_tiles = tiles[v].shape[0]
|
| 178 |
+
detections = all_detections[offs:offs + num_tiles]
|
| 179 |
+
offs += num_tiles
|
| 180 |
+
|
| 181 |
+
# Convert the detections from 128x128 back to the original frame size.
|
| 182 |
+
detections = self._resize_detections(detections, target_size, resize_info[v])
|
| 183 |
+
|
| 184 |
+
# Because we have several tiles for each frame, combine the predictions
|
| 185 |
+
# from these tiles. The result is a list of PyTorch tensors, but now one
|
| 186 |
+
# for each frame (rather than each tile).
|
| 187 |
+
num_frames = frames[v].shape[0]
|
| 188 |
+
frame_size = (frames[v].shape[2], frames[v].shape[1])
|
| 189 |
+
detections = self._untile_detections(num_frames, frame_size, detections)
|
| 190 |
+
|
| 191 |
+
# The same face may have been detected in multiple tiles, so filter out
|
| 192 |
+
# overlapping detections. This is done separately for each frame.
|
| 193 |
+
detections = self.facedet.nms(detections)
|
| 194 |
+
|
| 195 |
+
for i in range(len(detections)):
|
| 196 |
+
# Crop the faces out of the original frame.
|
| 197 |
+
frameref_detections = self._add_margin_to_detections(detections[i], frame_size, 0.2)
|
| 198 |
+
faces = self._crop_faces(frames[v][i], frameref_detections)
|
| 199 |
+
kpts = self._crop_kpts(frames[v][i], detections[i], 0.3)
|
| 200 |
+
|
| 201 |
+
# Add additional information about the frame and detections.
|
| 202 |
+
scores = list(detections[i][:, 16].cpu().numpy())
|
| 203 |
+
frame_dict = {"video_idx": videos_read[v],
|
| 204 |
+
"frame_idx": frames_read[v][i],
|
| 205 |
+
"frame_w": frame_size[0],
|
| 206 |
+
"frame_h": frame_size[1],
|
| 207 |
+
"frame": frames[v][i],
|
| 208 |
+
"faces": faces,
|
| 209 |
+
"kpts": kpts,
|
| 210 |
+
"detections": frameref_detections.cpu().numpy(),
|
| 211 |
+
"scores": scores,
|
| 212 |
+
}
|
| 213 |
+
# Sort faces by descending confidence
|
| 214 |
+
frame_dict = self._soft_faces_by_descending_score(frame_dict)
|
| 215 |
+
|
| 216 |
+
result.append(frame_dict)
|
| 217 |
+
|
| 218 |
+
return result
|
| 219 |
+
|
| 220 |
+
def process_video(self, video_path):
|
| 221 |
+
"""Convenience method for doing face extraction on a single video."""
|
| 222 |
+
input_dir = os.path.dirname(video_path)
|
| 223 |
+
filenames = [os.path.basename(video_path)]
|
| 224 |
+
return self.process_videos(input_dir, filenames, [0])
|
| 225 |
+
|
| 226 |
+
def _tile_frames(self, frames: np.ndarray, target_size: Tuple[int, int]) -> (np.ndarray, List[float]):
|
| 227 |
+
"""Splits each frame into several smaller, partially overlapping tiles
|
| 228 |
+
and resizes each tile to target_size.
|
| 229 |
+
|
| 230 |
+
After a bunch of experimentation, I found that for a 1920x1080 video,
|
| 231 |
+
BlazeFace works better on three 1080x1080 windows. These overlap by 420
|
| 232 |
+
pixels. (Two windows also work but it's best to have a clean center crop
|
| 233 |
+
in there as well.)
|
| 234 |
+
|
| 235 |
+
I also tried 6 windows of size 720x720 (horizontally: 720|360, 360|720;
|
| 236 |
+
vertically: 720|1200, 480|720|480, 1200|720) but that gives many false
|
| 237 |
+
positives when a window has no face in it.
|
| 238 |
+
|
| 239 |
+
For a video in portrait orientation (1080x1920), we only take a single
|
| 240 |
+
crop of the top-most 1080 pixels. If we split up the video vertically,
|
| 241 |
+
then we might get false positives again.
|
| 242 |
+
|
| 243 |
+
(NOTE: Not all videos are necessarily 1080p but the code can handle this.)
|
| 244 |
+
|
| 245 |
+
Arguments:
|
| 246 |
+
frames: NumPy array of shape (num_frames, height, width, 3)
|
| 247 |
+
target_size: (width, height)
|
| 248 |
+
|
| 249 |
+
Returns:
|
| 250 |
+
- a new (num_frames * N, target_size[1], target_size[0], 3) array
|
| 251 |
+
where N is the number of tiles used.
|
| 252 |
+
- a list [scale_w, scale_h, offset_x, offset_y] that describes how
|
| 253 |
+
to map the resized and cropped tiles back to the original image
|
| 254 |
+
coordinates. This is needed for scaling up the face detections
|
| 255 |
+
from the smaller image to the original image, so we can take the
|
| 256 |
+
face crops in the original coordinate space.
|
| 257 |
+
"""
|
| 258 |
+
num_frames, H, W, _ = frames.shape
|
| 259 |
+
|
| 260 |
+
num_h, num_v, split_size, x_step, y_step = self.get_tiles_params(H, W)
|
| 261 |
+
|
| 262 |
+
splits = np.zeros((num_frames * num_v * num_h, target_size[1], target_size[0], 3), dtype=np.uint8)
|
| 263 |
+
|
| 264 |
+
i = 0
|
| 265 |
+
for f in range(num_frames):
|
| 266 |
+
y = 0
|
| 267 |
+
for v in range(num_v):
|
| 268 |
+
x = 0
|
| 269 |
+
for h in range(num_h):
|
| 270 |
+
crop = frames[f, y:y + split_size, x:x + split_size, :]
|
| 271 |
+
splits[i] = cv2.resize(crop, target_size, interpolation=cv2.INTER_AREA)
|
| 272 |
+
x += x_step
|
| 273 |
+
i += 1
|
| 274 |
+
y += y_step
|
| 275 |
+
|
| 276 |
+
resize_info = [split_size / target_size[0], split_size / target_size[1], 0, 0]
|
| 277 |
+
return splits, resize_info
|
| 278 |
+
|
| 279 |
+
def get_tiles_params(self, H, W):
|
| 280 |
+
split_size = min(H, W, 720)
|
| 281 |
+
x_step = (W - split_size) // 2
|
| 282 |
+
y_step = (H - split_size) // 2
|
| 283 |
+
num_v = (H - split_size) // y_step + 1 if y_step > 0 else 1
|
| 284 |
+
num_h = (W - split_size) // x_step + 1 if x_step > 0 else 1
|
| 285 |
+
return num_h, num_v, split_size, x_step, y_step
|
| 286 |
+
|
| 287 |
+
def _resize_detections(self, detections, target_size, resize_info):
|
| 288 |
+
"""Converts a list of face detections back to the original
|
| 289 |
+
coordinate system.
|
| 290 |
+
|
| 291 |
+
Arguments:
|
| 292 |
+
detections: a list containing PyTorch tensors of shape (num_faces, 17)
|
| 293 |
+
target_size: (width, height)
|
| 294 |
+
resize_info: [scale_w, scale_h, offset_x, offset_y]
|
| 295 |
+
"""
|
| 296 |
+
projected = []
|
| 297 |
+
target_w, target_h = target_size
|
| 298 |
+
scale_w, scale_h, offset_x, offset_y = resize_info
|
| 299 |
+
|
| 300 |
+
for i in range(len(detections)):
|
| 301 |
+
detection = detections[i].clone()
|
| 302 |
+
|
| 303 |
+
# ymin, xmin, ymax, xmax
|
| 304 |
+
for k in range(2):
|
| 305 |
+
detection[:, k * 2] = (detection[:, k * 2] * target_h - offset_y) * scale_h
|
| 306 |
+
detection[:, k * 2 + 1] = (detection[:, k * 2 + 1] * target_w - offset_x) * scale_w
|
| 307 |
+
|
| 308 |
+
# keypoints are x,y
|
| 309 |
+
for k in range(2, 8):
|
| 310 |
+
detection[:, k * 2] = (detection[:, k * 2] * target_w - offset_x) * scale_w
|
| 311 |
+
detection[:, k * 2 + 1] = (detection[:, k * 2 + 1] * target_h - offset_y) * scale_h
|
| 312 |
+
|
| 313 |
+
projected.append(detection)
|
| 314 |
+
|
| 315 |
+
return projected
|
| 316 |
+
|
| 317 |
+
def _untile_detections(self, num_frames: int, frame_size: Tuple[int, int], detections: List[torch.Tensor]) -> List[
|
| 318 |
+
torch.Tensor]:
|
| 319 |
+
"""With N tiles per frame, there also are N times as many detections.
|
| 320 |
+
This function groups together the detections for a given frame; it is
|
| 321 |
+
the complement to tile_frames().
|
| 322 |
+
"""
|
| 323 |
+
combined_detections = []
|
| 324 |
+
|
| 325 |
+
W, H = frame_size
|
| 326 |
+
|
| 327 |
+
num_h, num_v, split_size, x_step, y_step = self.get_tiles_params(H, W)
|
| 328 |
+
|
| 329 |
+
i = 0
|
| 330 |
+
for f in range(num_frames):
|
| 331 |
+
detections_for_frame = []
|
| 332 |
+
y = 0
|
| 333 |
+
for v in range(num_v):
|
| 334 |
+
x = 0
|
| 335 |
+
for h in range(num_h):
|
| 336 |
+
# Adjust the coordinates based on the split positions.
|
| 337 |
+
detection = detections[i].clone()
|
| 338 |
+
if detection.shape[0] > 0:
|
| 339 |
+
for k in range(2):
|
| 340 |
+
detection[:, k * 2] += y
|
| 341 |
+
detection[:, k * 2 + 1] += x
|
| 342 |
+
for k in range(2, 8):
|
| 343 |
+
detection[:, k * 2] += x
|
| 344 |
+
detection[:, k * 2 + 1] += y
|
| 345 |
+
|
| 346 |
+
detections_for_frame.append(detection)
|
| 347 |
+
x += x_step
|
| 348 |
+
i += 1
|
| 349 |
+
y += y_step
|
| 350 |
+
|
| 351 |
+
combined_detections.append(torch.cat(detections_for_frame))
|
| 352 |
+
|
| 353 |
+
return combined_detections
|
| 354 |
+
|
| 355 |
+
def _add_margin_to_detections(self, detections: torch.Tensor, frame_size: Tuple[int, int],
|
| 356 |
+
margin: float = 0.2) -> torch.Tensor:
|
| 357 |
+
"""Expands the face bounding box.
|
| 358 |
+
|
| 359 |
+
NOTE: The face detections often do not include the forehead, which
|
| 360 |
+
is why we use twice the margin for ymin.
|
| 361 |
+
|
| 362 |
+
Arguments:
|
| 363 |
+
detections: a PyTorch tensor of shape (num_detections, 17)
|
| 364 |
+
frame_size: maximum (width, height)
|
| 365 |
+
margin: a percentage of the bounding box's height
|
| 366 |
+
|
| 367 |
+
Returns a PyTorch tensor of shape (num_detections, 17).
|
| 368 |
+
"""
|
| 369 |
+
offset = torch.round(margin * (detections[:, 2] - detections[:, 0]))
|
| 370 |
+
detections = detections.clone()
|
| 371 |
+
detections[:, 0] = torch.clamp(detections[:, 0] - offset * 2, min=0) # ymin
|
| 372 |
+
detections[:, 1] = torch.clamp(detections[:, 1] - offset, min=0) # xmin
|
| 373 |
+
detections[:, 2] = torch.clamp(detections[:, 2] + offset, max=frame_size[1]) # ymax
|
| 374 |
+
detections[:, 3] = torch.clamp(detections[:, 3] + offset, max=frame_size[0]) # xmax
|
| 375 |
+
return detections
|
| 376 |
+
|
| 377 |
+
def _crop_faces(self, frame: np.ndarray, detections: torch.Tensor) -> List[np.ndarray]:
|
| 378 |
+
"""Copies the face region(s) from the given frame into a set
|
| 379 |
+
of new NumPy arrays.
|
| 380 |
+
|
| 381 |
+
Arguments:
|
| 382 |
+
frame: a NumPy array of shape (H, W, 3)
|
| 383 |
+
detections: a PyTorch tensor of shape (num_detections, 17)
|
| 384 |
+
|
| 385 |
+
Returns a list of NumPy arrays, one for each face crop. If there
|
| 386 |
+
are no faces detected for this frame, returns an empty list.
|
| 387 |
+
"""
|
| 388 |
+
faces = []
|
| 389 |
+
for i in range(len(detections)):
|
| 390 |
+
ymin, xmin, ymax, xmax = detections[i, :4].cpu().numpy().astype(int)
|
| 391 |
+
face = frame[ymin:ymax, xmin:xmax, :]
|
| 392 |
+
faces.append(face)
|
| 393 |
+
return faces
|
| 394 |
+
|
| 395 |
+
def _crop_kpts(self, frame: np.ndarray, detections: torch.Tensor, face_fraction: float):
|
| 396 |
+
"""Copies the parts region(s) from the given frame into a set
|
| 397 |
+
of new NumPy arrays.
|
| 398 |
+
|
| 399 |
+
Arguments:
|
| 400 |
+
frame: a NumPy array of shape (H, W, 3)
|
| 401 |
+
detections: a PyTorch tensor of shape (num_detections, 17)
|
| 402 |
+
face_fraction: float between 0 and 1 indicating how big are the parts to be extracted w.r.t the whole face
|
| 403 |
+
|
| 404 |
+
Returns a list of NumPy arrays, one for each face crop. If there
|
| 405 |
+
are no faces detected for this frame, returns an empty list.
|
| 406 |
+
"""
|
| 407 |
+
faces = []
|
| 408 |
+
for i in range(len(detections)):
|
| 409 |
+
kpts = []
|
| 410 |
+
size = int(face_fraction * min(detections[i, 2] - detections[i, 0], detections[i, 3] - detections[i, 1]))
|
| 411 |
+
kpts_coords = detections[i, 4:16].cpu().numpy().astype(int)
|
| 412 |
+
for kpidx in range(6):
|
| 413 |
+
kpx, kpy = kpts_coords[kpidx * 2:kpidx * 2 + 2]
|
| 414 |
+
kpt = frame[kpy - size // 2:kpy - size // 2 + size, kpx - size // 2:kpx - size // 2 + size, ]
|
| 415 |
+
kpts.append(kpt)
|
| 416 |
+
faces.append(kpts)
|
| 417 |
+
return faces
|
| 418 |
+
|
| 419 |
+
def remove_large_crops(self, crops, pct=0.1):
|
| 420 |
+
"""Removes faces from the results if they take up more than X%
|
| 421 |
+
of the video. Such a face is likely a false positive.
|
| 422 |
+
|
| 423 |
+
This is an optional postprocessing step. Modifies the original
|
| 424 |
+
data structure.
|
| 425 |
+
|
| 426 |
+
Arguments:
|
| 427 |
+
crops: a list of dictionaries with face crop data
|
| 428 |
+
pct: maximum portion of the frame a crop may take up
|
| 429 |
+
"""
|
| 430 |
+
for i in range(len(crops)):
|
| 431 |
+
frame_data = crops[i]
|
| 432 |
+
video_area = frame_data["frame_w"] * frame_data["frame_h"]
|
| 433 |
+
faces = frame_data["faces"]
|
| 434 |
+
scores = frame_data["scores"]
|
| 435 |
+
new_faces = []
|
| 436 |
+
new_scores = []
|
| 437 |
+
for j in range(len(faces)):
|
| 438 |
+
face = faces[j]
|
| 439 |
+
face_H, face_W, _ = face.shape
|
| 440 |
+
face_area = face_H * face_W
|
| 441 |
+
if face_area / video_area < 0.1:
|
| 442 |
+
new_faces.append(face)
|
| 443 |
+
new_scores.append(scores[j])
|
| 444 |
+
frame_data["faces"] = new_faces
|
| 445 |
+
frame_data["scores"] = new_scores
|
| 446 |
+
|
| 447 |
+
def keep_only_best_face(self, crops):
|
| 448 |
+
"""For each frame, only keeps the face with the highest confidence.
|
| 449 |
+
|
| 450 |
+
This gets rid of false positives, but obviously is problematic for
|
| 451 |
+
videos with two people!
|
| 452 |
+
|
| 453 |
+
This is an optional postprocessing step. Modifies the original
|
| 454 |
+
data structure.
|
| 455 |
+
"""
|
| 456 |
+
for i in range(len(crops)):
|
| 457 |
+
frame_data = crops[i]
|
| 458 |
+
if len(frame_data["faces"]) > 0:
|
| 459 |
+
frame_data["faces"] = frame_data["faces"][:1]
|
| 460 |
+
frame_data["scores"] = frame_data["scores"][:1]
|
| 461 |
+
|
| 462 |
+
# TODO: def filter_likely_false_positives(self, crops):
|
| 463 |
+
# if only some frames have more than 1 face, it's likely a false positive
|
| 464 |
+
# if most frames have more than 1 face, it's probably two people
|
| 465 |
+
# so find the % of frames with > 1 face; if > 0.X, keep the two best faces
|
| 466 |
+
|
| 467 |
+
# TODO: def filter_by_score(self, crops, min_score) to remove any
|
| 468 |
+
# crops with a confidence score lower than min_score
|
| 469 |
+
|
| 470 |
+
# TODO: def sort_by_histogram(self, crops) for videos with 2 people.
|
models/icpr2020dfdc/blazeface/read_video.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class VideoReader:
|
| 6 |
+
"""Helper class for reading one or more frames from a video file."""
|
| 7 |
+
|
| 8 |
+
def __init__(self, verbose=True, insets=(0, 0)):
|
| 9 |
+
"""Creates a new VideoReader.
|
| 10 |
+
|
| 11 |
+
Arguments:
|
| 12 |
+
verbose: whether to print warnings and error messages
|
| 13 |
+
insets: amount to inset the image by, as a percentage of
|
| 14 |
+
(width, height). This lets you "zoom in" to an image
|
| 15 |
+
to remove unimportant content around the borders.
|
| 16 |
+
Useful for face detection, which may not work if the
|
| 17 |
+
faces are too small.
|
| 18 |
+
"""
|
| 19 |
+
self.verbose = verbose
|
| 20 |
+
self.insets = insets
|
| 21 |
+
|
| 22 |
+
def read_frames(self, path, num_frames, jitter=0, seed=None):
|
| 23 |
+
"""Reads frames that are always evenly spaced throughout the video.
|
| 24 |
+
|
| 25 |
+
Arguments:
|
| 26 |
+
path: the video file
|
| 27 |
+
num_frames: how many frames to read, -1 means the entire video
|
| 28 |
+
(warning: this will take up a lot of memory!)
|
| 29 |
+
jitter: if not 0, adds small random offsets to the frame indices;
|
| 30 |
+
this is useful so we don't always land on even or odd frames
|
| 31 |
+
seed: random seed for jittering; if you set this to a fixed value,
|
| 32 |
+
you probably want to set it only on the first video
|
| 33 |
+
"""
|
| 34 |
+
assert num_frames > 0
|
| 35 |
+
|
| 36 |
+
capture = cv2.VideoCapture(path)
|
| 37 |
+
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 38 |
+
if frame_count <= 0: return None
|
| 39 |
+
|
| 40 |
+
frame_idxs = np.linspace(0, frame_count - 1, num_frames, endpoint=True, dtype=int)
|
| 41 |
+
frame_idxs = np.unique(frame_idxs) # Avoid repeating frame idxs otherwise it breaks reading
|
| 42 |
+
if jitter > 0:
|
| 43 |
+
np.random.seed(seed)
|
| 44 |
+
jitter_offsets = np.random.randint(-jitter, jitter, len(frame_idxs))
|
| 45 |
+
frame_idxs = np.clip(frame_idxs + jitter_offsets, 0, frame_count - 1)
|
| 46 |
+
|
| 47 |
+
result = self._read_frames_at_indices(path, capture, frame_idxs)
|
| 48 |
+
capture.release()
|
| 49 |
+
return result
|
| 50 |
+
|
| 51 |
+
def read_random_frames(self, path, num_frames, seed=None):
|
| 52 |
+
"""Picks the frame indices at random.
|
| 53 |
+
|
| 54 |
+
Arguments:
|
| 55 |
+
path: the video file
|
| 56 |
+
num_frames: how many frames to read, -1 means the entire video
|
| 57 |
+
(warning: this will take up a lot of memory!)
|
| 58 |
+
"""
|
| 59 |
+
assert num_frames > 0
|
| 60 |
+
np.random.seed(seed)
|
| 61 |
+
|
| 62 |
+
capture = cv2.VideoCapture(path)
|
| 63 |
+
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 64 |
+
if frame_count <= 0: return None
|
| 65 |
+
|
| 66 |
+
frame_idxs = sorted(np.random.choice(np.arange(0, frame_count), num_frames))
|
| 67 |
+
result = self._read_frames_at_indices(path, capture, frame_idxs)
|
| 68 |
+
|
| 69 |
+
capture.release()
|
| 70 |
+
return result
|
| 71 |
+
|
| 72 |
+
def read_frames_at_indices(self, path, frame_idxs):
|
| 73 |
+
"""Reads frames from a video and puts them into a NumPy array.
|
| 74 |
+
|
| 75 |
+
Arguments:
|
| 76 |
+
path: the video file
|
| 77 |
+
frame_idxs: a list of frame indices. Important: should be
|
| 78 |
+
sorted from low-to-high! If an index appears multiple
|
| 79 |
+
times, the frame is still read only once.
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
- a NumPy array of shape (num_frames, height, width, 3)
|
| 83 |
+
- a list of the frame indices that were read
|
| 84 |
+
|
| 85 |
+
Reading stops if loading a frame fails, in which case the first
|
| 86 |
+
dimension returned may actually be less than num_frames.
|
| 87 |
+
|
| 88 |
+
Returns None if an exception is thrown for any reason, or if no
|
| 89 |
+
frames were read.
|
| 90 |
+
"""
|
| 91 |
+
assert len(frame_idxs) > 0
|
| 92 |
+
capture = cv2.VideoCapture(path)
|
| 93 |
+
result = self._read_frames_at_indices(path, capture, frame_idxs)
|
| 94 |
+
capture.release()
|
| 95 |
+
return result
|
| 96 |
+
|
| 97 |
+
def _read_frames_at_indices(self, path, capture, frame_idxs):
|
| 98 |
+
try:
|
| 99 |
+
frames = []
|
| 100 |
+
idxs_read = []
|
| 101 |
+
for frame_idx in range(frame_idxs[0], frame_idxs[-1] + 1):
|
| 102 |
+
# Get the next frame, but don't decode if we're not using it.
|
| 103 |
+
ret = capture.grab()
|
| 104 |
+
if not ret:
|
| 105 |
+
if self.verbose:
|
| 106 |
+
print("Error grabbing frame %d from movie %s" % (frame_idx, path))
|
| 107 |
+
break
|
| 108 |
+
|
| 109 |
+
# Need to look at this frame?
|
| 110 |
+
current = len(idxs_read)
|
| 111 |
+
if frame_idx == frame_idxs[current]:
|
| 112 |
+
ret, frame = capture.retrieve()
|
| 113 |
+
if not ret or frame is None:
|
| 114 |
+
if self.verbose:
|
| 115 |
+
print("Error retrieving frame %d from movie %s" % (frame_idx, path))
|
| 116 |
+
break
|
| 117 |
+
|
| 118 |
+
frame = self._postprocess_frame(frame)
|
| 119 |
+
frames.append(frame)
|
| 120 |
+
idxs_read.append(frame_idx)
|
| 121 |
+
|
| 122 |
+
if len(frames) > 0:
|
| 123 |
+
return np.stack(frames), idxs_read
|
| 124 |
+
if self.verbose:
|
| 125 |
+
print("No frames read from movie %s" % path)
|
| 126 |
+
return None
|
| 127 |
+
except:
|
| 128 |
+
if self.verbose:
|
| 129 |
+
print("Exception while reading movie %s" % path)
|
| 130 |
+
return None
|
| 131 |
+
|
| 132 |
+
def read_middle_frame(self, path):
|
| 133 |
+
"""Reads the frame from the middle of the video."""
|
| 134 |
+
capture = cv2.VideoCapture(path)
|
| 135 |
+
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 136 |
+
result = self._read_frame_at_index(path, capture, frame_count // 2)
|
| 137 |
+
capture.release()
|
| 138 |
+
return result
|
| 139 |
+
|
| 140 |
+
def read_frame_at_index(self, path, frame_idx):
|
| 141 |
+
"""Reads a single frame from a video.
|
| 142 |
+
|
| 143 |
+
If you just want to read a single frame from the video, this is more
|
| 144 |
+
efficient than scanning through the video to find the frame. However,
|
| 145 |
+
for reading multiple frames it's not efficient.
|
| 146 |
+
|
| 147 |
+
My guess is that a "streaming" approach is more efficient than a
|
| 148 |
+
"random access" approach because, unless you happen to grab a keyframe,
|
| 149 |
+
the decoder still needs to read all the previous frames in order to
|
| 150 |
+
reconstruct the one you're asking for.
|
| 151 |
+
|
| 152 |
+
Returns a NumPy array of shape (1, H, W, 3) and the index of the frame,
|
| 153 |
+
or None if reading failed.
|
| 154 |
+
"""
|
| 155 |
+
capture = cv2.VideoCapture(path)
|
| 156 |
+
result = self._read_frame_at_index(path, capture, frame_idx)
|
| 157 |
+
capture.release()
|
| 158 |
+
return result
|
| 159 |
+
|
| 160 |
+
def _read_frame_at_index(self, path, capture, frame_idx):
|
| 161 |
+
capture.set(cv2.CAP_PROP_POS_FRAMES, frame_idx)
|
| 162 |
+
ret, frame = capture.read()
|
| 163 |
+
if not ret or frame is None:
|
| 164 |
+
if self.verbose:
|
| 165 |
+
print("Error retrieving frame %d from movie %s" % (frame_idx, path))
|
| 166 |
+
return None
|
| 167 |
+
else:
|
| 168 |
+
frame = self._postprocess_frame(frame)
|
| 169 |
+
return np.expand_dims(frame, axis=0), [frame_idx]
|
| 170 |
+
|
| 171 |
+
def _postprocess_frame(self, frame):
|
| 172 |
+
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 173 |
+
|
| 174 |
+
if self.insets[0] > 0:
|
| 175 |
+
W = frame.shape[1]
|
| 176 |
+
p = int(W * self.insets[0])
|
| 177 |
+
frame = frame[:, p:-p, :]
|
| 178 |
+
|
| 179 |
+
if self.insets[1] > 0:
|
| 180 |
+
H = frame.shape[1]
|
| 181 |
+
q = int(H * self.insets[1])
|
| 182 |
+
frame = frame[q:-q, :, :]
|
| 183 |
+
|
| 184 |
+
return frame
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class VideoReaderIspl(VideoReader):
|
| 188 |
+
"""
|
| 189 |
+
Derived VideoReader class with overriden read_frames method
|
| 190 |
+
"""
|
| 191 |
+
|
| 192 |
+
def read_frames_with_hop(self, path: str, num_frames: int = -1, fps: int = -1):
|
| 193 |
+
"""Reads frames up to a certain number spaced throughout the video with a rate decided by the user.
|
| 194 |
+
|
| 195 |
+
Arguments:
|
| 196 |
+
path: the video file
|
| 197 |
+
num_frames: how many frames to read, -1 means the entire video
|
| 198 |
+
(warning: this will take up a lot of memory!)
|
| 199 |
+
fps: how many frames per second to pick
|
| 200 |
+
"""
|
| 201 |
+
assert num_frames > 0
|
| 202 |
+
|
| 203 |
+
capture = cv2.VideoCapture(path)
|
| 204 |
+
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 205 |
+
if frame_count <= 0: return None
|
| 206 |
+
video_rate = capture.get(cv2.CAP_PROP_FPS)
|
| 207 |
+
hop = 1 if fps == -1 else max(video_rate // fps, 1)
|
| 208 |
+
end_pts = frame_count if num_frames == -1 else num_frames * hop
|
| 209 |
+
frame_idxs = np.arange(0, end_pts - 1, hop, endpoint=True, dtype=int)
|
| 210 |
+
|
| 211 |
+
result = self._read_frames_at_indices(path, capture, frame_idxs)
|
| 212 |
+
capture.release()
|
| 213 |
+
return result
|
models/icpr2020dfdc/environment.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: icpr2020
|
| 2 |
+
channels:
|
| 3 |
+
- pytorch
|
| 4 |
+
- conda-forge
|
| 5 |
+
- defaults
|
| 6 |
+
dependencies:
|
| 7 |
+
- av=6.2.0
|
| 8 |
+
- albumentations
|
| 9 |
+
- cudatoolkit
|
| 10 |
+
- ffmpeg
|
| 11 |
+
- jupyter
|
| 12 |
+
- numpy
|
| 13 |
+
- opencv=3.4.2
|
| 14 |
+
- py-opencv=3.4.2
|
| 15 |
+
- python=3.6.9
|
| 16 |
+
- pip
|
| 17 |
+
- pytorch=1.4.0
|
| 18 |
+
- torchvision
|
| 19 |
+
- tqdm
|
| 20 |
+
- pandas
|
| 21 |
+
- pip:
|
| 22 |
+
- tensorboardx==2.0
|
| 23 |
+
- efficientnet-pytorch
|
| 24 |
+
- scikit-learn
|
| 25 |
+
|
models/icpr2020dfdc/extract_faces.py
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Extract faces
|
| 3 |
+
|
| 4 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 5 |
+
|
| 6 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 7 |
+
|
| 8 |
+
Nicolò Bonettini
|
| 9 |
+
Edoardo Daniele Cannas
|
| 10 |
+
Sara Mandelli
|
| 11 |
+
Luca Bondi
|
| 12 |
+
Paolo Bestagini
|
| 13 |
+
"""
|
| 14 |
+
import argparse
|
| 15 |
+
import sys
|
| 16 |
+
import traceback
|
| 17 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 18 |
+
from functools import partial
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
from typing import Tuple, List
|
| 21 |
+
|
| 22 |
+
import numpy as np
|
| 23 |
+
import pandas as pd
|
| 24 |
+
import torch
|
| 25 |
+
import torch.cuda
|
| 26 |
+
from PIL import Image
|
| 27 |
+
from tqdm import tqdm
|
| 28 |
+
|
| 29 |
+
import blazeface
|
| 30 |
+
from blazeface import BlazeFace, VideoReader, FaceExtractor
|
| 31 |
+
from isplutils.utils import adapt_bb
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def parse_args(argv):
|
| 35 |
+
parser = argparse.ArgumentParser()
|
| 36 |
+
parser.add_argument('--source', type=Path, help='Videos root directory', required=True)
|
| 37 |
+
parser.add_argument('--videodf', type=Path, help='Path to read the videos DataFrame', required=True)
|
| 38 |
+
parser.add_argument('--facesfolder', type=Path, help='Faces output root directory', required=True)
|
| 39 |
+
parser.add_argument('--facesdf', type=Path, help='Path to save the output DataFrame of faces', required=True)
|
| 40 |
+
parser.add_argument('--checkpoint', type=Path, help='Path to save the temporary per-video outputs', required=True)
|
| 41 |
+
|
| 42 |
+
parser.add_argument('--fpv', type=int, default=32, help='Frames per video')
|
| 43 |
+
parser.add_argument('--device', type=torch.device,
|
| 44 |
+
default=torch.device('cuda:0' if torch.cuda.is_available() else 'cpu'),
|
| 45 |
+
help='Device to use for face extraction')
|
| 46 |
+
parser.add_argument('--collateonly', help='Only perform collation of pre-existing results', action='store_true')
|
| 47 |
+
parser.add_argument('--noindex', help='Do not rebuild the index', action='store_false')
|
| 48 |
+
parser.add_argument('--batch', type=int, help='Batch size', default=16)
|
| 49 |
+
parser.add_argument('--threads', type=int, help='Number of threads', default=8)
|
| 50 |
+
parser.add_argument('--offset', type=int, help='Offset to start extraction', default=0)
|
| 51 |
+
parser.add_argument('--num', type=int, help='Number of videos to process', default=0)
|
| 52 |
+
parser.add_argument('--lazycheck', action='store_true', help='Lazy check of existing video indexes')
|
| 53 |
+
parser.add_argument('--deepcheck', action='store_true', help='Try to open every image')
|
| 54 |
+
|
| 55 |
+
return parser.parse_args(argv)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def main(argv):
|
| 59 |
+
args = parse_args(argv)
|
| 60 |
+
|
| 61 |
+
## Parameters parsing
|
| 62 |
+
device: torch.device = args.device
|
| 63 |
+
source_dir: Path = args.source
|
| 64 |
+
facedestination_dir: Path = args.facesfolder
|
| 65 |
+
frames_per_video: int = args.fpv
|
| 66 |
+
videodataset_path: Path = args.videodf
|
| 67 |
+
facesdataset_path: Path = args.facesdf
|
| 68 |
+
collateonly: bool = args.collateonly
|
| 69 |
+
batch_size: int = args.batch
|
| 70 |
+
threads: int = args.threads
|
| 71 |
+
offset: int = args.offset
|
| 72 |
+
num: int = args.num
|
| 73 |
+
lazycheck: bool = args.lazycheck
|
| 74 |
+
deepcheck: bool = args.deepcheck
|
| 75 |
+
checkpoint_folder: Path = args.checkpoint
|
| 76 |
+
index_enable: bool = args.noindex
|
| 77 |
+
|
| 78 |
+
## Parameters
|
| 79 |
+
face_size = 512
|
| 80 |
+
|
| 81 |
+
print('Loading video DataFrame')
|
| 82 |
+
df_videos = pd.read_pickle(videodataset_path)
|
| 83 |
+
|
| 84 |
+
if num > 0:
|
| 85 |
+
df_videos_process = df_videos.iloc[offset:offset + num]
|
| 86 |
+
else:
|
| 87 |
+
df_videos_process = df_videos.iloc[offset:]
|
| 88 |
+
|
| 89 |
+
if not collateonly:
|
| 90 |
+
|
| 91 |
+
## Blazeface loading
|
| 92 |
+
print('Loading face extractor')
|
| 93 |
+
facedet = BlazeFace().to(device)
|
| 94 |
+
facedet.load_weights("blazeface/blazeface.pth")
|
| 95 |
+
facedet.load_anchors("blazeface/anchors.npy")
|
| 96 |
+
videoreader = VideoReader(verbose=False)
|
| 97 |
+
video_read_fn = lambda x: videoreader.read_frames(x, num_frames=frames_per_video)
|
| 98 |
+
face_extractor = FaceExtractor(video_read_fn, facedet)
|
| 99 |
+
|
| 100 |
+
## Face extraction
|
| 101 |
+
with ThreadPoolExecutor(threads) as p:
|
| 102 |
+
for batch_idx0 in tqdm(np.arange(start=0, stop=len(df_videos_process), step=batch_size),
|
| 103 |
+
desc='Extracting faces'):
|
| 104 |
+
tosave_list = list(p.map(partial(process_video,
|
| 105 |
+
source_dir=source_dir,
|
| 106 |
+
facedestination_dir=facedestination_dir,
|
| 107 |
+
checkpoint_folder=checkpoint_folder,
|
| 108 |
+
face_size=face_size,
|
| 109 |
+
face_extractor=face_extractor,
|
| 110 |
+
lazycheck=lazycheck,
|
| 111 |
+
deepcheck=deepcheck,
|
| 112 |
+
),
|
| 113 |
+
df_videos_process.iloc[batch_idx0:batch_idx0 + batch_size].iterrows()))
|
| 114 |
+
|
| 115 |
+
for tosave in tosave_list:
|
| 116 |
+
if tosave is not None:
|
| 117 |
+
if len(tosave[2]):
|
| 118 |
+
list(p.map(save_jpg, tosave[2]))
|
| 119 |
+
tosave[1].parent.mkdir(parents=True, exist_ok=True)
|
| 120 |
+
tosave[0].to_pickle(str(tosave[1]))
|
| 121 |
+
|
| 122 |
+
if index_enable:
|
| 123 |
+
# Collect checkpoints
|
| 124 |
+
df_videos['nfaces'] = np.zeros(len(df_videos), np.uint8)
|
| 125 |
+
faces_dataset = []
|
| 126 |
+
for idx, record in tqdm(df_videos.iterrows(), total=len(df_videos), desc='Collecting faces results'):
|
| 127 |
+
# Checkpoint
|
| 128 |
+
video_face_checkpoint_path = checkpoint_folder.joinpath(record['path']).with_suffix('.faces.pkl')
|
| 129 |
+
if video_face_checkpoint_path.exists():
|
| 130 |
+
try:
|
| 131 |
+
df_video_faces = pd.read_pickle(str(video_face_checkpoint_path))
|
| 132 |
+
# Fix same attribute issue
|
| 133 |
+
df_video_faces = df_video_faces.rename(columns={'subject': 'videosubject'}, errors='ignore')
|
| 134 |
+
nfaces = len(
|
| 135 |
+
np.unique(df_video_faces.index.map(lambda x: int(x.split('_subj')[1].split('.jpg')[0]))))
|
| 136 |
+
df_videos.loc[idx, 'nfaces'] = nfaces
|
| 137 |
+
faces_dataset.append(df_video_faces)
|
| 138 |
+
except Exception as e:
|
| 139 |
+
print('Error while reading: {}'.format(video_face_checkpoint_path))
|
| 140 |
+
print(e)
|
| 141 |
+
video_face_checkpoint_path.unlink()
|
| 142 |
+
|
| 143 |
+
if len(faces_dataset) == 0:
|
| 144 |
+
raise ValueError(f'No checkpoint found from face extraction. '
|
| 145 |
+
f'Is the the source path {source_dir} correct for the videos in your dataframe?')
|
| 146 |
+
|
| 147 |
+
# Save videos with updated faces
|
| 148 |
+
print('Saving videos DataFrame to {}'.format(videodataset_path))
|
| 149 |
+
df_videos.to_pickle(str(videodataset_path))
|
| 150 |
+
|
| 151 |
+
if offset > 0:
|
| 152 |
+
if num > 0:
|
| 153 |
+
if facesdataset_path.is_dir():
|
| 154 |
+
facesdataset_path = facesdataset_path.joinpath(
|
| 155 |
+
'faces_df_from_video_{}_to_video_{}.pkl'.format(offset, num + offset))
|
| 156 |
+
else:
|
| 157 |
+
facesdataset_path = facesdataset_path.parent.joinpath(
|
| 158 |
+
str(facesdataset_path.parts[-1]).split('.')[0] + '_from_video_{}_to_video_{}.pkl'.format(offset,
|
| 159 |
+
num + offset))
|
| 160 |
+
else:
|
| 161 |
+
if facesdataset_path.is_dir():
|
| 162 |
+
facesdataset_path = facesdataset_path.joinpath('faces_df_from_video_{}.pkl'.format(offset))
|
| 163 |
+
else:
|
| 164 |
+
facesdataset_path = facesdataset_path.parent.joinpath(
|
| 165 |
+
str(facesdataset_path.parts[-1]).split('.')[0] + '_from_video_{}.pkl'.format(offset))
|
| 166 |
+
elif num > 0:
|
| 167 |
+
if facesdataset_path.is_dir():
|
| 168 |
+
facesdataset_path = facesdataset_path.joinpath(
|
| 169 |
+
'faces_df_from_video_{}_to_video_{}.pkl'.format(0, num))
|
| 170 |
+
else:
|
| 171 |
+
facesdataset_path = facesdataset_path.parent.joinpath(
|
| 172 |
+
str(facesdataset_path.parts[-1]).split('.')[0] + '_from_video_{}_to_video_{}.pkl'.format(0, num))
|
| 173 |
+
else:
|
| 174 |
+
if facesdataset_path.is_dir():
|
| 175 |
+
facesdataset_path = facesdataset_path.joinpath('faces_df.pkl') # just a check if the path is a dir
|
| 176 |
+
|
| 177 |
+
# Creates directory (if doesn't exist)
|
| 178 |
+
facesdataset_path.parent.mkdir(parents=True, exist_ok=True)
|
| 179 |
+
print('Saving faces DataFrame to {}'.format(facesdataset_path))
|
| 180 |
+
df_faces = pd.concat(faces_dataset, axis=0, )
|
| 181 |
+
df_faces['video'] = df_faces['video'].astype('category')
|
| 182 |
+
for key in ['kp1x', 'kp1y', 'kp2x', 'kp2y', 'kp3x',
|
| 183 |
+
'kp3y', 'kp4x', 'kp4y', 'kp5x', 'kp5y', 'kp6x', 'kp6y', 'left',
|
| 184 |
+
'top', 'right', 'bottom', ]:
|
| 185 |
+
df_faces[key] = df_faces[key].astype(np.int16)
|
| 186 |
+
df_faces['videosubject'] = df_faces['videosubject'].astype(np.int8)
|
| 187 |
+
# Eventually remove duplicates
|
| 188 |
+
df_faces = df_faces.loc[~df_faces.index.duplicated(keep='first')]
|
| 189 |
+
fields_to_preserve_from_video = [i for i in
|
| 190 |
+
['folder', 'subject', 'scene', 'cluster', 'nfaces', 'test'] if
|
| 191 |
+
i in df_videos]
|
| 192 |
+
df_faces = pd.merge(df_faces, df_videos[fields_to_preserve_from_video], left_on='video',
|
| 193 |
+
right_index=True)
|
| 194 |
+
df_faces.to_pickle(str(facesdataset_path))
|
| 195 |
+
|
| 196 |
+
print('Completed!')
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def save_jpg(args: Tuple[Image.Image, Path or str]):
|
| 200 |
+
image, path = args
|
| 201 |
+
image.save(path, quality=95, subsampling='4:4:4')
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def process_video(item: Tuple[pd.Index, pd.Series],
|
| 205 |
+
source_dir: Path,
|
| 206 |
+
facedestination_dir: Path,
|
| 207 |
+
checkpoint_folder: Path,
|
| 208 |
+
face_size: int,
|
| 209 |
+
face_extractor: FaceExtractor,
|
| 210 |
+
lazycheck: bool = False,
|
| 211 |
+
deepcheck: bool = False,
|
| 212 |
+
) -> (pd.DataFrame, Path, List[Tuple[Image.Image, Path]]) or None:
|
| 213 |
+
# Instatiate Index and Series
|
| 214 |
+
idx, record = item
|
| 215 |
+
|
| 216 |
+
# Checkpoint
|
| 217 |
+
video_faces_checkpoint_path = checkpoint_folder.joinpath(record['path']).with_suffix('.faces.pkl')
|
| 218 |
+
|
| 219 |
+
if not lazycheck:
|
| 220 |
+
if video_faces_checkpoint_path.exists():
|
| 221 |
+
try:
|
| 222 |
+
df_video_faces = pd.read_pickle(str(video_faces_checkpoint_path))
|
| 223 |
+
for _, r in df_video_faces.iterrows():
|
| 224 |
+
face_path = facedestination_dir.joinpath(r.name)
|
| 225 |
+
assert (face_path.exists())
|
| 226 |
+
if deepcheck:
|
| 227 |
+
img = Image.open(face_path)
|
| 228 |
+
img_arr = np.asarray(img)
|
| 229 |
+
assert (img_arr.ndim == 3)
|
| 230 |
+
assert (np.prod(img_arr.shape) > 0)
|
| 231 |
+
except Exception as e:
|
| 232 |
+
print('Error while checking: {}'.format(video_faces_checkpoint_path))
|
| 233 |
+
print(e)
|
| 234 |
+
video_faces_checkpoint_path.unlink()
|
| 235 |
+
|
| 236 |
+
if not (video_faces_checkpoint_path.exists()):
|
| 237 |
+
|
| 238 |
+
try:
|
| 239 |
+
|
| 240 |
+
video_face_dict_list = []
|
| 241 |
+
|
| 242 |
+
# Load faces
|
| 243 |
+
current_video_path = source_dir.joinpath(record['path'])
|
| 244 |
+
if not current_video_path.exists():
|
| 245 |
+
raise FileNotFoundError(f'Unable to find {current_video_path}.'
|
| 246 |
+
f'Are you sure that {source_dir} is the correct source directory for the video '
|
| 247 |
+
f'you indexed in the dataframe?')
|
| 248 |
+
|
| 249 |
+
frames = face_extractor.process_video(current_video_path)
|
| 250 |
+
|
| 251 |
+
if len(frames) == 0:
|
| 252 |
+
return
|
| 253 |
+
|
| 254 |
+
face_extractor.keep_only_best_face(frames)
|
| 255 |
+
for frame_idx, frame in enumerate(frames):
|
| 256 |
+
frames[frame_idx]['subjects'] = [0] * len(frames[frame_idx]['detections'])
|
| 257 |
+
|
| 258 |
+
# Extract and save faces, bounding boxes, keypoints
|
| 259 |
+
images_to_save: List[Tuple[Image.Image, Path]] = []
|
| 260 |
+
for frame_idx, frame in enumerate(frames):
|
| 261 |
+
if len(frames[frame_idx]['detections']):
|
| 262 |
+
fullframe = Image.fromarray(frames[frame_idx]['frame'])
|
| 263 |
+
|
| 264 |
+
# Preserve the only found face even if not a good one, otherwise preserve only clusters > -1
|
| 265 |
+
subjects = np.unique(frames[frame_idx]['subjects'])
|
| 266 |
+
if len(subjects) > 1:
|
| 267 |
+
subjects = np.asarray([s for s in subjects if s > -1])
|
| 268 |
+
|
| 269 |
+
for face_idx, _ in enumerate(frame['faces']):
|
| 270 |
+
subj_id = frames[frame_idx]['subjects'][face_idx]
|
| 271 |
+
if subj_id in subjects: # Exclude outliers if other faces detected
|
| 272 |
+
face_path = facedestination_dir.joinpath(record['path'], 'fr{:03d}_subj{:1d}.jpg'.format(
|
| 273 |
+
frames[frame_idx]['frame_idx'], subj_id))
|
| 274 |
+
|
| 275 |
+
face_dict = {'facepath': str(face_path.relative_to(facedestination_dir)), 'video': idx,
|
| 276 |
+
'label': record['label'], 'videosubject': subj_id,
|
| 277 |
+
'original': record['original']}
|
| 278 |
+
# add attibutes for ff++
|
| 279 |
+
if 'class' in record.keys():
|
| 280 |
+
face_dict.update({'class': record['class']})
|
| 281 |
+
if 'source' in record.keys():
|
| 282 |
+
face_dict.update({'source': record['source']})
|
| 283 |
+
if 'quality' in record.keys():
|
| 284 |
+
face_dict.update({'quality': record['quality']})
|
| 285 |
+
|
| 286 |
+
for field_idx, key in enumerate(blazeface.BlazeFace.detection_keys):
|
| 287 |
+
face_dict[key] = frames[frame_idx]['detections'][face_idx][field_idx]
|
| 288 |
+
|
| 289 |
+
cropping_bb = adapt_bb(frame_height=fullframe.height,
|
| 290 |
+
frame_width=fullframe.width,
|
| 291 |
+
bb_height=face_size,
|
| 292 |
+
bb_width=face_size,
|
| 293 |
+
left=face_dict['xmin'],
|
| 294 |
+
top=face_dict['ymin'],
|
| 295 |
+
right=face_dict['xmax'],
|
| 296 |
+
bottom=face_dict['ymax'])
|
| 297 |
+
face = fullframe.crop(cropping_bb)
|
| 298 |
+
|
| 299 |
+
for key in blazeface.BlazeFace.detection_keys:
|
| 300 |
+
if (key[0] == 'k' and key[-1] == 'x') or (key[0] == 'x'):
|
| 301 |
+
face_dict[key] -= cropping_bb[0]
|
| 302 |
+
elif (key[0] == 'k' and key[-1] == 'y') or (key[0] == 'y'):
|
| 303 |
+
face_dict[key] -= cropping_bb[1]
|
| 304 |
+
|
| 305 |
+
face_dict['left'] = face_dict.pop('xmin')
|
| 306 |
+
face_dict['top'] = face_dict.pop('ymin')
|
| 307 |
+
face_dict['right'] = face_dict.pop('xmax')
|
| 308 |
+
face_dict['bottom'] = face_dict.pop('ymax')
|
| 309 |
+
|
| 310 |
+
face_path.parent.mkdir(parents=True, exist_ok=True)
|
| 311 |
+
images_to_save.append((face, face_path))
|
| 312 |
+
|
| 313 |
+
video_face_dict_list.append(face_dict)
|
| 314 |
+
|
| 315 |
+
if len(video_face_dict_list) > 0:
|
| 316 |
+
|
| 317 |
+
df_video_faces = pd.DataFrame(video_face_dict_list)
|
| 318 |
+
df_video_faces.index = df_video_faces['facepath']
|
| 319 |
+
del df_video_faces['facepath']
|
| 320 |
+
|
| 321 |
+
# type conversions
|
| 322 |
+
for key in ['kp1x', 'kp1y', 'kp2x', 'kp2y', 'kp3x', 'kp3y',
|
| 323 |
+
'kp4x', 'kp4y', 'kp5x', 'kp5y', 'kp6x', 'kp6y', 'left', 'top',
|
| 324 |
+
'right', 'bottom']:
|
| 325 |
+
df_video_faces[key] = df_video_faces[key].astype(np.int16)
|
| 326 |
+
df_video_faces['conf'] = df_video_faces['conf'].astype(np.float32)
|
| 327 |
+
df_video_faces['video'] = df_video_faces['video'].astype('category')
|
| 328 |
+
|
| 329 |
+
video_faces_checkpoint_path.parent.mkdir(parents=True, exist_ok=True)
|
| 330 |
+
|
| 331 |
+
else:
|
| 332 |
+
print('No faces extracted for video {}'.format(record['path']))
|
| 333 |
+
df_video_faces = pd.DataFrame()
|
| 334 |
+
|
| 335 |
+
return df_video_faces, video_faces_checkpoint_path, images_to_save
|
| 336 |
+
|
| 337 |
+
except Exception as e:
|
| 338 |
+
print('Error while processing: {}'.format(record['path']))
|
| 339 |
+
print("-" * 60)
|
| 340 |
+
traceback.print_exc(file=sys.stdout, limit=5)
|
| 341 |
+
print("-" * 60)
|
| 342 |
+
return
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
if __name__ == '__main__':
|
| 346 |
+
main(sys.argv[1:])
|
models/icpr2020dfdc/index_celebdf.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Index Celeb-DF v2
|
| 3 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 4 |
+
Nicolò Bonettini
|
| 5 |
+
Edoardo Daniele Cannas
|
| 6 |
+
Sara Mandelli
|
| 7 |
+
Luca Bondi
|
| 8 |
+
Paolo Bestagini
|
| 9 |
+
"""
|
| 10 |
+
import argparse
|
| 11 |
+
from multiprocessing import Pool
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
import pandas as pd
|
| 16 |
+
|
| 17 |
+
from isplutils.utils import extract_meta_av, extract_meta_cv
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def main():
|
| 21 |
+
parser = argparse.ArgumentParser()
|
| 22 |
+
parser.add_argument('--source', type=Path, help='Source dir',
|
| 23 |
+
required=True)
|
| 24 |
+
parser.add_argument('--videodataset', type=Path, default='data/celebdf_videos.pkl',
|
| 25 |
+
help='Path to save the videos DataFrame')
|
| 26 |
+
|
| 27 |
+
args = parser.parse_args()
|
| 28 |
+
|
| 29 |
+
## Parameters parsing
|
| 30 |
+
source_dir: Path = args.source
|
| 31 |
+
videodataset_path: Path = args.videodataset
|
| 32 |
+
|
| 33 |
+
# Create ouput folder (if doesn't exist)
|
| 34 |
+
videodataset_path.parent.mkdir(parents=True, exist_ok=True)
|
| 35 |
+
|
| 36 |
+
## DataFrame
|
| 37 |
+
if videodataset_path.exists():
|
| 38 |
+
print('Loading video DataFrame')
|
| 39 |
+
df_videos = pd.read_pickle(videodataset_path)
|
| 40 |
+
else:
|
| 41 |
+
print('Creating video DataFrame')
|
| 42 |
+
|
| 43 |
+
split_file = Path(source_dir).joinpath('List_of_testing_videos.txt')
|
| 44 |
+
if not split_file.exists():
|
| 45 |
+
raise FileNotFoundError('Unable to find "List_of_testing_videos.txt" in {}'.format(source_dir))
|
| 46 |
+
test_videos_df = pd.read_csv(split_file, delimiter=' ', header=0, index_col=1)
|
| 47 |
+
|
| 48 |
+
ff_videos = Path(source_dir).rglob('*.mp4')
|
| 49 |
+
df_videos = pd.DataFrame(
|
| 50 |
+
{'path': [f.relative_to(source_dir) for f in ff_videos]})
|
| 51 |
+
|
| 52 |
+
df_videos['height'] = df_videos['width'] = df_videos['frames'] = np.zeros(len(df_videos), dtype=np.uint16)
|
| 53 |
+
with Pool() as p:
|
| 54 |
+
meta = p.map(extract_meta_av, df_videos['path'].map(lambda x: str(source_dir.joinpath(x))))
|
| 55 |
+
meta = np.stack(meta)
|
| 56 |
+
df_videos.loc[:, ['height', 'width', 'frames']] = meta
|
| 57 |
+
|
| 58 |
+
# Fix for videos that av cannot decode properly
|
| 59 |
+
for idx, record in df_videos[df_videos['frames'] == 0].iterrows():
|
| 60 |
+
meta = extract_meta_cv(str(source_dir.joinpath(record['path'])))
|
| 61 |
+
df_videos.loc[idx, ['height', 'width', 'frames']] = meta
|
| 62 |
+
|
| 63 |
+
df_videos['class'] = df_videos['path'].map(lambda x: x.parts[0]).astype('category')
|
| 64 |
+
df_videos['label'] = df_videos['class'].map(
|
| 65 |
+
lambda x: True if x == 'Celeb-synthesis' else False) # True is FAKE, False is REAL
|
| 66 |
+
df_videos['name'] = df_videos['path'].map(lambda x: x.with_suffix('').name)
|
| 67 |
+
|
| 68 |
+
df_videos['original'] = -1 * np.ones(len(df_videos), dtype=np.int16)
|
| 69 |
+
df_videos.loc[(df_videos['label'] == True), 'original'] = \
|
| 70 |
+
df_videos[(df_videos['label'] == True)]['name'].map(
|
| 71 |
+
lambda x: df_videos.index[
|
| 72 |
+
np.flatnonzero(df_videos['name'] == '_'.join([x.split('_')[0], x.split('_')[2]]))[0]]
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
df_videos['test'] = df_videos['path'].map(str).isin(test_videos_df.index)
|
| 76 |
+
|
| 77 |
+
print('Saving video DataFrame to {}'.format(videodataset_path))
|
| 78 |
+
df_videos.to_pickle(str(videodataset_path))
|
| 79 |
+
|
| 80 |
+
print('Real videos: {:d}'.format(sum(df_videos['label'] == 0)))
|
| 81 |
+
print('Fake videos: {:d}'.format(sum(df_videos['label'] == 1)))
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
if __name__ == '__main__':
|
| 85 |
+
main()
|
models/icpr2020dfdc/index_dfdc.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Index the official Kaggle training dataset and prepares a train and validation set based on folders
|
| 3 |
+
|
| 4 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 5 |
+
|
| 6 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 7 |
+
|
| 8 |
+
Nicolò Bonettini
|
| 9 |
+
Edoardo Daniele Cannas
|
| 10 |
+
Sara Mandelli
|
| 11 |
+
Luca Bondi
|
| 12 |
+
Paolo Bestagini
|
| 13 |
+
"""
|
| 14 |
+
import sys
|
| 15 |
+
import argparse
|
| 16 |
+
from multiprocessing import Pool
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
import numpy as np
|
| 20 |
+
import pandas as pd
|
| 21 |
+
from tqdm import tqdm
|
| 22 |
+
|
| 23 |
+
from isplutils.utils import extract_meta_av
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_args(argv):
|
| 27 |
+
parser = argparse.ArgumentParser()
|
| 28 |
+
parser.add_argument('--source', type=Path, help='Source dir', required=True)
|
| 29 |
+
parser.add_argument('--videodataset', type=Path, default='data/dfdc_videos.pkl',
|
| 30 |
+
help='Path to save the videos DataFrame')
|
| 31 |
+
parser.add_argument('--batch', type=int, help='Batch size', default=64)
|
| 32 |
+
|
| 33 |
+
return parser.parse_args(argv)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def main(argv):
|
| 37 |
+
## Parameters parsing
|
| 38 |
+
args = parse_args(argv)
|
| 39 |
+
source_dir: Path = args.source
|
| 40 |
+
videodataset_path: Path = args.videodataset
|
| 41 |
+
batch_size: int = args.batch
|
| 42 |
+
|
| 43 |
+
## DataFrame
|
| 44 |
+
if videodataset_path.exists():
|
| 45 |
+
print('Loading video DataFrame')
|
| 46 |
+
df_videos = pd.read_pickle(videodataset_path)
|
| 47 |
+
else:
|
| 48 |
+
print('Creating video DataFrame')
|
| 49 |
+
|
| 50 |
+
# Create ouptut folder
|
| 51 |
+
videodataset_path.parent.mkdir(parents=True, exist_ok=True)
|
| 52 |
+
|
| 53 |
+
# Index
|
| 54 |
+
df_train_list = list()
|
| 55 |
+
for idx, json_path in enumerate(tqdm(sorted(source_dir.rglob('metadata.json')), desc='Indexing')):
|
| 56 |
+
df_tmp = pd.read_json(json_path, orient='index')
|
| 57 |
+
df_tmp['path'] = df_tmp.index.map(
|
| 58 |
+
lambda x: str(json_path.parent.relative_to(source_dir).joinpath(x)))
|
| 59 |
+
df_tmp['folder'] = int(str(json_path.parts[-2]).split('_')[-1])
|
| 60 |
+
df_train_list.append(df_tmp)
|
| 61 |
+
df_videos = pd.concat(df_train_list, axis=0, verify_integrity=True)
|
| 62 |
+
|
| 63 |
+
# Save space
|
| 64 |
+
del df_videos['split']
|
| 65 |
+
df_videos['label'] = df_videos['label'] == 'FAKE'
|
| 66 |
+
df_videos['original'] = df_videos['original'].astype('category')
|
| 67 |
+
df_videos['folder'] = df_videos['folder'].astype(np.uint8)
|
| 68 |
+
|
| 69 |
+
# Collect metadata
|
| 70 |
+
paths_arr = np.asarray(df_videos.path.map(lambda x: str(source_dir.joinpath(x))))
|
| 71 |
+
height_list = []
|
| 72 |
+
width_list = []
|
| 73 |
+
frames_list = []
|
| 74 |
+
with Pool() as pool:
|
| 75 |
+
for batch_idx0 in tqdm(np.arange(start=0, stop=len(df_videos), step=batch_size), desc='Metadata'):
|
| 76 |
+
batch_res = pool.map(extract_meta_av, paths_arr[batch_idx0:batch_idx0 + batch_size])
|
| 77 |
+
for res in batch_res:
|
| 78 |
+
height_list.append(res[0])
|
| 79 |
+
width_list.append(res[1])
|
| 80 |
+
frames_list.append(res[2])
|
| 81 |
+
|
| 82 |
+
df_videos['height'] = np.asarray(height_list, dtype=np.uint16)
|
| 83 |
+
df_videos['width'] = np.asarray(width_list, dtype=np.uint16)
|
| 84 |
+
df_videos['frames'] = np.asarray(frames_list, dtype=np.uint16)
|
| 85 |
+
|
| 86 |
+
print('Saving video DataFrame to {}'.format(videodataset_path))
|
| 87 |
+
df_videos.to_pickle(str(videodataset_path))
|
| 88 |
+
|
| 89 |
+
print('Real videos: {:d}'.format(sum(df_videos['label'] == 0)))
|
| 90 |
+
print('Fake videos: {:d}'.format(sum(df_videos['label'] == 1)))
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
if __name__ == '__main__':
|
| 94 |
+
main(sys.argv[1:])
|
models/icpr2020dfdc/index_ffpp.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Index FaceForensics++
|
| 3 |
+
|
| 4 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 5 |
+
|
| 6 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 7 |
+
|
| 8 |
+
Nicolò Bonettini
|
| 9 |
+
Edoardo Daniele Cannas
|
| 10 |
+
Sara Mandelli
|
| 11 |
+
Luca Bondi
|
| 12 |
+
Paolo Bestagini
|
| 13 |
+
"""
|
| 14 |
+
import argparse
|
| 15 |
+
import sys
|
| 16 |
+
from multiprocessing import Pool
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
import numpy as np
|
| 20 |
+
import pandas as pd
|
| 21 |
+
|
| 22 |
+
from isplutils.utils import extract_meta_av, extract_meta_cv
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def parse_args(argv):
|
| 26 |
+
parser = argparse.ArgumentParser()
|
| 27 |
+
parser.add_argument('--source', type=Path, help='Source dir',
|
| 28 |
+
default='dataset/ffpp/faceforensics')
|
| 29 |
+
parser.add_argument('--videodataset', type=Path, default='data/ffpp_videos.pkl',
|
| 30 |
+
help='Path to save the videos DataFrame')
|
| 31 |
+
|
| 32 |
+
return parser.parse_args(argv)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def main(argv):
|
| 36 |
+
## Parameters parsing
|
| 37 |
+
args = parse_args(argv)
|
| 38 |
+
source_dir: Path = args.source
|
| 39 |
+
videodataset_path: Path = args.videodataset
|
| 40 |
+
|
| 41 |
+
# Create ouput folder (if doesn't exist)
|
| 42 |
+
videodataset_path.parent.mkdir(parents=True, exist_ok=True)
|
| 43 |
+
|
| 44 |
+
## DataFrame
|
| 45 |
+
if videodataset_path.exists():
|
| 46 |
+
print('Loading video DataFrame')
|
| 47 |
+
df_videos = pd.read_pickle(videodataset_path)
|
| 48 |
+
else:
|
| 49 |
+
print('Creating video DataFrame')
|
| 50 |
+
|
| 51 |
+
ff_videos = Path(source_dir).rglob('*.mp4')
|
| 52 |
+
df_videos = pd.DataFrame(
|
| 53 |
+
{'path': [f.relative_to(source_dir) for f in ff_videos if 'mask' not in str(f) and 'raw' not in str(f)]})
|
| 54 |
+
|
| 55 |
+
df_videos['height'] = df_videos['width'] = df_videos['frames'] = np.zeros(len(df_videos), dtype=np.uint16)
|
| 56 |
+
with Pool() as p:
|
| 57 |
+
meta = p.map(extract_meta_av, df_videos['path'].map(lambda x: str(source_dir.joinpath(x))))
|
| 58 |
+
meta = np.stack(meta)
|
| 59 |
+
df_videos.loc[:, ['height', 'width', 'frames']] = meta
|
| 60 |
+
|
| 61 |
+
# Fix for videos that av cannot decode properly
|
| 62 |
+
for idx, record in df_videos[df_videos['frames'] == 0].iterrows():
|
| 63 |
+
meta = extract_meta_cv(str(source_dir.joinpath(record['path'])))
|
| 64 |
+
df_videos.loc[idx, ['height', 'width', 'frames']] = meta
|
| 65 |
+
|
| 66 |
+
df_videos['class'] = df_videos['path'].map(lambda x: x.parts[0]).astype('category')
|
| 67 |
+
df_videos['label'] = df_videos['class'].map(
|
| 68 |
+
lambda x: True if x == 'manipulated_sequences' else False) # True is FAKE, False is REAL
|
| 69 |
+
df_videos['source'] = df_videos['path'].map(lambda x: x.parts[1]).astype('category')
|
| 70 |
+
df_videos['quality'] = df_videos['path'].map(lambda x: x.parts[2]).astype('category')
|
| 71 |
+
df_videos['name'] = df_videos['path'].map(lambda x: x.with_suffix('').parts[-1])
|
| 72 |
+
|
| 73 |
+
df_videos['original'] = -1 * np.ones(len(df_videos), dtype=np.int16)
|
| 74 |
+
df_videos.loc[(df_videos['label'] == True) & (df_videos['source'] != 'DeepFakeDetection'), 'original'] = \
|
| 75 |
+
df_videos[(df_videos['label'] == True) & (df_videos['source'] != 'DeepFakeDetection')]['name'].map(
|
| 76 |
+
lambda x: df_videos.index[np.flatnonzero(df_videos['name'] == x.split('_')[0])[0]]
|
| 77 |
+
)
|
| 78 |
+
df_videos.loc[(df_videos['label'] == True) & (df_videos['source'] == 'DeepFakeDetection'), 'original'] = \
|
| 79 |
+
df_videos[(df_videos['label'] == True) & (df_videos['source'] == 'DeepFakeDetection')]['name'].map(
|
| 80 |
+
lambda x: df_videos.index[
|
| 81 |
+
np.flatnonzero(df_videos['name'] == x.split('_')[0] + '__' + x.split('__')[1])[0]]
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
print('Saving video DataFrame to {}'.format(videodataset_path))
|
| 85 |
+
df_videos.to_pickle(str(videodataset_path))
|
| 86 |
+
|
| 87 |
+
print('Real videos: {:d}'.format(sum(df_videos['label'] == 0)))
|
| 88 |
+
print('Fake videos: {:d}'.format(sum(df_videos['label'] == 1)))
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
if __name__ == '__main__':
|
| 92 |
+
main(sys.argv[1:])
|
models/icpr2020dfdc/isplutils/__init__.py
ADDED
|
File without changes
|
models/icpr2020dfdc/isplutils/data.py
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
import os
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import List
|
| 15 |
+
|
| 16 |
+
import albumentations as A
|
| 17 |
+
import numpy as np
|
| 18 |
+
import pandas as pd
|
| 19 |
+
import torch
|
| 20 |
+
from PIL import Image
|
| 21 |
+
from albumentations.pytorch import ToTensorV2
|
| 22 |
+
from torch.utils.data import Dataset, IterableDataset
|
| 23 |
+
|
| 24 |
+
from .utils import extract_bb
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def load_face(record: pd.Series, root: str, size: int, scale: str, transformer: A.BasicTransform) -> torch.Tensor:
|
| 28 |
+
path = os.path.join(str(root), str(record.name))
|
| 29 |
+
autocache = size < 256 or scale == 'tight'
|
| 30 |
+
if scale in ['crop', 'scale', ]:
|
| 31 |
+
cached_path = str(Path(root).joinpath('autocache', scale, str(size), str(record.name)).with_suffix('.jpg'))
|
| 32 |
+
else:
|
| 33 |
+
# when self.scale == 'tight' the extracted face is not dependent on size
|
| 34 |
+
cached_path = str(Path(root).joinpath('autocache', scale, str(record.name)).with_suffix('.jpg'))
|
| 35 |
+
|
| 36 |
+
face = np.zeros((size, size, 3), dtype=np.uint8)
|
| 37 |
+
if os.path.exists(cached_path):
|
| 38 |
+
try:
|
| 39 |
+
face = Image.open(cached_path)
|
| 40 |
+
face = np.array(face)
|
| 41 |
+
if len(face.shape) != 3:
|
| 42 |
+
raise RuntimeError('Incorrect format: {}'.format(path))
|
| 43 |
+
except KeyboardInterrupt as e:
|
| 44 |
+
# We want keybord interrupts to be propagated
|
| 45 |
+
raise e
|
| 46 |
+
except (OSError, IOError) as e:
|
| 47 |
+
print('Deleting corrupted cache file: {}'.format(cached_path))
|
| 48 |
+
print(e)
|
| 49 |
+
os.unlink(cached_path)
|
| 50 |
+
face = np.zeros((size, size, 3), dtype=np.uint8)
|
| 51 |
+
|
| 52 |
+
if not os.path.exists(cached_path):
|
| 53 |
+
try:
|
| 54 |
+
frame = Image.open(path)
|
| 55 |
+
bb = record['left'], record['top'], record['right'], record['bottom']
|
| 56 |
+
face = extract_bb(frame, bb=bb, size=size, scale=scale)
|
| 57 |
+
|
| 58 |
+
if autocache:
|
| 59 |
+
os.makedirs(os.path.dirname(cached_path), exist_ok=True)
|
| 60 |
+
face.save(cached_path, quality=95, subsampling='4:4:4')
|
| 61 |
+
|
| 62 |
+
face = np.array(face)
|
| 63 |
+
if len(face.shape) != 3:
|
| 64 |
+
raise RuntimeError('Incorrect format: {}'.format(path))
|
| 65 |
+
except KeyboardInterrupt as e:
|
| 66 |
+
# We want keybord interrupts to be propagated
|
| 67 |
+
raise e
|
| 68 |
+
except (OSError, IOError) as e:
|
| 69 |
+
print('Error while reading: {}'.format(path))
|
| 70 |
+
print(e)
|
| 71 |
+
face = np.zeros((size, size, 3), dtype=np.uint8)
|
| 72 |
+
|
| 73 |
+
face = transformer(image=face)['image']
|
| 74 |
+
|
| 75 |
+
return face
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class FrameFaceIterableDataset(IterableDataset):
|
| 79 |
+
|
| 80 |
+
def __init__(self,
|
| 81 |
+
roots: List[str],
|
| 82 |
+
dfs: List[pd.DataFrame],
|
| 83 |
+
size: int, scale: str,
|
| 84 |
+
num_samples: int = -1,
|
| 85 |
+
transformer: A.BasicTransform = ToTensorV2(),
|
| 86 |
+
output_index: bool = False,
|
| 87 |
+
labels_map: dict = None,
|
| 88 |
+
seed: int = None):
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
:param roots: List of root folders for frames cache
|
| 92 |
+
:param dfs: List of DataFrames of cached frames with 'bb' column as array of 4 elements (left,top,right,bottom)
|
| 93 |
+
and 'label' column
|
| 94 |
+
:param size: face size
|
| 95 |
+
:param num_samples:
|
| 96 |
+
:param scale: Rescale the face to the given size, preserving the aspect ratio.
|
| 97 |
+
If false crop around center to the given size
|
| 98 |
+
:param transformer:
|
| 99 |
+
:param output_index: enable output of df_frames index
|
| 100 |
+
:param labels_map: map from 'REAL' and 'FAKE' to actual labels
|
| 101 |
+
"""
|
| 102 |
+
|
| 103 |
+
self.dfs = dfs
|
| 104 |
+
self.size = int(size)
|
| 105 |
+
|
| 106 |
+
self.seed0 = int(seed) if seed is not None else np.random.choice(2 ** 32)
|
| 107 |
+
|
| 108 |
+
# adapt indices
|
| 109 |
+
dfs_adapted = [df.copy() for df in self.dfs]
|
| 110 |
+
for df_idx, df in enumerate(dfs_adapted):
|
| 111 |
+
mi = pd.MultiIndex.from_tuples([(df_idx, key) for key in df.index], names=['df_idx', 'df_key'])
|
| 112 |
+
df.index = mi
|
| 113 |
+
# Concat
|
| 114 |
+
self.df = pd.concat(dfs_adapted, axis=0, join='inner')
|
| 115 |
+
|
| 116 |
+
self.df_real = self.df[self.df['label'] == 0]
|
| 117 |
+
self.df_fake = self.df[self.df['label'] == 1]
|
| 118 |
+
|
| 119 |
+
self.longer_set = 'real' if len(self.df_real) > len(self.df_fake) else 'fake'
|
| 120 |
+
self.num_samples = max(len(self.df_real), len(self.df_fake)) * 2
|
| 121 |
+
self.num_samples = min(self.num_samples, num_samples) if num_samples > 0 else self.num_samples
|
| 122 |
+
|
| 123 |
+
self.output_idx = bool(output_index)
|
| 124 |
+
|
| 125 |
+
self.scale = str(scale)
|
| 126 |
+
self.roots = [str(r) for r in roots]
|
| 127 |
+
self.transformer = transformer
|
| 128 |
+
|
| 129 |
+
self.labels_map = labels_map
|
| 130 |
+
if self.labels_map is None:
|
| 131 |
+
self.labels_map = {False: np.array([0., ]), True: np.array([1., ])}
|
| 132 |
+
else:
|
| 133 |
+
self.labels_map = dict(self.labels_map)
|
| 134 |
+
|
| 135 |
+
def _get_face(self, item: pd.Index) -> (torch.Tensor, torch.Tensor) or (torch.Tensor, torch.Tensor, str):
|
| 136 |
+
|
| 137 |
+
record = self.dfs[item[0]].loc[item[1]]
|
| 138 |
+
face = load_face(record=record,
|
| 139 |
+
root=self.roots[item[0]],
|
| 140 |
+
size=self.size,
|
| 141 |
+
scale=self.scale,
|
| 142 |
+
transformer=self.transformer)
|
| 143 |
+
|
| 144 |
+
label = self.labels_map[record.label]
|
| 145 |
+
if self.output_idx:
|
| 146 |
+
return face, label, record.name
|
| 147 |
+
else:
|
| 148 |
+
return face, label
|
| 149 |
+
|
| 150 |
+
def __len__(self):
|
| 151 |
+
return self.num_samples
|
| 152 |
+
|
| 153 |
+
def __iter__(self):
|
| 154 |
+
|
| 155 |
+
random_fake_idxs, random_real_idxs = get_iterative_real_fake_idxs(
|
| 156 |
+
df_real=self.df_real,
|
| 157 |
+
df_fake=self.df_fake,
|
| 158 |
+
num_samples=self.num_samples,
|
| 159 |
+
seed0=self.seed0
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
while len(random_fake_idxs) >= 1 and len(random_real_idxs) >= 1:
|
| 163 |
+
yield self._get_face(random_fake_idxs.pop())
|
| 164 |
+
yield self._get_face(random_real_idxs.pop())
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def get_iterative_real_fake_idxs(df_real: pd.DataFrame, df_fake: pd.DataFrame,
|
| 168 |
+
num_samples: int, seed0: int):
|
| 169 |
+
longer_set = 'real' if len(df_real) > len(df_fake) else 'fake'
|
| 170 |
+
worker_info = torch.utils.data.get_worker_info()
|
| 171 |
+
if worker_info is None:
|
| 172 |
+
seed = seed0
|
| 173 |
+
np.random.seed(seed)
|
| 174 |
+
worker_num_couple_samples = num_samples // 2
|
| 175 |
+
fake_idxs_portion = np.random.choice(df_fake.index, worker_num_couple_samples,
|
| 176 |
+
replace=longer_set == 'real')
|
| 177 |
+
real_idxs_portion = np.random.choice(df_real.index, worker_num_couple_samples,
|
| 178 |
+
replace=longer_set == 'fake')
|
| 179 |
+
else:
|
| 180 |
+
worker_id = worker_info.id
|
| 181 |
+
seed = seed0 + worker_id
|
| 182 |
+
np.random.seed(seed)
|
| 183 |
+
worker_num_couple_samples = (num_samples // 2) // worker_info.num_workers
|
| 184 |
+
if longer_set == 'fake':
|
| 185 |
+
fake_idxs_portion = df_fake.index[
|
| 186 |
+
worker_id * worker_num_couple_samples:(worker_id + 1) * worker_num_couple_samples]
|
| 187 |
+
real_idxs_portion = np.random.choice(df_real.index, worker_num_couple_samples, replace=True)
|
| 188 |
+
else:
|
| 189 |
+
real_idxs_portion = df_real.index[
|
| 190 |
+
worker_id * worker_num_couple_samples:(worker_id + 1) * worker_num_couple_samples]
|
| 191 |
+
fake_idxs_portion = np.random.choice(df_fake.index, worker_num_couple_samples,
|
| 192 |
+
replace=True)
|
| 193 |
+
random_fake_idxs = list(np.random.permutation(fake_idxs_portion))
|
| 194 |
+
random_real_idxs = list(np.random.permutation(real_idxs_portion))
|
| 195 |
+
|
| 196 |
+
assert (len(random_fake_idxs) == len(random_real_idxs))
|
| 197 |
+
|
| 198 |
+
return random_fake_idxs, random_real_idxs
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class FrameFaceDatasetTest(Dataset):
|
| 202 |
+
|
| 203 |
+
def __init__(self, root: str, df: pd.DataFrame,
|
| 204 |
+
size: int, scale: str,
|
| 205 |
+
transformer: A.BasicTransform = ToTensorV2(),
|
| 206 |
+
labels_map: dict = None,
|
| 207 |
+
aug_transformers: List[A.BasicTransform] = None):
|
| 208 |
+
"""
|
| 209 |
+
|
| 210 |
+
:param root: root folder for frames cache
|
| 211 |
+
:param df: DataFrame of cached frames with 'bb' column as array of 4 elements (left,top,right,bottom)
|
| 212 |
+
and 'label' column
|
| 213 |
+
:param size: face size
|
| 214 |
+
:param num_samples:
|
| 215 |
+
:param scale: Rescale the face to the given size, preserving the aspect ratio.
|
| 216 |
+
If false crop around center to the given size
|
| 217 |
+
:param transformer:
|
| 218 |
+
:param labels_map: dcit to map df labels
|
| 219 |
+
:param aug_transformers: if not None, creates multiple copies of the same sample according to the provided augmentations
|
| 220 |
+
"""
|
| 221 |
+
|
| 222 |
+
self.df = df
|
| 223 |
+
self.size = int(size)
|
| 224 |
+
|
| 225 |
+
self.scale = str(scale)
|
| 226 |
+
self.root = str(root)
|
| 227 |
+
self.transformer = transformer
|
| 228 |
+
self.aug_transformers = aug_transformers
|
| 229 |
+
|
| 230 |
+
self.labels_map = labels_map
|
| 231 |
+
if self.labels_map is None:
|
| 232 |
+
self.labels_map = {False: np.array([0., ]), True: np.array([1., ])}
|
| 233 |
+
else:
|
| 234 |
+
self.labels_map = dict(self.labels_map)
|
| 235 |
+
|
| 236 |
+
def _get_face(self, item: pd.Index) -> (torch.Tensor, torch.Tensor) or (torch.Tensor, torch.Tensor, str):
|
| 237 |
+
record = self.df.loc[item]
|
| 238 |
+
label = self.labels_map[record.label]
|
| 239 |
+
if self.aug_transformers is None:
|
| 240 |
+
face = load_face(record=record,
|
| 241 |
+
root=self.root,
|
| 242 |
+
size=self.size,
|
| 243 |
+
scale=self.scale,
|
| 244 |
+
transformer=self.transformer)
|
| 245 |
+
return face, label
|
| 246 |
+
else:
|
| 247 |
+
faces = []
|
| 248 |
+
for aug_transf in self.aug_transformers:
|
| 249 |
+
faces.append(
|
| 250 |
+
load_face(record=record,
|
| 251 |
+
root=self.root,
|
| 252 |
+
size=self.size,
|
| 253 |
+
scale=self.scale,
|
| 254 |
+
transformer=A.Compose([aug_transf, self.transformer])
|
| 255 |
+
))
|
| 256 |
+
faces = torch.stack(faces)
|
| 257 |
+
return faces, label
|
| 258 |
+
|
| 259 |
+
def __len__(self):
|
| 260 |
+
return len(self.df)
|
| 261 |
+
|
| 262 |
+
def __getitem__(self, item):
|
| 263 |
+
return self._get_face(self.df.index[item])
|
models/icpr2020dfdc/isplutils/data_siamese.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
from typing import List
|
| 13 |
+
|
| 14 |
+
import albumentations as A
|
| 15 |
+
import pandas as pd
|
| 16 |
+
from albumentations.pytorch import ToTensorV2
|
| 17 |
+
|
| 18 |
+
from .data import FrameFaceIterableDataset, get_iterative_real_fake_idxs
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class FrameFaceTripletIterableDataset(FrameFaceIterableDataset):
|
| 22 |
+
|
| 23 |
+
def __init__(self,
|
| 24 |
+
roots: List[str],
|
| 25 |
+
dfs: List[pd.DataFrame],
|
| 26 |
+
size: int,
|
| 27 |
+
scale: str,
|
| 28 |
+
num_triplets: int = -1,
|
| 29 |
+
transformer: A.BasicTransform = ToTensorV2(),
|
| 30 |
+
seed: int = None):
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
:param roots: List of root folders for frames cache
|
| 34 |
+
:param dfs: List of DataFrames of cached frames with 'bb' column as array of 4 elements (left,top,right,bottom)
|
| 35 |
+
and 'label' column
|
| 36 |
+
:param size: face size
|
| 37 |
+
:param num_triplets: number of samples for the dataset
|
| 38 |
+
:param idxs: sampling indexes triplets (each element is a key for anchor, positive, negative)
|
| 39 |
+
:param scale: Rescale the face to the given size, preserving the aspect ratio.
|
| 40 |
+
If false crop around center to the given size
|
| 41 |
+
:param transformer:
|
| 42 |
+
:param seed:
|
| 43 |
+
"""
|
| 44 |
+
super(FrameFaceTripletIterableDataset, self).__init__(
|
| 45 |
+
roots=roots,
|
| 46 |
+
dfs=dfs,
|
| 47 |
+
size=size,
|
| 48 |
+
scale=scale,
|
| 49 |
+
num_samples=num_triplets * 3,
|
| 50 |
+
transformer=transformer,
|
| 51 |
+
seed=seed
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
self.num_triplet_couples = self.num_samples // 6
|
| 55 |
+
self.num_triplets = self.num_triplet_couples * 2
|
| 56 |
+
self.num_samples = self.num_triplets * 3
|
| 57 |
+
|
| 58 |
+
def __len__(self):
|
| 59 |
+
return self.num_triplets
|
| 60 |
+
|
| 61 |
+
def __iter__(self):
|
| 62 |
+
random_fake_idxs, random_real_idxs = get_iterative_real_fake_idxs(
|
| 63 |
+
df_real=self.df_real,
|
| 64 |
+
df_fake=self.df_fake,
|
| 65 |
+
num_samples=self.num_samples,
|
| 66 |
+
seed0=self.seed0
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
while len(random_fake_idxs) >= 3 and len(random_real_idxs) >= 3:
|
| 70 |
+
a = self._get_face(random_fake_idxs.pop())[0]
|
| 71 |
+
p = self._get_face(random_fake_idxs.pop())[0]
|
| 72 |
+
n = self._get_face(random_real_idxs.pop())[0]
|
| 73 |
+
yield a, p, n
|
| 74 |
+
|
| 75 |
+
a = self._get_face(random_real_idxs.pop())[0]
|
| 76 |
+
p = self._get_face(random_real_idxs.pop())[0]
|
| 77 |
+
n = self._get_face(random_fake_idxs.pop())[0]
|
| 78 |
+
yield a, p, n
|
models/icpr2020dfdc/isplutils/split.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List, Dict, Tuple
|
| 2 |
+
"""
|
| 3 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 4 |
+
|
| 5 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 6 |
+
|
| 7 |
+
Nicolò Bonettini
|
| 8 |
+
Edoardo Daniele Cannas
|
| 9 |
+
Sara Mandelli
|
| 10 |
+
Luca Bondi
|
| 11 |
+
Paolo Bestagini
|
| 12 |
+
"""
|
| 13 |
+
import numpy as np
|
| 14 |
+
import pandas as pd
|
| 15 |
+
|
| 16 |
+
available_datasets = [
|
| 17 |
+
'dfdc-35-5-10',
|
| 18 |
+
'ff-c23-720-140-140',
|
| 19 |
+
'ff-c23-720-140-140-5fpv',
|
| 20 |
+
'ff-c23-720-140-140-10fpv',
|
| 21 |
+
'ff-c23-720-140-140-15fpv',
|
| 22 |
+
'ff-c23-720-140-140-20fpv',
|
| 23 |
+
'ff-c23-720-140-140-25fpv',
|
| 24 |
+
'celebdf', # just for convenience, not used in the original paper
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def load_df(dfdc_df_path: str, ffpp_df_path: str, dfdc_faces_dir: str, ffpp_faces_dir: str, dataset: str) -> (pd.DataFrame, str):
|
| 29 |
+
if dataset.startswith('dfdc'):
|
| 30 |
+
df = pd.read_pickle(dfdc_df_path)
|
| 31 |
+
root = dfdc_faces_dir
|
| 32 |
+
elif dataset.startswith('ff-'):
|
| 33 |
+
df = pd.read_pickle(ffpp_df_path)
|
| 34 |
+
root = ffpp_faces_dir
|
| 35 |
+
else:
|
| 36 |
+
raise NotImplementedError('Unknown dataset: {}'.format(dataset))
|
| 37 |
+
return df, root
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def get_split_df(df: pd.DataFrame, dataset: str, split: str) -> pd.DataFrame:
|
| 41 |
+
if dataset == 'dfdc-35-5-10':
|
| 42 |
+
if split == 'train':
|
| 43 |
+
split_df = df[df['folder'].isin(range(35))]
|
| 44 |
+
elif split == 'val':
|
| 45 |
+
split_df = df[df['folder'].isin(range(35, 40))]
|
| 46 |
+
elif split == 'test':
|
| 47 |
+
split_df = df[df['folder'].isin(range(40, 50))]
|
| 48 |
+
else:
|
| 49 |
+
raise NotImplementedError('Unknown split: {}'.format(split))
|
| 50 |
+
elif dataset.startswith('ff-c23-720-140-140'):
|
| 51 |
+
# Save random state
|
| 52 |
+
st0 = np.random.get_state()
|
| 53 |
+
# Set seed for this selection only
|
| 54 |
+
np.random.seed(41)
|
| 55 |
+
# Split on original videos
|
| 56 |
+
crf = dataset.split('-')[1]
|
| 57 |
+
random_youtube_videos = np.random.permutation(
|
| 58 |
+
df[(df['source'] == 'youtube') & (df['quality'] == crf)]['video'].unique())
|
| 59 |
+
train_orig = random_youtube_videos[:720]
|
| 60 |
+
val_orig = random_youtube_videos[720:720 + 140]
|
| 61 |
+
test_orig = random_youtube_videos[720 + 140:]
|
| 62 |
+
if split == 'train':
|
| 63 |
+
split_df = pd.concat((df[df['original'].isin(train_orig)], df[df['video'].isin(train_orig)]), axis=0)
|
| 64 |
+
elif split == 'val':
|
| 65 |
+
split_df = pd.concat((df[df['original'].isin(val_orig)], df[df['video'].isin(val_orig)]), axis=0)
|
| 66 |
+
elif split == 'test':
|
| 67 |
+
split_df = pd.concat((df[df['original'].isin(test_orig)], df[df['video'].isin(test_orig)]), axis=0)
|
| 68 |
+
else:
|
| 69 |
+
raise NotImplementedError('Unknown split: {}'.format(split))
|
| 70 |
+
|
| 71 |
+
if dataset.endswith('fpv'):
|
| 72 |
+
fpv = int(dataset.rsplit('-', 1)[1][:-3])
|
| 73 |
+
idxs = []
|
| 74 |
+
for video in split_df['video'].unique():
|
| 75 |
+
idxs.append(np.random.choice(split_df[split_df['video'] == video].index, fpv, replace=False))
|
| 76 |
+
idxs = np.concatenate(idxs)
|
| 77 |
+
split_df = split_df.loc[idxs]
|
| 78 |
+
# Restore random state
|
| 79 |
+
np.random.set_state(st0)
|
| 80 |
+
elif dataset == 'celebdf':
|
| 81 |
+
|
| 82 |
+
seed = 41
|
| 83 |
+
num_real_train = 600
|
| 84 |
+
|
| 85 |
+
# Save random state
|
| 86 |
+
st0 = np.random.get_state()
|
| 87 |
+
# Set seed for this selection only
|
| 88 |
+
np.random.seed(seed)
|
| 89 |
+
# Split on original videos
|
| 90 |
+
random_train_val_real_videos = np.random.permutation(
|
| 91 |
+
df[(df['label'] == False) & (df['test'] == False)]['video'].unique())
|
| 92 |
+
train_orig = random_train_val_real_videos[:num_real_train]
|
| 93 |
+
val_orig = random_train_val_real_videos[num_real_train:]
|
| 94 |
+
if split == 'train':
|
| 95 |
+
split_df = pd.concat((df[df['original'].isin(train_orig)], df[df['video'].isin(train_orig)]), axis=0)
|
| 96 |
+
elif split == 'val':
|
| 97 |
+
split_df = pd.concat((df[df['original'].isin(val_orig)], df[df['video'].isin(val_orig)]), axis=0)
|
| 98 |
+
elif split == 'test':
|
| 99 |
+
split_df = df[df['test'] == True]
|
| 100 |
+
else:
|
| 101 |
+
raise NotImplementedError('Unknown split: {}'.format(split))
|
| 102 |
+
# Restore random state
|
| 103 |
+
np.random.set_state(st0)
|
| 104 |
+
else:
|
| 105 |
+
raise NotImplementedError('Unknown dataset: {}'.format(dataset))
|
| 106 |
+
return split_df
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def make_splits(dfdc_df: str, ffpp_df: str, dfdc_dir: str, ffpp_dir: str, dbs: Dict[str, List[str]]) -> Dict[str, Dict[str, Tuple[pd.DataFrame, str]]]:
|
| 110 |
+
"""
|
| 111 |
+
Make split and return Dataframe and root
|
| 112 |
+
:param
|
| 113 |
+
dfdc_df: str, path to the DataFrame containing info on the faces extracted from the DFDC dataset with extract_faces.py
|
| 114 |
+
ffpp_df: str, path to the DataFrame containing info on the faces extracted from the FF++ dataset with extract_faces.py
|
| 115 |
+
dfdc_dir: str, path to the directory containing the faces extracted from the DFDC dataset with extract_faces.py
|
| 116 |
+
ffpp_dir: str, path to the directory containing the faces extracted from the FF++ dataset with extract_faces.py
|
| 117 |
+
dbs: {split_name:[split_dataset1,split_dataset2,...]}
|
| 118 |
+
Example:
|
| 119 |
+
{'train':['dfdc-35-5-15',],'val':['dfdc-35-5-15',]}
|
| 120 |
+
:return: split_dict: dictonary containing {split_name: ['train', 'val'], splitdb: List(pandas.DataFrame, str)}
|
| 121 |
+
Example:
|
| 122 |
+
{'train, 'dfdc-35-5-15': (dfdc_train_df, 'path/to/dir/of/DFDC/faces')}
|
| 123 |
+
"""
|
| 124 |
+
split_dict = {}
|
| 125 |
+
full_dfs = {}
|
| 126 |
+
for split_name, split_dbs in dbs.items():
|
| 127 |
+
split_dict[split_name] = dict()
|
| 128 |
+
for split_db in split_dbs:
|
| 129 |
+
if split_db not in full_dfs:
|
| 130 |
+
full_dfs[split_db] = load_df(dfdc_df, ffpp_df, dfdc_dir, ffpp_dir, split_db)
|
| 131 |
+
full_df, root = full_dfs[split_db]
|
| 132 |
+
split_df = get_split_df(df=full_df, dataset=split_db, split=split_name)
|
| 133 |
+
split_dict[split_name][split_db] = (split_df, root)
|
| 134 |
+
|
| 135 |
+
return split_dict
|
models/icpr2020dfdc/isplutils/utils.py
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Video Face Manipulation Detection Through Ensemble of CNNs
|
| 3 |
+
|
| 4 |
+
Image and Sound Processing Lab - Politecnico di Milano
|
| 5 |
+
|
| 6 |
+
Nicolò Bonettini
|
| 7 |
+
Edoardo Daniele Cannas
|
| 8 |
+
Sara Mandelli
|
| 9 |
+
Luca Bondi
|
| 10 |
+
Paolo Bestagini
|
| 11 |
+
"""
|
| 12 |
+
from pprint import pprint
|
| 13 |
+
from typing import Iterable, List
|
| 14 |
+
|
| 15 |
+
import albumentations as A
|
| 16 |
+
import cv2
|
| 17 |
+
import numpy as np
|
| 18 |
+
import scipy
|
| 19 |
+
import torch
|
| 20 |
+
from PIL import Image
|
| 21 |
+
from albumentations.pytorch import ToTensorV2
|
| 22 |
+
from matplotlib import pyplot as plt
|
| 23 |
+
from torch import nn as nn
|
| 24 |
+
from torchvision import transforms
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def extract_meta_av(path: str) -> (int, int, int):
|
| 28 |
+
"""
|
| 29 |
+
Extract video height, width and number of frames to index the files
|
| 30 |
+
:param path:
|
| 31 |
+
:return:
|
| 32 |
+
"""
|
| 33 |
+
import av
|
| 34 |
+
try:
|
| 35 |
+
video = av.open(path)
|
| 36 |
+
video_stream = video.streams.video[0]
|
| 37 |
+
return video_stream.height, video_stream.width, video_stream.frames
|
| 38 |
+
except av.AVError as e:
|
| 39 |
+
print('Error while reading file: {}'.format(path))
|
| 40 |
+
print(e)
|
| 41 |
+
return 0, 0, 0
|
| 42 |
+
except IndexError as e:
|
| 43 |
+
print('Error while processing file: {}'.format(path))
|
| 44 |
+
print(e)
|
| 45 |
+
return 0, 0, 0
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def extract_meta_cv(path: str) -> (int, int, int):
|
| 49 |
+
"""
|
| 50 |
+
Extract video height, width and number of frames to index the files
|
| 51 |
+
:param path:
|
| 52 |
+
:return:
|
| 53 |
+
"""
|
| 54 |
+
try:
|
| 55 |
+
vid = cv2.VideoCapture(path)
|
| 56 |
+
num_frames = int(vid.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 57 |
+
height = int(vid.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 58 |
+
width = int(vid.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 59 |
+
return height, width, num_frames
|
| 60 |
+
except Exception as e:
|
| 61 |
+
print('Error while reading file: {}'.format(path))
|
| 62 |
+
print(e)
|
| 63 |
+
return 0, 0, 0
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def adapt_bb(frame_height: int, frame_width: int, bb_height: int, bb_width: int, left: int, top: int, right: int,
|
| 67 |
+
bottom: int) -> (
|
| 68 |
+
int, int, int, int):
|
| 69 |
+
x_ctr = (left + right) // 2
|
| 70 |
+
y_ctr = (bottom + top) // 2
|
| 71 |
+
new_top = max(y_ctr - bb_height // 2, 0)
|
| 72 |
+
new_bottom = min(new_top + bb_height, frame_height)
|
| 73 |
+
new_left = max(x_ctr - bb_width // 2, 0)
|
| 74 |
+
new_right = min(new_left + bb_width, frame_width)
|
| 75 |
+
return new_left, new_top, new_right, new_bottom
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def extract_bb(frame: Image.Image, bb: Iterable, scale: str, size: int) -> Image.Image:
|
| 79 |
+
"""
|
| 80 |
+
Extract a face from a frame according to the given bounding box and scale policy
|
| 81 |
+
:param frame: Entire frame
|
| 82 |
+
:param bb: Bounding box (left,top,right,bottom) in the reference system of the frame
|
| 83 |
+
:param scale: "scale" to crop a square with size equal to the maximum between height and width of the face, then scale to size
|
| 84 |
+
"crop" to crop a fixed square around face center,
|
| 85 |
+
"tight" to crop face exactly at the bounding box with no scaling
|
| 86 |
+
:param size: size of the face
|
| 87 |
+
:return:
|
| 88 |
+
"""
|
| 89 |
+
left, top, right, bottom = bb
|
| 90 |
+
if scale == "scale":
|
| 91 |
+
bb_width = int(right) - int(left)
|
| 92 |
+
bb_height = int(bottom) - int(top)
|
| 93 |
+
bb_to_desired_ratio = min(size / bb_height, size / bb_width) if (bb_width > 0 and bb_height > 0) else 1.
|
| 94 |
+
bb_width = int(size / bb_to_desired_ratio)
|
| 95 |
+
bb_height = int(size / bb_to_desired_ratio)
|
| 96 |
+
left, top, right, bottom = adapt_bb(frame.height, frame.width, bb_height, bb_width, left, top, right,
|
| 97 |
+
bottom)
|
| 98 |
+
face = frame.crop((left, top, right, bottom)).resize((size, size), Image.BILINEAR)
|
| 99 |
+
elif scale == "crop":
|
| 100 |
+
# Find the center of the bounding box and cut an area around it of height x width
|
| 101 |
+
left, top, right, bottom = adapt_bb(frame.height, frame.width, size, size, left, top, right,
|
| 102 |
+
bottom)
|
| 103 |
+
face = frame.crop((left, top, right, bottom))
|
| 104 |
+
elif scale == "tight":
|
| 105 |
+
left, top, right, bottom = adapt_bb(frame.height, frame.width, bottom - top, right - left, left, top, right,
|
| 106 |
+
bottom)
|
| 107 |
+
face = frame.crop((left, top, right, bottom))
|
| 108 |
+
else:
|
| 109 |
+
raise ValueError('Unknown scale value: {}'.format(scale))
|
| 110 |
+
|
| 111 |
+
return face
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def showimage(img_tensor: torch.Tensor):
|
| 115 |
+
topil = transforms.Compose([
|
| 116 |
+
transforms.Normalize(mean=[0, 0, 0, ], std=[1 / 0.229, 1 / 0.224, 1 / 0.225]),
|
| 117 |
+
transforms.Normalize(mean=[-0.485, -0.456, -0.406], std=[1, 1, 1]),
|
| 118 |
+
transforms.ToPILImage()
|
| 119 |
+
])
|
| 120 |
+
plt.figure()
|
| 121 |
+
plt.imshow(topil(img_tensor))
|
| 122 |
+
plt.show()
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def make_train_tag(net_class: nn.Module,
|
| 126 |
+
face_policy: str,
|
| 127 |
+
patch_size: int,
|
| 128 |
+
traindb: List[str],
|
| 129 |
+
seed: int,
|
| 130 |
+
suffix: str,
|
| 131 |
+
debug: bool,
|
| 132 |
+
):
|
| 133 |
+
# Training parameters and tag
|
| 134 |
+
tag_params = dict(net=net_class.__name__,
|
| 135 |
+
traindb='-'.join(traindb),
|
| 136 |
+
face=face_policy,
|
| 137 |
+
size=patch_size,
|
| 138 |
+
seed=seed
|
| 139 |
+
)
|
| 140 |
+
print('Parameters')
|
| 141 |
+
pprint(tag_params)
|
| 142 |
+
tag = 'debug_' if debug else ''
|
| 143 |
+
tag += '_'.join(['-'.join([key, str(tag_params[key])]) for key in tag_params])
|
| 144 |
+
if suffix is not None:
|
| 145 |
+
tag += '_' + suffix
|
| 146 |
+
print('Tag: {:s}'.format(tag))
|
| 147 |
+
return tag
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def get_transformer(face_policy: str, patch_size: int, net_normalizer: transforms.Normalize, train: bool):
|
| 151 |
+
# Transformers and traindb
|
| 152 |
+
if face_policy == 'scale':
|
| 153 |
+
# The loader crops the face isotropically then scales to a square of size patch_size_load
|
| 154 |
+
loading_transformations = [
|
| 155 |
+
A.PadIfNeeded(min_height=patch_size, min_width=patch_size,
|
| 156 |
+
border_mode=cv2.BORDER_CONSTANT, value=0,always_apply=True),
|
| 157 |
+
A.Resize(height=patch_size,width=patch_size,always_apply=True),
|
| 158 |
+
]
|
| 159 |
+
if train:
|
| 160 |
+
downsample_train_transformations = [
|
| 161 |
+
A.Downscale(scale_max=0.5, scale_min=0.5, p=0.5), # replaces scaled dataset
|
| 162 |
+
]
|
| 163 |
+
else:
|
| 164 |
+
downsample_train_transformations = []
|
| 165 |
+
elif face_policy == 'tight':
|
| 166 |
+
# The loader crops the face tightly without any scaling
|
| 167 |
+
loading_transformations = [
|
| 168 |
+
A.LongestMaxSize(max_size=patch_size, always_apply=True),
|
| 169 |
+
A.PadIfNeeded(min_height=patch_size, min_width=patch_size,
|
| 170 |
+
border_mode=cv2.BORDER_CONSTANT, value=0,always_apply=True),
|
| 171 |
+
]
|
| 172 |
+
if train:
|
| 173 |
+
downsample_train_transformations = [
|
| 174 |
+
A.Downscale(scale_max=0.5, scale_min=0.5, p=0.5), # replaces scaled dataset
|
| 175 |
+
]
|
| 176 |
+
else:
|
| 177 |
+
downsample_train_transformations = []
|
| 178 |
+
else:
|
| 179 |
+
raise ValueError('Unknown value for face_policy: {}'.format(face_policy))
|
| 180 |
+
|
| 181 |
+
if train:
|
| 182 |
+
aug_transformations = [
|
| 183 |
+
A.Compose([
|
| 184 |
+
A.HorizontalFlip(),
|
| 185 |
+
A.OneOf([
|
| 186 |
+
A.RandomBrightnessContrast(),
|
| 187 |
+
A.HueSaturationValue(hue_shift_limit=10, sat_shift_limit=30, val_shift_limit=20),
|
| 188 |
+
]),
|
| 189 |
+
A.OneOf([
|
| 190 |
+
A.ISONoise(),
|
| 191 |
+
A.IAAAdditiveGaussianNoise(scale=(0.01 * 255, 0.03 * 255)),
|
| 192 |
+
]),
|
| 193 |
+
A.Downscale(scale_min=0.7, scale_max=0.9, interpolation=cv2.INTER_LINEAR),
|
| 194 |
+
A.ImageCompression(quality_lower=50, quality_upper=99),
|
| 195 |
+
], )
|
| 196 |
+
]
|
| 197 |
+
else:
|
| 198 |
+
aug_transformations = []
|
| 199 |
+
|
| 200 |
+
# Common final transformations
|
| 201 |
+
final_transformations = [
|
| 202 |
+
A.Normalize(mean=net_normalizer.mean, std=net_normalizer.std, ),
|
| 203 |
+
ToTensorV2(),
|
| 204 |
+
]
|
| 205 |
+
transf = A.Compose(
|
| 206 |
+
loading_transformations + downsample_train_transformations + aug_transformations + final_transformations)
|
| 207 |
+
return transf
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def aggregate(x, deadzone: float, pre_mult: float, policy: str, post_mult: float, clipmargin: float, params={}):
|
| 211 |
+
x = x.copy()
|
| 212 |
+
if deadzone > 0:
|
| 213 |
+
x = x[(x > deadzone) | (x < -deadzone)]
|
| 214 |
+
if len(x) == 0:
|
| 215 |
+
x = np.asarray([0, ])
|
| 216 |
+
if policy == 'mean':
|
| 217 |
+
x = np.mean(x)
|
| 218 |
+
x = scipy.special.expit(x * pre_mult)
|
| 219 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 220 |
+
elif policy == 'sigmean':
|
| 221 |
+
x = scipy.special.expit(x * pre_mult).mean()
|
| 222 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 223 |
+
elif policy == 'meanp':
|
| 224 |
+
pow_coeff = params.pop('p', 3)
|
| 225 |
+
x = np.mean(np.sign(x) * (np.abs(x) ** pow_coeff))
|
| 226 |
+
x = np.sign(x) * (np.abs(x) ** (1 / pow_coeff))
|
| 227 |
+
x = scipy.special.expit(x * pre_mult)
|
| 228 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 229 |
+
elif policy == 'median':
|
| 230 |
+
x = scipy.special.expit(np.median(x) * pre_mult)
|
| 231 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 232 |
+
elif policy == 'sigmedian':
|
| 233 |
+
x = np.median(scipy.special.expit(x * pre_mult))
|
| 234 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 235 |
+
elif policy == 'maxabs':
|
| 236 |
+
x = np.min(x) if abs(np.min(x)) > abs(np.max(x)) else np.max(x)
|
| 237 |
+
x = scipy.special.expit(x * pre_mult)
|
| 238 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 239 |
+
elif policy == 'avgvoting':
|
| 240 |
+
x = np.mean(np.sign(x))
|
| 241 |
+
x = (x * post_mult + 1) / 2
|
| 242 |
+
elif policy == 'voting':
|
| 243 |
+
x = np.sign(np.mean(x * pre_mult))
|
| 244 |
+
x = (x - 0.5) * post_mult + 0.5
|
| 245 |
+
else:
|
| 246 |
+
raise NotImplementedError()
|
| 247 |
+
return np.clip(x, clipmargin, 1 - clipmargin)
|
models/icpr2020dfdc/notebook/Analyze results net fusion paper.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/Analyze results.ipynb
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"source": [
|
| 6 |
+
"# Video Face Manipulation Detection Through Ensemble of CNNs\n",
|
| 7 |
+
"Image and Sound Processing Lab - Politecnico di Milano\n",
|
| 8 |
+
"- Nicolò Bonettini\n",
|
| 9 |
+
"- Edoardo Daniele Cannas\n",
|
| 10 |
+
"- Sara Mandelli\n",
|
| 11 |
+
"- Luca Bondi\n",
|
| 12 |
+
"- Paolo Bestagini"
|
| 13 |
+
],
|
| 14 |
+
"metadata": {
|
| 15 |
+
"collapsed": false,
|
| 16 |
+
"pycharm": {
|
| 17 |
+
"name": "#%% md\n"
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": null,
|
| 24 |
+
"metadata": {
|
| 25 |
+
"pycharm": {
|
| 26 |
+
"is_executing": false
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"outputs": [],
|
| 30 |
+
"source": [
|
| 31 |
+
"from pathlib import Path\n",
|
| 32 |
+
"\n",
|
| 33 |
+
"import numpy as np\n",
|
| 34 |
+
"import pandas as pd\n",
|
| 35 |
+
"import sklearn.metrics as M\n",
|
| 36 |
+
"from scipy.special import expit\n",
|
| 37 |
+
"from tqdm.notebook import tqdm"
|
| 38 |
+
]
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"cell_type": "code",
|
| 42 |
+
"execution_count": null,
|
| 43 |
+
"metadata": {
|
| 44 |
+
"pycharm": {
|
| 45 |
+
"is_executing": false,
|
| 46 |
+
"name": "#%%\n"
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
"outputs": [],
|
| 50 |
+
"source": [
|
| 51 |
+
"results_root = Path('results/')\n",
|
| 52 |
+
"results_model_folder = list(results_root.glob('net-*'))"
|
| 53 |
+
]
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"cell_type": "code",
|
| 57 |
+
"execution_count": null,
|
| 58 |
+
"metadata": {
|
| 59 |
+
"pycharm": {
|
| 60 |
+
"is_executing": false,
|
| 61 |
+
"name": "#%%\n"
|
| 62 |
+
}
|
| 63 |
+
},
|
| 64 |
+
"outputs": [],
|
| 65 |
+
"source": [
|
| 66 |
+
"def compute_metrics(df_res:pd.DataFrame,train_tag:str) -> dict:\n",
|
| 67 |
+
" numreal = sum(df_res['label']==False)\n",
|
| 68 |
+
" numfake = sum(df_res['label']==True\n",
|
| 69 |
+
")\n",
|
| 70 |
+
" \n",
|
| 71 |
+
" netname = train_tag.split('net-')[1].split('_')[0]\n",
|
| 72 |
+
" traindb = train_tag.split('traindb-')[1].split('_')[0]\n",
|
| 73 |
+
" \n",
|
| 74 |
+
" loss = M.log_loss(df_res['label'],expit(df_res['score']))\n",
|
| 75 |
+
" acc = M.accuracy_score(df_res['label'],df_res['score']>0)\n",
|
| 76 |
+
" accbal = M.balanced_accuracy_score(df_res['label'],df_res['score']>0)\n",
|
| 77 |
+
" rocauc = M.roc_auc_score(df_res['label'],df_res['score'])\n",
|
| 78 |
+
" \n",
|
| 79 |
+
" res_dict = {'traintag':train_tag,\n",
|
| 80 |
+
" 'net':netname,\n",
|
| 81 |
+
" 'traindb': traindb,\n",
|
| 82 |
+
" 'testdb':testdb,'testsplit':testsplit,\n",
|
| 83 |
+
" 'numreal':numreal,'numfake':numfake,\n",
|
| 84 |
+
" 'loss':loss,\n",
|
| 85 |
+
" 'acc':acc,'accbal':accbal,\n",
|
| 86 |
+
" 'rocauc':rocauc} \n",
|
| 87 |
+
" return res_dict"
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"cell_type": "code",
|
| 92 |
+
"execution_count": null,
|
| 93 |
+
"metadata": {
|
| 94 |
+
"pycharm": {
|
| 95 |
+
"is_executing": false,
|
| 96 |
+
"name": "#%%\n"
|
| 97 |
+
}
|
| 98 |
+
},
|
| 99 |
+
"outputs": [],
|
| 100 |
+
"source": [
|
| 101 |
+
"results_frame_list = []\n",
|
| 102 |
+
"results_video_list = []\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"for model_folder in tqdm(results_model_folder):\n",
|
| 105 |
+
" train_model_tag = model_folder.name\n",
|
| 106 |
+
" model_results = model_folder.glob('*.pkl')\n",
|
| 107 |
+
" for model_path in model_results:\n",
|
| 108 |
+
" testdb,testsplit = model_path.with_suffix('').name.rsplit('_',1)\n",
|
| 109 |
+
" \n",
|
| 110 |
+
" df_frames = pd.read_pickle(model_path)\n",
|
| 111 |
+
" results_frame_list.append(compute_metrics(df_frames,train_model_tag))\n",
|
| 112 |
+
" \n",
|
| 113 |
+
" df_videos = df_frames[['video','label','score']].groupby('video').mean()\n",
|
| 114 |
+
" df_videos['label'] = df_videos['label'].astype(np.bool)\n",
|
| 115 |
+
" results_video_list.append(compute_metrics(df_videos,train_model_tag))"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "code",
|
| 120 |
+
"execution_count": null,
|
| 121 |
+
"metadata": {
|
| 122 |
+
"pycharm": {
|
| 123 |
+
"is_executing": false,
|
| 124 |
+
"name": "#%%\n"
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"outputs": [],
|
| 128 |
+
"source": [
|
| 129 |
+
"df_res_frames = pd.DataFrame(results_frame_list)\n",
|
| 130 |
+
"df_res_frames"
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cell_type": "code",
|
| 135 |
+
"execution_count": null,
|
| 136 |
+
"metadata": {
|
| 137 |
+
"pycharm": {
|
| 138 |
+
"is_executing": false,
|
| 139 |
+
"name": "#%%\n"
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"outputs": [],
|
| 143 |
+
"source": [
|
| 144 |
+
"df_res_video = pd.DataFrame(results_video_list)\n",
|
| 145 |
+
"df_res_video"
|
| 146 |
+
]
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"cell_type": "code",
|
| 150 |
+
"execution_count": null,
|
| 151 |
+
"metadata": {
|
| 152 |
+
"pycharm": {
|
| 153 |
+
"name": "#%%\n"
|
| 154 |
+
}
|
| 155 |
+
},
|
| 156 |
+
"outputs": [],
|
| 157 |
+
"source": [
|
| 158 |
+
"df_res_frames.to_csv(results_root.joinpath('frames.csv'),index=False)\n",
|
| 159 |
+
"df_res_video.to_csv(results_root.joinpath('videos.csv'),index=False)\n"
|
| 160 |
+
]
|
| 161 |
+
}
|
| 162 |
+
],
|
| 163 |
+
"metadata": {
|
| 164 |
+
"kernelspec": {
|
| 165 |
+
"display_name": "Python 3",
|
| 166 |
+
"language": "python",
|
| 167 |
+
"name": "python3"
|
| 168 |
+
},
|
| 169 |
+
"language_info": {
|
| 170 |
+
"codemirror_mode": {
|
| 171 |
+
"name": "ipython",
|
| 172 |
+
"version": 3
|
| 173 |
+
},
|
| 174 |
+
"file_extension": ".py",
|
| 175 |
+
"mimetype": "text/x-python",
|
| 176 |
+
"name": "python",
|
| 177 |
+
"nbconvert_exporter": "python",
|
| 178 |
+
"pygments_lexer": "ipython3",
|
| 179 |
+
"version": "3.6.9"
|
| 180 |
+
},
|
| 181 |
+
"pycharm": {
|
| 182 |
+
"stem_cell": {
|
| 183 |
+
"cell_type": "raw",
|
| 184 |
+
"source": [],
|
| 185 |
+
"metadata": {
|
| 186 |
+
"collapsed": false
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
},
|
| 191 |
+
"nbformat": 4,
|
| 192 |
+
"nbformat_minor": 1
|
| 193 |
+
}
|
models/icpr2020dfdc/notebook/Image prediction and attention.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/Image prediction.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/Video prediction.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/Visualise attention and features.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/Xception train val curves.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-10fpv_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855657.4143803, 100, 0.664076566696167], [1586855675.3129528, 200, 0.6020640134811401], [1586855693.2831776, 300, 0.5488411784172058], [1586855711.2499564, 400, 0.5173333883285522], [1586855729.1875234, 500, 0.501915454864502], [1586855776.1844916, 600, 0.4799657464027405], [1586855794.269005, 700, 0.46737030148506165], [1586855812.9104939, 800, 0.4536152780056], [1586855831.8995173, 900, 0.4448673129081726], [1586855850.8361545, 1000, 0.4275650084018707], [1586855884.9663377, 1100, 0.4024522006511688], [1586855903.8836308, 1200, 0.38452476263046265], [1586855923.0994053, 1300, 0.3785211443901062], [1586855942.1471913, 1400, 0.3976532220840454], [1586855961.1960979, 1500, 0.37536072731018066], [1586855994.9994087, 1600, 0.3672179877758026], [1586856014.015313, 1700, 0.3389407992362976], [1586856033.1930175, 1800, 0.3412541449069977], [1586856052.2598999, 1900, 0.34266722202301025], [1586856071.3670852, 2000, 0.33332279324531555], [1586856105.5771792, 2100, 0.3326481878757477], [1586856124.5939715, 2200, 0.31087827682495117], [1586856143.732508, 2300, 0.32351329922676086], [1586856162.7879014, 2400, 0.29841428995132446], [1586856181.9402812, 2500, 0.30600619316101074], [1586856216.529709, 2600, 0.27909693121910095], [1586856235.6227334, 2700, 0.2849283218383789], [1586856254.745177, 2800, 0.28488290309906006], [1586856273.7526891, 2900, 0.2783524990081787], [1586856292.9389255, 3000, 0.2803735136985779], [1586856327.30237, 3100, 0.26846185326576233], [1586856346.3144464, 3200, 0.27380508184432983], [1586856365.5783036, 3300, 0.26997673511505127], [1586856384.5616689, 3400, 0.26624006032943726], [1586856403.6994708, 3500, 0.26579082012176514], [1586856439.4422247, 3600, 0.25974026322364807], [1586856458.42156, 3700, 0.24246197938919067], [1586856477.7030418, 3800, 0.24646519124507904], [1586856496.7144048, 3900, 0.24404343962669373], [1586856515.9350114, 4000, 0.22716261446475983], [1586856548.909426, 4100, 0.22914312779903412], [1586856567.987481, 4200, 0.21799463033676147], [1586856587.3252072, 4300, 0.2246071696281433], [1586856606.3312013, 4400, 0.21907640993595123], [1586856625.5588133, 4500, 0.22450266778469086], [1586856658.451022, 4600, 0.2175465077161789], [1586856677.4684958, 4700, 0.2087615579366684], [1586856696.7690592, 4800, 0.20617523789405823], [1586856715.8253028, 4900, 0.21258161962032318], [1586856734.903757, 5000, 0.21799342334270477], [1586856768.0823963, 5100, 0.20646518468856812], [1586856787.134906, 5200, 0.19681832194328308], [1586856806.1526842, 5300, 0.19671955704689026], [1586856825.1689382, 5400, 0.1942896842956543], [1586856844.3542144, 5500, 0.19197791814804077], [1586856876.83453, 5600, 0.19508203864097595], [1586856895.930109, 5700, 0.19281500577926636], [1586856915.0090895, 5800, 0.18568909168243408], [1586856934.036504, 5900, 0.19783063232898712], [1586856953.2636216, 6000, 0.17659583687782288], [1586856986.4198482, 6100, 0.18054784834384918], [1586857005.4342701, 6200, 0.1628488153219223], [1586857024.6319299, 6300, 0.18413430452346802], [1586857043.6636975, 6400, 0.1647426038980484], [1586857062.7356236, 6500, 0.17819498479366302], [1586857095.758487, 6600, 0.17750218510627747], [1586857114.7983983, 6700, 0.15462158620357513], [1586857133.9238558, 6800, 0.17558710277080536], [1586857152.9872983, 6900, 0.18131016194820404], [1586857172.07162, 7000, 0.18351058661937714], [1586857205.0166159, 7100, 0.15694105625152588], [1586857224.9484236, 7200, 0.14375120401382446], [1586857244.06737, 7300, 0.1583598405122757], [1586857263.1440334, 7400, 0.16269917786121368], [1586857282.4236255, 7500, 0.14873509109020233], [1586857315.2336128, 7600, 0.13867612183094025], [1586857334.2650366, 7700, 0.1537150889635086], [1586857353.3379278, 7800, 0.14718961715698242], [1586857372.3875127, 7900, 0.14197640120983124], [1586857391.712658, 8000, 0.14612126350402832], [1586857424.3228042, 8100, 0.1499471813440323], [1586857443.3882997, 8200, 0.14197304844856262], [1586857462.549038, 8300, 0.13479536771774292], [1586857481.5854588, 8400, 0.14266034960746765], [1586857500.8404307, 8500, 0.13953176140785217], [1586857533.568699, 8600, 0.14338184893131256], [1586857552.6712818, 8700, 0.1486930400133133], [1586857571.778367, 8800, 0.1361626833677292], [1586857590.8996766, 8900, 0.13551370799541473], [1586857610.2099082, 9000, 0.13751322031021118], [1586857642.7874627, 9100, 0.14817467331886292], [1586857661.8378093, 9200, 0.14590118825435638], [1586857680.9074075, 9300, 0.13575807213783264], [1586857699.969476, 9400, 0.1247890517115593], [1586857719.2864652, 9500, 0.15353302657604218], [1586857752.4509706, 9600, 0.12651945650577545], [1586857771.5552342, 9700, 0.13538450002670288], [1586857790.6461008, 9800, 0.1206069141626358], [1586857809.7368927, 9900, 0.12418889999389648], [1586857829.053743, 10000, 0.12783081829547882], [1586857863.28159, 10100, 0.1286032795906067], [1586857882.4303803, 10200, 0.13652385771274567], [1586857901.6031148, 10300, 0.12411317974328995], [1586857920.7716362, 10400, 0.1353633999824524], [1586857939.8852215, 10500, 0.1288897693157196], [1586857972.6657362, 10600, 0.13480937480926514], [1586857991.84856, 10700, 0.1427861750125885], [1586858011.8171978, 10800, 0.09534448385238647], [1586858030.901974, 10900, 0.11850855499505997], [1586858050.183749, 11000, 0.12836489081382751], [1586858082.7357135, 11100, 0.11842924356460571], [1586858101.8530872, 11200, 0.11058450490236282], [1586858121.0197053, 11300, 0.11972752958536148], [1586858140.1181576, 11400, 0.12693354487419128], [1586858159.3613033, 11500, 0.11918918788433075], [1586858192.881603, 11600, 0.10915011912584305], [1586858212.0498219, 11700, 0.11875256896018982], [1586858231.3209753, 11800, 0.11119901388883591], [1586858250.4427679, 11900, 0.10584466904401779], [1586858269.6511345, 12000, 0.1112273707985878], [1586858302.519853, 12100, 0.10983017832040787], [1586858321.635463, 12200, 0.12341088056564331], [1586858340.8695133, 12300, 0.14253956079483032], [1586858359.9826758, 12400, 0.12547607719898224], [1586858379.3332415, 12500, 0.12272147089242935], [1586858412.5262368, 12600, 0.11153701692819595], [1586858431.7463708, 12700, 0.1246463879942894], [1586858451.171367, 12800, 0.13360172510147095], [1586858470.3530712, 12900, 0.12216604501008987], [1586858489.5978801, 13000, 0.1135534718632698], [1586858521.7115798, 13100, 0.1364133208990097], [1586858540.9329329, 13200, 0.1237773522734642], [1586858560.1639235, 13300, 0.122013621032238], [1586858579.3298445, 13400, 0.110170878469944], [1586858598.5297725, 13500, 0.11785834282636642], [1586858631.796185, 13600, 0.1237218827009201], [1586858651.1346502, 13700, 0.11273130774497986], [1586858670.3166652, 13800, 0.1329004466533661], [1586858689.4672265, 13900, 0.11230912059545517], [1586858708.6368115, 14000, 0.11940842121839523], [1586858741.963986, 14100, 0.12637130916118622], [1586858761.1408346, 14200, 0.1238148957490921], [1586858780.4713798, 14300, 0.12442939728498459], [1586858800.6233618, 14400, 0.06836232542991638], [1586858819.989772, 14500, 0.11674665659666061], [1586858853.56678, 14600, 0.12235332280397415], [1586858872.7121606, 14700, 0.11008656024932861], [1586858891.8160226, 14800, 0.11155284196138382], [1586858910.9310977, 14900, 0.11516596376895905], [1586858930.2900035, 15000, 0.10303477942943573], [1586858963.6102748, 15100, 0.10700356960296631], [1586858982.754605, 15200, 0.10183835029602051], [1586859002.0250611, 15300, 0.12039273232221603], [1586859021.2353992, 15400, 0.10729029774665833], [1586859040.5332036, 15500, 0.10976753383874893], [1586859074.2216828, 15600, 0.10453188419342041], [1586859093.3048956, 15700, 0.11498740315437317], [1586859112.4159014, 15800, 0.12045454233884811], [1586859131.5227776, 15900, 0.12367039918899536], [1586859150.5316496, 16000, 0.1252395063638687], [1586859183.211628, 16100, 0.12021861970424652], [1586859202.252956, 16200, 0.12207909673452377], [1586859221.4213824, 16300, 0.12336067855358124], [1586859240.5948503, 16400, 0.12350460141897202], [1586859259.7508104, 16500, 0.11872312426567078], [1586859292.1969512, 16600, 0.11317301541566849], [1586859311.2616603, 16700, 0.12950094044208527], [1586859330.3860261, 16800, 0.11648441851139069], [1586859349.530051, 16900, 0.12322200834751129], [1586859368.6095455, 17000, 0.11275148391723633], [1586859401.4208572, 17100, 0.12028223276138306], [1586859420.5073745, 17200, 0.11098488420248032], [1586859439.6149569, 17300, 0.1125388965010643], [1586859458.7424798, 17400, 0.11772271990776062], [1586859477.8065343, 17500, 0.10087492316961288], [1586859510.7563498, 17600, 0.12599188089370728], [1586859529.8404768, 17700, 0.11379552632570267], [1586859548.926493, 17800, 0.12409254163503647], [1586859567.9352455, 17900, 0.12703284621238708], [1586859587.9340477, 18000, 0.10602692514657974], [1586859620.9142835, 18100, 0.11058027297258377], [1586859639.949351, 18200, 0.1116148978471756], [1586859658.971902, 18300, 0.11507028341293335], [1586859678.0789478, 18400, 0.09921152889728546], [1586859697.1166325, 18500, 0.10390691459178925], [1586859729.5001273, 18600, 0.10805699974298477], [1586859748.5440955, 18700, 0.11512459814548492], [1586859767.5885384, 18800, 0.09647060185670853], [1586859786.6450589, 18900, 0.09714328497648239], [1586859805.7100246, 19000, 0.10530748963356018], [1586859838.5254514, 19100, 0.1030886247754097], [1586859857.6030931, 19200, 0.09548232704401016], [1586859876.5787992, 19300, 0.09842224419116974], [1586859895.561638, 19400, 0.11496444046497345], [1586859914.591544, 19500, 0.11031936854124069], [1586859947.20431, 19600, 0.11382463574409485], [1586859966.1857965, 19700, 0.10832177847623825], [1586859985.2394578, 19800, 0.10360904783010483], [1586860004.3762271, 19900, 0.11416646093130112], [1586860023.4630804, 20000, 0.11280178278684616], [1586860055.7532094, 20100, 0.11682923138141632], [1586860074.8302867, 20200, 0.10167958587408066], [1586860093.9557858, 20300, 0.12024421989917755], [1586860112.9903808, 20400, 0.11880369484424591], [1586860132.0530496, 20500, 0.10983561724424362], [1586860164.3936603, 20600, 0.10812229663133621], [1586860183.4184396, 20700, 0.11902886629104614], [1586860202.4489179, 20800, 0.113478884100914], [1586860221.565175, 20900, 0.10916882008314133], [1586860240.6297398, 21000, 0.1083231195807457], [1586860272.86722, 21100, 0.09862468391656876], [1586860291.9252381, 21200, 0.11275899410247803], [1586860310.8750057, 21300, 0.1076168641448021], [1586860329.9633682, 21400, 0.1186123862862587], [1586860349.1039357, 21500, 0.11643733084201813], [1586860382.2158208, 21600, 0.06254855543375015], [1586860401.205649, 21700, 0.11246663331985474], [1586860420.2956975, 21800, 0.11563210189342499], [1586860439.349639, 21900, 0.10702110826969147], [1586860458.5761144, 22000, 0.09552697837352753], [1586860491.2165668, 22100, 0.10468018800020218], [1586860510.2639854, 22200, 0.09994526952505112], [1586860529.305116, 22300, 0.09749030321836472], [1586860548.382374, 22400, 0.09707058221101761], [1586860567.3973477, 22500, 0.10592274367809296], [1586860600.2881842, 22600, 0.09089124947786331], [1586860619.3352404, 22700, 0.09885946661233902], [1586860638.3820736, 22800, 0.09480632096529007], [1586860657.4802165, 22900, 0.10277939587831497], [1586860676.604792, 23000, 0.10064812749624252], [1586860708.9327762, 23100, 0.11508448421955109], [1586860727.9961245, 23200, 0.11033714562654495], [1586860747.031479, 23300, 0.10408800840377808], [1586860766.160321, 23400, 0.10250773280858994], [1586860785.431703, 23500, 0.11068736016750336], [1586860818.227178, 23600, 0.11077055335044861], [1586860837.3112, 23700, 0.11184380948543549], [1586860856.3810954, 23800, 0.10498100519180298], [1586860875.4325867, 23900, 0.10906950384378433], [1586860894.5384164, 24000, 0.10969626158475876], [1586860926.9346955, 24100, 0.10493382811546326], [1586860945.961847, 24200, 0.09851567447185516], [1586860965.0073142, 24300, 0.10190816968679428], [1586860984.0858917, 24400, 0.10914485156536102], [1586861003.1366298, 24500, 0.11154624074697495], [1586861035.494959, 24600, 0.11356140673160553], [1586861054.5416718, 24700, 0.0927022397518158], [1586861073.6413267, 24800, 0.11151596158742905], [1586861092.689849, 24900, 0.11468431353569031], [1586861111.8288271, 25000, 0.10868770629167557], [1586861143.9264014, 25100, 0.11180949956178665], [1586861163.8789093, 25200, 0.059117238968610764], [1586861182.8974657, 25300, 0.09535568207502365], [1586861201.8684158, 25400, 0.0982925295829773], [1586861220.928441, 25500, 0.10794837772846222], [1586861252.7835782, 25600, 0.09793243557214737], [1586861271.7891362, 25700, 0.09952760487794876], [1586861291.1745892, 25800, 0.09991254657506943], [1586861310.3802705, 25900, 0.10032907128334045], [1586861329.5595977, 26000, 0.0896141529083252], [1586861361.814611, 26100, 0.10771028697490692], [1586861380.8133724, 26200, 0.09319339692592621], [1586861400.0365458, 26300, 0.10466446727514267], [1586861419.0629945, 26400, 0.09054773300886154], [1586861438.1116116, 26500, 0.09431181848049164], [1586861470.7324688, 26600, 0.1012401282787323], [1586861489.7074726, 26700, 0.10523825138807297], [1586861508.7676816, 26800, 0.1019875556230545], [1586861527.8701577, 26900, 0.10263427346944809], [1586861546.802512, 27000, 0.10137905925512314], [1586861578.8963077, 27100, 0.10041015595197678], [1586861597.9246955, 27200, 0.1078469306230545], [1586861616.9963276, 27300, 0.11477400362491608], [1586861636.0085495, 27400, 0.107038713991642], [1586861655.0336835, 27500, 0.11641287058591843], [1586861687.1801372, 27600, 0.101515032351017], [1586861706.2195992, 27700, 0.11202311515808105], [1586861725.1354551, 27800, 0.09993867576122284], [1586861744.2259312, 27900, 0.11000829935073853], [1586861763.276876, 28000, 0.10594760626554489], [1586861795.335049, 28100, 0.10134757310152054], [1586861814.3049948, 28200, 0.10233980417251587], [1586861833.5109227, 28300, 0.09194254130125046], [1586861852.4843552, 28400, 0.0990184023976326], [1586861871.4740174, 28500, 0.10304329544305801], [1586861904.446671, 28600, 0.09969716519117355], [1586861923.4568949, 28700, 0.10943863540887833], [1586861943.43068, 28800, 0.06906166672706604], [1586861962.5473466, 28900, 0.09778091311454773], [1586861981.6168644, 29000, 0.10624095052480698], [1586862014.1275423, 29100, 0.09349410980939865], [1586862033.1878493, 29200, 0.09603369981050491], [1586862052.1797187, 29300, 0.09857804328203201], [1586862071.238652, 29400, 0.10668645799160004], [1586862090.2984297, 29500, 0.09773796051740646], [1586862122.4311185, 29600, 0.09452865272760391], [1586862141.4962013, 29700, 0.09406407177448273], [1586862160.5327625, 29800, 0.09201450645923615], [1586862179.5574465, 29900, 0.10741924494504929], [1586862198.645388, 30000, 0.09557414799928665]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-10fpv_face-scale_size-224_seed-41-tag-val_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855757.9517221, 500, 0.5818271040916443], [1586855865.995774, 1000, 0.4886093735694885], [1586855975.482252, 1500, 0.4172975420951843], [1586856086.292573, 2000, 0.3987463414669037], [1586856197.2337093, 2500, 0.38445737957954407], [1586856308.0671751, 3000, 0.3592554032802582], [1586856419.8293703, 3500, 0.39080333709716797], [1586856530.1869178, 4000, 0.36318060755729675], [1586856639.7250543, 4500, 0.422347754240036], [1586856749.4207523, 5000, 0.36140117049217224], [1586856858.1269765, 5500, 0.38833510875701904], [1586856967.8879087, 6000, 0.38106247782707214], [1586857077.116273, 6500, 0.3753085732460022], [1586857186.3476846, 7000, 0.43273138999938965], [1586857296.5909865, 7500, 0.45969468355178833], [1586857405.5944507, 8000, 0.4622499644756317], [1586857514.7825892, 8500, 0.45223143696784973], [1586857624.0490594, 9000, 0.46995997428894043], [1586857733.7308807, 9500, 0.47761964797973633], [1586857844.6399384, 10000, 0.4661433696746826], [1586857953.9782307, 10500, 0.4903329312801361], [1586858063.895361, 11000, 0.46380293369293213], [1586858174.181782, 11500, 0.4849981665611267], [1586858283.8515263, 12000, 0.4756981134414673], [1586858393.7289634, 12500, 0.45006856322288513], [1586858502.9515202, 13000, 0.4817664325237274], [1586858613.1195726, 13500, 0.5067331790924072], [1586858723.136456, 14000, 0.47658565640449524], [1586858834.693256, 14500, 0.5058513879776001], [1586858944.9080229, 15000, 0.4666120409965515], [1586859055.6895103, 15500, 0.5134055018424988], [1586859164.5702846, 16000, 0.5076718926429749], [1586859273.6219378, 16500, 0.5003888010978699], [1586859382.854402, 17000, 0.4879944622516632], [1586859492.237553, 17500, 0.4848056137561798], [1586859602.431811, 18000, 0.5097171068191528], [1586859711.0015135, 18500, 0.4768640100955963], [1586859820.0335588, 19000, 0.5034921765327454], [1586859928.7071486, 19500, 0.5523637533187866], [1586860037.2523878, 20000, 0.5127167701721191], [1586860145.7458704, 20500, 0.5190102458000183], [1586860254.2972744, 21000, 0.5002608895301819], [1586860362.6023135, 21500, 0.5322682857513428], [1586860472.6258051, 22000, 0.5340228080749512], [1586860581.6650157, 22500, 0.526958703994751], [1586860690.353545, 23000, 0.5228050351142883], [1586860799.597433, 23500, 0.5539165735244751], [1586860908.368782, 24000, 0.4942719638347626], [1586861016.989616, 24500, 0.5226066708564758], [1586861125.2905362, 25000, 0.5470898151397705], [1586861234.3066344, 25500, 0.5340771079063416], [1586861343.2687485, 26000, 0.5432325601577759], [1586861452.254097, 26500, 0.5172580480575562], [1586861560.3231812, 27000, 0.5447824001312256], [1586861668.695499, 27500, 0.5266392827033997], [1586861776.86941, 28000, 0.5549547672271729], [1586861885.958843, 28500, 0.5450044274330139], [1586861995.618086, 29000, 0.5638945698738098], [1586862103.9028006, 29500, 0.5541782975196838], [1586862212.3703022, 30000, 0.52791428565979]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-15fpv_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855667.9586005, 100, 0.667951762676239], [1586855685.789115, 200, 0.6050449013710022], [1586855703.6844504, 300, 0.5623019933700562], [1586855721.6289763, 400, 0.5209448933601379], [1586855753.4248097, 500, 0.49115628004074097], [1586855786.630457, 600, 0.4833109676837921], [1586855805.6018698, 700, 0.47778868675231934], [1586855824.6807556, 800, 0.45174872875213623], [1586855843.6850362, 900, 0.4347238540649414], [1586855862.9941854, 1000, 0.429659903049469], [1586855898.1550245, 1100, 0.4220423698425293], [1586855917.2772992, 1200, 0.4177480936050415], [1586855936.2031791, 1300, 0.38824114203453064], [1586855955.1473582, 1400, 0.3809278905391693], [1586855974.402857, 1500, 0.3607206642627716], [1586856008.4043777, 1600, 0.3653607964515686], [1586856027.456452, 1700, 0.35407376289367676], [1586856046.3960013, 1800, 0.3550025522708893], [1586856065.306703, 1900, 0.3387036919593811], [1586856084.5554905, 2000, 0.3294917047023773], [1586856119.660639, 2100, 0.33332890272140503], [1586856138.7444332, 2200, 0.31831395626068115], [1586856157.670952, 2300, 0.3109409511089325], [1586856176.6306114, 2400, 0.31849923729896545], [1586856195.7452626, 2500, 0.30012500286102295], [1586856229.475803, 2600, 0.2994501292705536], [1586856248.518306, 2700, 0.30717968940734863], [1586856267.466967, 2800, 0.2817901372909546], [1586856286.4202993, 2900, 0.2854803502559662], [1586856305.6876807, 3000, 0.3009660542011261], [1586856339.9232209, 3100, 0.285819947719574], [1586856359.0213482, 3200, 0.2779843509197235], [1586856377.946691, 3300, 0.2748790383338928], [1586856396.8884964, 3400, 0.2908974289894104], [1586856416.0335572, 3500, 0.257630854845047], [1586856449.6892152, 3600, 0.26956871151924133], [1586856468.7678814, 3700, 0.2542724013328552], [1586856487.7604861, 3800, 0.2521195411682129], [1586856506.7676907, 3900, 0.2710226774215698], [1586856525.8772283, 4000, 0.24471600353717804], [1586856559.7046669, 4100, 0.25677192211151123], [1586856578.703918, 4200, 0.2367100715637207], [1586856597.7600255, 4300, 0.2457253485918045], [1586856616.691008, 4400, 0.22394981980323792], [1586856635.7480958, 4500, 0.24377477169036865], [1586856669.4514341, 4600, 0.2530863881111145], [1586856688.4902058, 4700, 0.2511032521724701], [1586856707.4359956, 4800, 0.22161240875720978], [1586856726.412315, 4900, 0.2225603461265564], [1586856745.4187071, 5000, 0.2232905924320221], [1586856779.1257052, 5100, 0.222071573138237], [1586856797.998107, 5200, 0.19715113937854767], [1586856816.934601, 5300, 0.21529465913772583], [1586856836.6529498, 5400, 0.14717721939086914], [1586856855.656465, 5500, 0.21634267270565033], [1586856889.121701, 5600, 0.2079978883266449], [1586856908.0773194, 5700, 0.21611666679382324], [1586856926.973071, 5800, 0.1946064680814743], [1586856945.9295416, 5900, 0.21366262435913086], [1586856965.1317677, 6000, 0.21932406723499298], [1586856997.4848225, 6100, 0.20977391302585602], [1586857016.4557197, 6200, 0.19867071509361267], [1586857035.4658906, 6300, 0.18195387721061707], [1586857054.3104393, 6400, 0.19917619228363037], [1586857073.3100107, 6500, 0.18691366910934448], [1586857106.3383255, 6600, 0.19969311356544495], [1586857125.3388624, 6700, 0.17840351164340973], [1586857144.2532074, 6800, 0.17038704454898834], [1586857163.1745682, 6900, 0.17636540532112122], [1586857182.1140304, 7000, 0.18311604857444763], [1586857215.6403813, 7100, 0.1821891963481903], [1586857234.705901, 7200, 0.1778549998998642], [1586857253.8619432, 7300, 0.16905976831912994], [1586857273.1013522, 7400, 0.18146395683288574], [1586857292.5577369, 7500, 0.1646166741847992], [1586857326.178498, 7600, 0.17075790464878082], [1586857345.333233, 7700, 0.17682282626628876], [1586857364.4898617, 7800, 0.17570146918296814], [1586857383.6246684, 7900, 0.15858541429042816], [1586857403.1153224, 8000, 0.157534658908844], [1586857436.6479259, 8100, 0.16567543148994446], [1586857455.9228618, 8200, 0.1437927484512329], [1586857474.9684978, 8300, 0.14881189167499542], [1586857493.997675, 8400, 0.1828555464744568], [1586857513.158921, 8500, 0.16240470111370087], [1586857546.6391711, 8600, 0.1532525271177292], [1586857565.5774097, 8700, 0.1629549264907837], [1586857584.5300407, 8800, 0.18210944533348083], [1586857603.5563138, 8900, 0.16024132072925568], [1586857622.7362232, 9000, 0.15370939671993256], [1586857656.3134387, 9100, 0.14322765171527863], [1586857675.2598083, 9200, 0.15736345946788788], [1586857694.1911218, 9300, 0.1660473495721817], [1586857713.2518232, 9400, 0.13764221966266632], [1586857732.3711858, 9500, 0.14748279750347137], [1586857765.057526, 9600, 0.14436691999435425], [1586857784.1319845, 9700, 0.14769825339317322], [1586857803.1122532, 9800, 0.14622680842876434], [1586857822.1516197, 9900, 0.1658543199300766], [1586857841.361638, 10000, 0.1512923687696457], [1586857874.3426948, 10100, 0.16535669565200806], [1586857893.6276824, 10200, 0.13921603560447693], [1586857912.8944128, 10300, 0.14080481231212616], [1586857931.9235013, 10400, 0.13601185381412506], [1586857950.9918194, 10500, 0.13150542974472046], [1586857983.9205568, 10600, 0.13627123832702637], [1586858003.046308, 10700, 0.14407788217067719], [1586858023.340068, 10800, 0.18745142221450806], [1586858042.3448842, 10900, 0.13653960824012756], [1586858061.2404325, 11000, 0.13052761554718018], [1586858094.5539713, 11100, 0.14134018123149872], [1586858113.4742172, 11200, 0.13298045098781586], [1586858132.4944851, 11300, 0.13364844024181366], [1586858151.485327, 11400, 0.15130189061164856], [1586858170.5468907, 11500, 0.1446312814950943], [1586858203.5597322, 11600, 0.13284189999103546], [1586858222.6504402, 11700, 0.12678678333759308], [1586858241.6523814, 11800, 0.12692908942699432], [1586858260.6239274, 11900, 0.1286250799894333], [1586858279.7128558, 12000, 0.12750400602817535], [1586858313.0690277, 12100, 0.12408183515071869], [1586858332.3240438, 12200, 0.12493609637022018], [1586858351.5557015, 12300, 0.11758539825677872], [1586858370.66613, 12400, 0.125995934009552], [1586858389.7187517, 12500, 0.12690122425556183], [1586858423.4470007, 12600, 0.1220148354768753], [1586858442.6068208, 12700, 0.11992789804935455], [1586858461.766929, 12800, 0.12081725895404816], [1586858480.7220478, 12900, 0.12728650867938995], [1586858499.7170546, 13000, 0.12137823551893234], [1586858533.6063435, 13100, 0.1287212073802948], [1586858552.640877, 13200, 0.1274777203798294], [1586858571.7170348, 13300, 0.10647594928741455], [1586858590.9275475, 13400, 0.10992174595594406], [1586858609.9775076, 13500, 0.1286410689353943], [1586858642.3291702, 13600, 0.12276995182037354], [1586858661.297534, 13700, 0.11403141915798187], [1586858680.2211852, 13800, 0.13629187643527985], [1586858699.0992002, 13900, 0.10590628534555435], [1586858717.965196, 14000, 0.11125955730676651], [1586858752.0487025, 14100, 0.11846287548542023], [1586858771.3394027, 14200, 0.12672066688537598], [1586858790.3579032, 14300, 0.12029430270195007], [1586858809.3789582, 14400, 0.1099720299243927], [1586858828.3693442, 14500, 0.111781544983387], [1586858862.5284014, 14600, 0.12075693905353546], [1586858881.5230572, 14700, 0.1295222043991089], [1586858900.4180598, 14800, 0.12152550369501114], [1586858919.4712284, 14900, 0.10872365534305573], [1586858938.5205529, 15000, 0.10259877890348434], [1586858972.4673905, 15100, 0.11418561637401581], [1586858991.4813578, 15200, 0.11274868249893188], [1586859010.357999, 15300, 0.1257946789264679], [1586859029.2385094, 15400, 0.12120363861322403], [1586859048.1961026, 15500, 0.13357998430728912], [1586859082.40069, 15600, 0.11027025431394577], [1586859101.3121042, 15700, 0.11350228637456894], [1586859120.295305, 15800, 0.1063072681427002], [1586859139.2276018, 15900, 0.10825981199741364], [1586859158.1928012, 16000, 0.12001978605985641], [1586859192.4119654, 16100, 0.12417740374803543], [1586859212.3386838, 16200, 0.16948719322681427], [1586859231.3164673, 16300, 0.1190958023071289], [1586859250.4202397, 16400, 0.11640849709510803], [1586859269.4391153, 16500, 0.13550423085689545], [1586859302.0481157, 16600, 0.12911586463451385], [1586859321.0627577, 16700, 0.12650293111801147], [1586859340.1346767, 16800, 0.1317710280418396], [1586859359.260413, 16900, 0.1373814344406128], [1586859378.3974533, 17000, 0.12401777505874634], [1586859411.969588, 17100, 0.11668618023395538], [1586859431.0531945, 17200, 0.11765322089195251], [1586859450.0747716, 17300, 0.10178673267364502], [1586859469.2059698, 17400, 0.13486911356449127], [1586859488.2672064, 17500, 0.11766283214092255], [1586859521.7794988, 17600, 0.11855870485305786], [1586859540.782763, 17700, 0.12315332889556885], [1586859559.8347652, 17800, 0.1131141185760498], [1586859579.011165, 17900, 0.11648017168045044], [1586859598.1232755, 18000, 0.11854634433984756], [1586859632.0703573, 18100, 0.12482111155986786], [1586859651.0911987, 18200, 0.10995980352163315], [1586859670.079379, 18300, 0.11299754679203033], [1586859688.9985178, 18400, 0.11068304628133774], [1586859708.0614715, 18500, 0.11340723186731339], [1586859741.1243827, 18600, 0.10938625037670135], [1586859760.1131153, 18700, 0.09770788252353668], [1586859779.053934, 18800, 0.10680928826332092], [1586859798.0470428, 18900, 0.11806930601596832], [1586859817.0840545, 19000, 0.11356022208929062], [1586859850.0175657, 19100, 0.12084164470434189], [1586859869.0564566, 19200, 0.1291044056415558], [1586859888.0177283, 19300, 0.10601416975259781], [1586859907.07599, 19400, 0.1137823686003685], [1586859926.1842213, 19500, 0.11397040635347366], [1586859959.6534872, 19600, 0.11837930977344513], [1586859978.6627378, 19700, 0.10796679556369781], [1586859997.6182578, 19800, 0.10757831484079361], [1586860016.666719, 19900, 0.10120370239019394], [1586860035.7486277, 20000, 0.12299929559230804], [1586860068.6753604, 20100, 0.12893174588680267], [1586860087.6585896, 20200, 0.10476018488407135], [1586860106.6675372, 20300, 0.11581164598464966], [1586860125.712752, 20400, 0.1054806113243103], [1586860144.7265692, 20500, 0.1106778010725975], [1586860178.3300354, 20600, 0.10780924558639526], [1586860197.3362174, 20700, 0.11505372822284698], [1586860216.3469038, 20800, 0.11387813836336136], [1586860235.562049, 20900, 0.10928833484649658], [1586860254.6235447, 21000, 0.11025840789079666], [1586860286.3618786, 21100, 0.10588070005178452], [1586860305.5635786, 21200, 0.10296781361103058], [1586860324.5843747, 21300, 0.09753110259771347], [1586860343.7410185, 21400, 0.11007064580917358], [1586860362.89603, 21500, 0.11433536559343338], [1586860396.6264205, 21600, 0.16175150871276855], [1586860415.6196847, 21700, 0.11315995454788208], [1586860434.7491708, 21800, 0.1100592091679573], [1586860453.8137538, 21900, 0.1164102628827095], [1586860472.8668513, 22000, 0.11333610862493515], [1586860506.244781, 22100, 0.10764096677303314], [1586860525.2248247, 22200, 0.12396703660488129], [1586860544.1995895, 22300, 0.1205042153596878], [1586860563.3321092, 22400, 0.11326155066490173], [1586860582.5734096, 22500, 0.10339509695768356], [1586860615.0212567, 22600, 0.11047143489122391], [1586860633.9456966, 22700, 0.10401836037635803], [1586860653.1127477, 22800, 0.1077738031744957], [1586860672.2697313, 22900, 0.11139900237321854], [1586860691.2720249, 23000, 0.10208532214164734], [1586860723.6002743, 23100, 0.1014561802148819], [1586860742.5631413, 23200, 0.11042759567499161], [1586860761.4288683, 23300, 0.10538402944803238], [1586860780.3396819, 23400, 0.10734787583351135], [1586860799.4481359, 23500, 0.10693501681089401], [1586860832.832298, 23600, 0.10539426654577255], [1586860852.1750674, 23700, 0.10571622103452682], [1586860871.539469, 23800, 0.10525241494178772], [1586860890.9124372, 23900, 0.10348638147115707], [1586860910.1910663, 24000, 0.11711107939481735], [1586860943.73775, 24100, 0.09673219174146652], [1586860962.8048666, 24200, 0.10283117741346359], [1586860981.6794052, 24300, 0.10872495174407959], [1586861000.5605464, 24400, 0.11096326261758804], [1586861019.5965292, 24500, 0.1036648079752922], [1586861053.0334692, 24600, 0.11695593595504761], [1586861072.010503, 24700, 0.10101468861103058], [1586861090.8997126, 24800, 0.10257156938314438], [1586861109.9000974, 24900, 0.11001349985599518], [1586861128.8825366, 25000, 0.12039443850517273], [1586861162.504858, 25100, 0.10424015671014786], [1586861181.6772397, 25200, 0.0971585065126419], [1586861200.639131, 25300, 0.10345858335494995], [1586861219.4965491, 25400, 0.10531696677207947], [1586861238.3684785, 25500, 0.11074382066726685], [1586861271.7019243, 25600, 0.10216683149337769], [1586861290.9488852, 25700, 0.10536996275186539], [1586861309.8259919, 25800, 0.1044713631272316], [1586861328.8278913, 25900, 0.10344894975423813], [1586861347.8022788, 26000, 0.09995543211698532], [1586861380.6527967, 26100, 0.11744169890880585], [1586861399.6341443, 26200, 0.10296919196844101], [1586861418.5032694, 26300, 0.11317246407270432], [1586861437.4552474, 26400, 0.10895849764347076], [1586861456.4600194, 26500, 0.10096395015716553], [1586861489.4089265, 26600, 0.101157546043396], [1586861508.2413545, 26700, 0.09709342569112778], [1586861527.1096463, 26800, 0.09875193238258362], [1586861546.0587409, 26900, 0.10718066245317459], [1586861565.7248976, 27000, 0.1338912844657898], [1586861598.8770368, 27100, 0.11794523894786835], [1586861617.7334998, 27200, 0.11036459356546402], [1586861636.5628178, 27300, 0.11417761445045471], [1586861655.557159, 27400, 0.1097930371761322], [1586861674.81659, 27500, 0.10580466687679291], [1586861707.8479776, 27600, 0.12138016521930695], [1586861726.914994, 27700, 0.11021167784929276], [1586861745.9716148, 27800, 0.10955946892499924], [1586861764.9306645, 27900, 0.10789389908313751], [1586861783.9126964, 28000, 0.09672330319881439], [1586861817.2411938, 28100, 0.09464653581380844], [1586861836.491975, 28200, 0.11140458285808563], [1586861855.5985236, 28300, 0.10131017118692398], [1586861874.5132172, 28400, 0.10089343786239624], [1586861893.5421557, 28500, 0.10660499334335327], [1586861926.1937647, 28600, 0.11157619208097458], [1586861945.0199473, 28700, 0.11310619860887527], [1586861963.9088717, 28800, 0.10137102007865906], [1586861982.7481894, 28900, 0.10457919538021088], [1586862001.771127, 29000, 0.10118771344423294], [1586862034.6226745, 29100, 0.10094541311264038], [1586862053.436125, 29200, 0.10804901272058487], [1586862072.3050275, 29300, 0.11112836003303528], [1586862091.2325602, 29400, 0.11597523838281631], [1586862110.2836084, 29500, 0.0943223088979721], [1586862143.8553421, 29600, 0.09983965754508972], [1586862162.719373, 29700, 0.10533247888088226], [1586862181.597763, 29800, 0.10265962779521942], [1586862200.6111326, 29900, 0.09728706628084183], [1586862219.675862, 30000, 0.11286629736423492]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-15fpv_face-scale_size-224_seed-41-tag-val_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855768.4080675, 500, 0.5974318385124207], [1586855878.8983245, 1000, 0.5024705529212952], [1586855989.3863988, 1500, 0.42415517568588257], [1586856100.4967017, 2000, 0.38488954305648804], [1586856210.5225713, 2500, 0.3835225999355316], [1586856320.9698937, 3000, 0.3573625683784485], [1586856430.7067802, 3500, 0.3555973768234253], [1586856541.3487926, 4000, 0.35780948400497437], [1586856651.0654557, 4500, 0.4245525896549225], [1586856760.2254946, 5000, 0.3440066874027252], [1586856870.7436314, 5500, 0.37077969312667847], [1586856979.101511, 6000, 0.3675929605960846], [1586857087.902873, 6500, 0.38111135363578796], [1586857197.1895082, 7000, 0.3589291572570801], [1586857307.7607136, 7500, 0.41019004583358765], [1586857418.2975242, 8000, 0.3954257369041443], [1586857528.3397067, 8500, 0.40555301308631897], [1586857637.9324093, 9000, 0.4367411434650421], [1586857746.6260145, 9500, 0.4373588263988495], [1586857855.9577143, 10000, 0.41008979082107544], [1586857965.4764996, 10500, 0.5121046900749207], [1586858076.1899288, 11000, 0.4463781416416168], [1586858185.1717732, 11500, 0.46163663268089294], [1586858294.6231542, 12000, 0.4825904965400696], [1586858404.9948905, 12500, 0.4557188153266907], [1586858515.2546673, 13000, 0.467858225107193], [1586858623.9717102, 13500, 0.46794235706329346], [1586858733.6794457, 14000, 0.4648524522781372], [1586858844.148357, 14500, 0.46972164511680603], [1586858954.0587785, 15000, 0.467934250831604], [1586859064.0355647, 15500, 0.46739745140075684], [1586859173.9345684, 16000, 0.46345651149749756], [1586859283.591041, 16500, 0.4785779118537903], [1586859393.495761, 17000, 0.46538129448890686], [1586859503.3495877, 17500, 0.48007071018218994], [1586859613.6337292, 18000, 0.4804244041442871], [1586859722.7111228, 18500, 0.46840614080429077], [1586859831.6108363, 19000, 0.4824534058570862], [1586859941.2089446, 19500, 0.47022202610969543], [1586860050.2564049, 20000, 0.46667465567588806], [1586860159.9335458, 20500, 0.4687759578227997], [1586860267.905892, 21000, 0.4713040888309479], [1586860377.410316, 21500, 0.4780498445034027], [1586860487.9214814, 22000, 0.5193381905555725], [1586860596.6799004, 22500, 0.5263491868972778], [1586860705.278, 23000, 0.4571678936481476], [1586860814.5053022, 23500, 0.5159485340118408], [1586860925.4635377, 24000, 0.5077453851699829], [1586861034.7017884, 24500, 0.49189627170562744], [1586861144.180297, 25000, 0.5259409546852112], [1586861253.3273065, 25500, 0.5160655975341797], [1586861362.2908447, 26000, 0.5188646912574768], [1586861471.0636294, 26500, 0.5161329507827759], [1586861580.5997946, 27000, 0.5083663463592529], [1586861689.502943, 27500, 0.5120730996131897], [1586861798.8856504, 28000, 0.48497870564460754], [1586861907.8638244, 28500, 0.4711289405822754], [1586862016.3463056, 29000, 0.527015745639801], [1586862125.4629807, 29500, 0.4715350568294525], [1586862233.5969687, 30000, 0.5318952798843384]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-20fpv_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855674.0453596, 100, 0.6689378023147583], [1586855691.938917, 200, 0.6107555627822876], [1586855709.9282112, 300, 0.5493383407592773], [1586855727.89981, 400, 0.5189391374588013], [1586855761.241305, 500, 0.5025545358657837], [1586855793.842395, 600, 0.4824041426181793], [1586855812.0379505, 700, 0.4709351360797882], [1586855830.0309496, 800, 0.45498988032341003], [1586855848.3691447, 900, 0.4546319246292114], [1586855867.2872803, 1000, 0.41830870509147644], [1586855900.340705, 1100, 0.4192526340484619], [1586855919.112621, 1200, 0.4025101959705353], [1586855937.7943687, 1300, 0.381529301404953], [1586855956.6818528, 1400, 0.3865719139575958], [1586855975.5465157, 1500, 0.38161370158195496], [1586856009.098007, 1600, 0.38419079780578613], [1586856027.993504, 1700, 0.3636730909347534], [1586856046.8335419, 1800, 0.35213080048561096], [1586856065.681134, 1900, 0.35318470001220703], [1586856084.8278995, 2000, 0.3391469419002533], [1586856118.9103732, 2100, 0.3233693242073059], [1586856137.782057, 2200, 0.31641969084739685], [1586856156.7442918, 2300, 0.3034421503543854], [1586856175.7290635, 2400, 0.32361820340156555], [1586856194.8076034, 2500, 0.29593905806541443], [1586856227.9741566, 2600, 0.31448450684547424], [1586856247.0190501, 2700, 0.3061716854572296], [1586856265.9357839, 2800, 0.2891683280467987], [1586856284.8711784, 2900, 0.2949501872062683], [1586856304.1618922, 3000, 0.29850101470947266], [1586856337.8696856, 3100, 0.3024144768714905], [1586856356.9073308, 3200, 0.273283451795578], [1586856375.815042, 3300, 0.2689415216445923], [1586856394.8043802, 3400, 0.27038145065307617], [1586856414.0543122, 3500, 0.261894166469574], [1586856447.2710433, 3600, 0.27143314480781555], [1586856466.2946696, 3700, 0.26117822527885437], [1586856485.3486996, 3800, 0.2541874945163727], [1586856504.329294, 3900, 0.26029929518699646], [1586856523.4495955, 4000, 0.260974258184433], [1586856556.9457073, 4100, 0.2535676956176758], [1586856575.9006968, 4200, 0.24679051339626312], [1586856594.9298463, 4300, 0.24118337035179138], [1586856613.908461, 4400, 0.2492658644914627], [1586856633.241741, 4500, 0.25268569588661194], [1586856667.1395986, 4600, 0.2501015365123749], [1586856686.1086817, 4700, 0.2352289855480194], [1586856705.1835773, 4800, 0.2323204129934311], [1586856724.1519005, 4900, 0.23361344635486603], [1586856743.2660322, 5000, 0.22546757757663727], [1586856777.397244, 5100, 0.2267790585756302], [1586856796.3124163, 5200, 0.241971954703331], [1586856815.364914, 5300, 0.21301457285881042], [1586856834.4335735, 5400, 0.22203996777534485], [1586856853.6464798, 5500, 0.20989574491977692], [1586856886.306205, 5600, 0.21795032918453217], [1586856905.2741578, 5700, 0.19463570415973663], [1586856924.3302312, 5800, 0.2159663885831833], [1586856943.3360374, 5900, 0.1997552365064621], [1586856962.6466956, 6000, 0.2024051547050476], [1586856995.695945, 6100, 0.20931391417980194], [1586857014.698707, 6200, 0.20218497514724731], [1586857033.7973728, 6300, 0.22535207867622375], [1586857052.7948608, 6400, 0.19082310795783997], [1586857071.9708176, 6500, 0.21672235429286957], [1586857105.3535857, 6600, 0.209136500954628], [1586857124.447026, 6700, 0.20598581433296204], [1586857143.4919252, 6800, 0.18279042840003967], [1586857162.5189643, 6900, 0.19955405592918396], [1586857181.675699, 7000, 0.20297028124332428], [1586857214.8812163, 7100, 0.1837272197008133], [1586857234.7614589, 7200, 0.19842205941677094], [1586857253.9702218, 7300, 0.20284128189086914], [1586857273.1913397, 7400, 0.19704106450080872], [1586857292.7397704, 7500, 0.18428801000118256], [1586857326.0945358, 7600, 0.1724073588848114], [1586857345.236228, 7700, 0.18746185302734375], [1586857364.3899856, 7800, 0.17806707322597504], [1586857383.6082401, 7900, 0.17814487218856812], [1586857403.0736556, 8000, 0.18316873908042908], [1586857436.697163, 8100, 0.17405438423156738], [1586857456.0748124, 8200, 0.17579586803913116], [1586857475.2220232, 8300, 0.17304727435112], [1586857494.3352208, 8400, 0.17266732454299927], [1586857513.6329274, 8500, 0.15986138582229614], [1586857547.2710097, 8600, 0.17108823359012604], [1586857566.2728662, 8700, 0.17257371544837952], [1586857585.4003527, 8800, 0.1843077391386032], [1586857604.5582738, 8900, 0.15011383593082428], [1586857623.845588, 9000, 0.16046024858951569], [1586857656.6131809, 9100, 0.1702285259962082], [1586857675.6304262, 9200, 0.15973179042339325], [1586857694.6300354, 9300, 0.15241967141628265], [1586857713.8346012, 9400, 0.1469918042421341], [1586857733.1062193, 9500, 0.1566152274608612], [1586857765.2754128, 9600, 0.16784028708934784], [1586857784.441204, 9700, 0.15872491896152496], [1586857803.497913, 9800, 0.16640420258045197], [1586857822.6743064, 9900, 0.15516050159931183], [1586857841.9012353, 10000, 0.1574624925851822], [1586857874.3940346, 10100, 0.1511501967906952], [1586857893.6631615, 10200, 0.14914320409297943], [1586857913.0675757, 10300, 0.168007954955101], [1586857932.247682, 10400, 0.15150241553783417], [1586857951.427022, 10500, 0.14724813401699066], [1586857983.799035, 10600, 0.14776840806007385], [1586858002.9613843, 10700, 0.1372339427471161], [1586858022.229934, 10800, 0.1372455209493637], [1586858041.270987, 10900, 0.15189842879772186], [1586858060.3351283, 11000, 0.13654129207134247], [1586858093.9570327, 11100, 0.15117232501506805], [1586858113.0283048, 11200, 0.13042260706424713], [1586858132.1158035, 11300, 0.13496963679790497], [1586858151.2451377, 11400, 0.1444910317659378], [1586858170.3251882, 11500, 0.15320466458797455], [1586858203.6699607, 11600, 0.13954545557498932], [1586858222.91085, 11700, 0.1554151177406311], [1586858242.0035536, 11800, 0.15479592978954315], [1586858261.1306076, 11900, 0.138752281665802], [1586858280.3204427, 12000, 0.14863364398479462], [1586858313.070361, 12100, 0.13380727171897888], [1586858332.3974564, 12200, 0.13517233729362488], [1586858351.7080226, 12300, 0.13284118473529816], [1586858370.936233, 12400, 0.13181306421756744], [1586858390.10908, 12500, 0.13914333283901215], [1586858423.568498, 12600, 0.1453906148672104], [1586858442.8794916, 12700, 0.13813422620296478], [1586858462.101891, 12800, 0.139990895986557], [1586858481.2718742, 12900, 0.14056125283241272], [1586858500.3894274, 13000, 0.13854174315929413], [1586858533.4517481, 13100, 0.13099008798599243], [1586858552.5364385, 13200, 0.13604888319969177], [1586858571.73951, 13300, 0.1307574212551117], [1586858591.080051, 13400, 0.13960331678390503], [1586858610.2638507, 13500, 0.15037289261817932], [1586858642.6796615, 13600, 0.12671755254268646], [1586858661.733661, 13700, 0.13271711766719818], [1586858680.8192594, 13800, 0.12877225875854492], [1586858699.793604, 13900, 0.1430577039718628], [1586858718.8232677, 14000, 0.12077607214450836], [1586858752.194967, 14100, 0.14362914860248566], [1586858771.5297337, 14200, 0.13570386171340942], [1586858790.7152247, 14300, 0.13147155940532684], [1586858810.8401685, 14400, 0.07824444025754929], [1586858830.0861871, 14500, 0.1439402997493744], [1586858863.6526535, 14600, 0.14307774603366852], [1586858882.7987783, 14700, 0.13926714658737183], [1586858901.774486, 14800, 0.13976944983005524], [1586858920.951361, 14900, 0.1303594559431076], [1586858940.061264, 15000, 0.12996022403240204], [1586858973.1745846, 15100, 0.14351920783519745], [1586858992.264281, 15200, 0.11713135242462158], [1586859011.2778509, 15300, 0.1349489986896515], [1586859030.3864343, 15400, 0.12944194674491882], [1586859049.4632092, 15500, 0.12212397158145905], [1586859082.7224126, 15600, 0.12907695770263672], [1586859101.803482, 15700, 0.11850041151046753], [1586859120.8544412, 15800, 0.1283627152442932], [1586859139.9325066, 15900, 0.12625105679035187], [1586859159.0815868, 16000, 0.13795077800750732], [1586859192.1915119, 16100, 0.1190510094165802], [1586859211.1855578, 16200, 0.1320539116859436], [1586859230.2071464, 16300, 0.14148207008838654], [1586859249.2898588, 16400, 0.12554192543029785], [1586859268.3562655, 16500, 0.11865980923175812], [1586859301.5084593, 16600, 0.11539146304130554], [1586859320.4812303, 16700, 0.11892122030258179], [1586859339.5399444, 16800, 0.12574410438537598], [1586859358.687813, 16900, 0.12273101508617401], [1586859377.8981338, 17000, 0.11393486708402634], [1586859411.174957, 17100, 0.12409657984972], [1586859430.2296371, 17200, 0.12378707528114319], [1586859449.319323, 17300, 0.12019749730825424], [1586859468.4562638, 17400, 0.1249760240316391], [1586859487.5741775, 17500, 0.13602828979492188], [1586859520.523918, 17600, 0.1170240193605423], [1586859539.489132, 17700, 0.10323969274759293], [1586859558.6027277, 17800, 0.13356219232082367], [1586859577.7638304, 17900, 0.1107204407453537], [1586859596.8251972, 18000, 0.13926257193088531], [1586859630.5416052, 18100, 0.12380657345056534], [1586859649.5597806, 18200, 0.12641265988349915], [1586859668.5759199, 18300, 0.13174672424793243], [1586859687.5806856, 18400, 0.11553777009248734], [1586859706.6526701, 18500, 0.11719154566526413], [1586859740.1249166, 18600, 0.12346672266721725], [1586859759.1113887, 18700, 0.14136438071727753], [1586859778.1459808, 18800, 0.1305328756570816], [1586859797.2333114, 18900, 0.14048142731189728], [1586859816.2571778, 19000, 0.13300634920597076], [1586859849.4099474, 19100, 0.1277044713497162], [1586859868.4459994, 19200, 0.13395118713378906], [1586859887.5241983, 19300, 0.12735410034656525], [1586859906.6118784, 19400, 0.126087486743927], [1586859925.7119431, 19500, 0.12181992083787918], [1586859958.8209562, 19600, 0.12015605717897415], [1586859977.81745, 19700, 0.1313873678445816], [1586859996.8298404, 19800, 0.13033904135227203], [1586860015.8922632, 19900, 0.11558577418327332], [1586860034.948128, 20000, 0.12259286642074585], [1586860068.0316315, 20100, 0.12224408239126205], [1586860087.0200775, 20200, 0.12468031793832779], [1586860106.0448418, 20300, 0.11501694470643997], [1586860125.1381512, 20400, 0.12012293189764023], [1586860144.237642, 20500, 0.12160250544548035], [1586860177.6286716, 20600, 0.12013790011405945], [1586860196.6156461, 20700, 0.13525928556919098], [1586860215.6877372, 20800, 0.11631527543067932], [1586860234.7626252, 20900, 0.12061399966478348], [1586860253.819894, 21000, 0.1242997944355011], [1586860286.270119, 21100, 0.11695906519889832], [1586860305.4095063, 21200, 0.12759606540203094], [1586860324.4274287, 21300, 0.13108521699905396], [1586860343.5287426, 21400, 0.1310230791568756], [1586860362.5995982, 21500, 0.11978669464588165], [1586860396.1888087, 21600, 0.12505409121513367], [1586860415.3683622, 21700, 0.12642155587673187], [1586860434.3615246, 21800, 0.1299891322851181], [1586860453.4136386, 21900, 0.12629468739032745], [1586860472.487427, 22000, 0.12278160452842712], [1586860505.850069, 22100, 0.1104363352060318], [1586860524.8530672, 22200, 0.12477505207061768], [1586860543.9625878, 22300, 0.12247945368289948], [1586860563.3134851, 22400, 0.11832577735185623], [1586860582.692227, 22500, 0.11246681213378906], [1586860614.507383, 22600, 0.1120903268456459], [1586860633.6703181, 22700, 0.11590529978275299], [1586860652.886178, 22800, 0.1287021040916443], [1586860671.869816, 22900, 0.1167784109711647], [1586860690.9602447, 23000, 0.11922922730445862], [1586860723.1883106, 23100, 0.12304627150297165], [1586860742.1983263, 23200, 0.12686872482299805], [1586860761.202948, 23300, 0.10813590884208679], [1586860780.2343295, 23400, 0.1271529197692871], [1586860799.4634802, 23500, 0.11810929328203201], [1586860832.6878178, 23600, 0.11371402442455292], [1586860852.111395, 23700, 0.1083584651350975], [1586860871.514152, 23800, 0.109625443816185], [1586860890.8785903, 23900, 0.1119745597243309], [1586860910.1995041, 24000, 0.12020687758922577], [1586860943.7573957, 24100, 0.10884756594896317], [1586860962.9480886, 24200, 0.12335944175720215], [1586860982.018742, 24300, 0.11030749976634979], [1586861001.0406291, 24400, 0.10965680330991745], [1586861020.1589127, 24500, 0.11744149029254913], [1586861053.0714715, 24600, 0.11364725232124329], [1586861072.2721622, 24700, 0.13219767808914185], [1586861091.2927523, 24800, 0.10501745343208313], [1586861110.3776994, 24900, 0.09896747022867203], [1586861129.440479, 25000, 0.11832340061664581], [1586861162.5290453, 25100, 0.10837326943874359], [1586861181.824569, 25200, 0.13236746191978455], [1586861200.9574502, 25300, 0.13224346935749054], [1586861220.0792506, 25400, 0.11747921258211136], [1586861239.0762725, 25500, 0.12022114545106888], [1586861271.8248649, 25600, 0.11355996876955032], [1586861291.317091, 25700, 0.12129416316747665], [1586861310.5253878, 25800, 0.11730308830738068], [1586861329.7531776, 25900, 0.12681327760219574], [1586861348.9921844, 26000, 0.1256112903356552], [1586861381.4553223, 26100, 0.1313493698835373], [1586861400.4759593, 26200, 0.12600885331630707], [1586861419.5324042, 26300, 0.13055375218391418], [1586861438.6215198, 26400, 0.11509482562541962], [1586861457.9595132, 26500, 0.11931511759757996], [1586861490.5577078, 26600, 0.12013087421655655], [1586861509.5295317, 26700, 0.11726830154657364], [1586861528.4718485, 26800, 0.1175042986869812], [1586861547.4564877, 26900, 0.11101808398962021], [1586861566.6032093, 27000, 0.11121920496225357], [1586861599.4005396, 27100, 0.11808498203754425], [1586861618.345837, 27200, 0.1260925531387329], [1586861637.30427, 27300, 0.12139862775802612], [1586861656.3444479, 27400, 0.12078779935836792], [1586861675.4726963, 27500, 0.10449966043233871], [1586861707.8152575, 27600, 0.12088189274072647], [1586861727.0325518, 27700, 0.11528594046831131], [1586861746.2337615, 27800, 0.11749821901321411], [1586861765.3182104, 27900, 0.11569388210773468], [1586861784.4144049, 28000, 0.10918863862752914], [1586861817.2563438, 28100, 0.12358561158180237], [1586861836.616816, 28200, 0.1244993507862091], [1586861855.8394828, 28300, 0.116969995200634], [1586861874.8651807, 28400, 0.11636990308761597], [1586861893.998255, 28500, 0.12764553725719452], [1586861926.723509, 28600, 0.1121932864189148], [1586861945.7915597, 28700, 0.11816247552633286], [1586861965.5874355, 28800, 0.0530577190220356], [1586861984.5880756, 28900, 0.1197882741689682], [1586862003.6323063, 29000, 0.1222466230392456], [1586862036.289604, 29100, 0.12046028673648834], [1586862055.239236, 29200, 0.10371603071689606], [1586862074.3011901, 29300, 0.11310578882694244], [1586862093.364688, 29400, 0.11973247677087784], [1586862112.4824655, 29500, 0.12334425002336502], [1586862145.0388253, 29600, 0.10672169178724289], [1586862164.0471473, 29700, 0.11425574868917465], [1586862183.0184293, 29800, 0.11745931208133698], [1586862202.0004673, 29900, 0.10932860523462296], [1586862221.0449495, 30000, 0.11841828376054764]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-20fpv_face-scale_size-224_seed-41-tag-val_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855775.8557951, 500, 0.5778964161872864], [1586855882.2270699, 1000, 0.48044973611831665], [1586855990.9238691, 1500, 0.4082011282444], [1586856100.4503524, 2000, 0.3898944556713104], [1586856209.4122465, 2500, 0.37750717997550964], [1586856319.2600608, 3000, 0.35560381412506104], [1586856429.092093, 3500, 0.3569175601005554], [1586856538.7153761, 4000, 0.3618544936180115], [1586856648.4001503, 4500, 0.3503607511520386], [1586856758.5608032, 5000, 0.3482261300086975], [1586856867.940505, 5500, 0.3896509110927582], [1586856977.2892702, 6000, 0.34868621826171875], [1586857086.9646688, 6500, 0.381022185087204], [1586857196.5257916, 7000, 0.36974915862083435], [1586857307.7613614, 7500, 0.3897288143634796], [1586857418.3523166, 8000, 0.35867032408714294], [1586857528.871653, 8500, 0.4058694839477539], [1586857638.2826447, 9000, 0.40258005261421204], [1586857746.7587266, 9500, 0.39488014578819275], [1586857855.992515, 10000, 0.3881348669528961], [1586857965.4831638, 10500, 0.4007956087589264], [1586858075.624862, 11000, 0.4092068374156952], [1586858185.1861708, 11500, 0.4068318009376526], [1586858294.619856, 12000, 0.3954068720340729], [1586858405.0963855, 12500, 0.40605059266090393], [1586858515.0673122, 13000, 0.4004673361778259], [1586858624.3262024, 13500, 0.3912167251110077], [1586858733.817722, 14000, 0.3806549608707428], [1586858845.2616293, 14500, 0.4346628785133362], [1586858954.7578707, 15000, 0.38081157207489014], [1586859064.4998467, 15500, 0.4047519564628601], [1586859173.797761, 16000, 0.42552614212036133], [1586859282.9936345, 16500, 0.41284048557281494], [1586859392.7332404, 17000, 0.4207478165626526], [1586859502.179908, 17500, 0.45005643367767334], [1586859612.2501173, 18000, 0.44060197472572327], [1586859721.8159592, 18500, 0.43932393193244934], [1586859831.024668, 19000, 0.4519451856613159], [1586859940.4768553, 19500, 0.43067091703414917], [1586860049.680183, 20000, 0.43502914905548096], [1586860159.4326365, 20500, 0.41381752490997314], [1586860267.7798584, 21000, 0.4218950569629669], [1586860377.0449536, 21500, 0.44038522243499756], [1586860487.4818883, 22000, 0.4162255525588989], [1586860596.104703, 22500, 0.4559796154499054], [1586860704.8132432, 23000, 0.4502471387386322], [1586860814.2651405, 23500, 0.4562265872955322], [1586860925.348771, 24000, 0.4555385410785675], [1586861034.6899283, 24500, 0.443935751914978], [1586861144.2058988, 25000, 0.47654345631599426], [1586861253.359936, 25500, 0.4373420476913452], [1586861363.1231637, 26000, 0.4290979504585266], [1586861472.2106297, 26500, 0.4541664719581604], [1586861581.0372252, 27000, 0.4489728510379791], [1586861689.469308, 27500, 0.4489481449127197], [1586861798.9762192, 28000, 0.4431540369987488], [1586861908.390907, 28500, 0.4587632119655609], [1586862017.8407514, 29000, 0.45218345522880554], [1586862126.6904542, 29500, 0.47008731961250305], [1586862234.5690246, 30000, 0.446884423494339]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-25fpv_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855707.1929584, 100, 0.6670323610305786], [1586855725.1515539, 200, 0.6073428392410278], [1586855757.1587107, 300, 0.5669837594032288], [1586855775.454563, 400, 0.5168543457984924], [1586855793.6636982, 500, 0.5073946714401245], [1586855827.065484, 600, 0.4894692003726959], [1586855846.263438, 700, 0.4526776075363159], [1586855865.8215303, 800, 0.46164077520370483], [1586855885.495052, 900, 0.44908615946769714], [1586855904.6765656, 1000, 0.4173235297203064], [1586855938.1344812, 1100, 0.418955534696579], [1586855957.3241198, 1200, 0.4012276828289032], [1586855976.6553936, 1300, 0.4003244638442993], [1586855996.3115628, 1400, 0.3754394054412842], [1586856015.487669, 1500, 0.36456817388534546], [1586856049.3170831, 1600, 0.36474892497062683], [1586856068.538994, 1700, 0.35600489377975464], [1586856087.971784, 1800, 0.36170685291290283], [1586856107.4545808, 1900, 0.35219448804855347], [1586856126.6247566, 2000, 0.3411204218864441], [1586856159.6875157, 2100, 0.32451730966567993], [1586856178.9337013, 2200, 0.3371076285839081], [1586856198.2985315, 2300, 0.33300524950027466], [1586856217.619143, 2400, 0.3025280833244324], [1586856236.7588556, 2500, 0.3238442540168762], [1586856269.9659486, 2600, 0.30254024267196655], [1586856289.191826, 2700, 0.3138841390609741], [1586856308.6195269, 2800, 0.2939143180847168], [1586856327.981522, 2900, 0.2844482362270355], [1586856347.0945752, 3000, 0.2895781099796295], [1586856380.4847999, 3100, 0.3057323694229126], [1586856399.640807, 3200, 0.2578260898590088], [1586856419.0711236, 3300, 0.29101377725601196], [1586856438.5156164, 3400, 0.28522488474845886], [1586856457.671142, 3500, 0.27637603878974915], [1586856490.4511778, 3600, 0.27586913108825684], [1586856509.6571982, 3700, 0.25911837816238403], [1586856529.051557, 3800, 0.26774483919143677], [1586856548.508477, 3900, 0.26344892382621765], [1586856567.5921211, 4000, 0.2650032341480255], [1586856600.1070144, 4100, 0.24431195855140686], [1586856619.2839158, 4200, 0.26751333475112915], [1586856638.63077, 4300, 0.2415207475423813], [1586856658.0615232, 4400, 0.2559918463230133], [1586856677.1987603, 4500, 0.2532716393470764], [1586856711.184715, 4600, 0.24037913978099823], [1586856730.394477, 4700, 0.23411567509174347], [1586856749.6774623, 4800, 0.2337074726819992], [1586856769.000981, 4900, 0.23669175803661346], [1586856788.1417608, 5000, 0.2249578982591629], [1586856820.2587268, 5100, 0.23239655792713165], [1586856839.479691, 5200, 0.22993476688861847], [1586856858.7253973, 5300, 0.22061914205551147], [1586856878.0815253, 5400, 0.22212843596935272], [1586856897.3199372, 5500, 0.227071613073349], [1586856930.5966306, 5600, 0.22468337416648865], [1586856949.8586268, 5700, 0.2340378612279892], [1586856969.1725414, 5800, 0.21802429854869843], [1586856988.3666966, 5900, 0.2188486009836197], [1586857007.4613445, 6000, 0.21870484948158264], [1586857040.2027767, 6100, 0.22081518173217773], [1586857059.2890532, 6200, 0.19493737816810608], [1586857078.5521266, 6300, 0.21106742322444916], [1586857097.890813, 6400, 0.21005229651927948], [1586857117.0142586, 6500, 0.21381065249443054], [1586857149.7556038, 6600, 0.21875138580799103], [1586857168.9062746, 6700, 0.19614262878894806], [1586857188.2012544, 6800, 0.19951076805591583], [1586857207.5096672, 6900, 0.20129647850990295], [1586857226.6461644, 7000, 0.1942882388830185], [1586857259.6079383, 7100, 0.20874246954917908], [1586857278.8989155, 7200, 0.18934062123298645], [1586857298.3298147, 7300, 0.1815086454153061], [1586857317.6723218, 7400, 0.1992737501859665], [1586857336.7881577, 7500, 0.19325301051139832], [1586857369.8782473, 7600, 0.1923733800649643], [1586857389.0922372, 7700, 0.2037668228149414], [1586857408.436148, 7800, 0.19047334790229797], [1586857427.8732853, 7900, 0.18434152007102966], [1586857446.9416423, 8000, 0.18288424611091614], [1586857480.2493353, 8100, 0.18087242543697357], [1586857499.5787911, 8200, 0.18413324654102325], [1586857518.9357145, 8300, 0.17587623000144958], [1586857538.3447776, 8400, 0.17954955995082855], [1586857557.3890824, 8500, 0.18601833283901215], [1586857589.9791818, 8600, 0.1775020807981491], [1586857609.3614295, 8700, 0.17106837034225464], [1586857628.660625, 8800, 0.18946079909801483], [1586857647.9877067, 8900, 0.17460760474205017], [1586857667.930151, 9000, 0.07729468494653702], [1586857700.956938, 9100, 0.17870981991291046], [1586857720.1838799, 9200, 0.16879181563854218], [1586857739.4350703, 9300, 0.18759843707084656], [1586857758.687351, 9400, 0.16203157603740692], [1586857777.7808359, 9500, 0.15499600768089294], [1586857811.4583778, 9600, 0.1660270094871521], [1586857830.8495972, 9700, 0.16119925677776337], [1586857850.1445658, 9800, 0.18219561874866486], [1586857869.311432, 9900, 0.164921835064888], [1586857888.3612854, 10000, 0.1637100726366043], [1586857921.9080994, 10100, 0.1688186228275299], [1586857941.0918093, 10200, 0.1685078740119934], [1586857960.505167, 10300, 0.17205964028835297], [1586857979.5906086, 10400, 0.14536406099796295], [1586857998.6094792, 10500, 0.15025529265403748], [1586858030.652663, 10600, 0.13858266174793243], [1586858049.8376575, 10700, 0.16047348082065582], [1586858069.0192597, 10800, 0.15662680566310883], [1586858088.190437, 10900, 0.15340539813041687], [1586858107.2310755, 11000, 0.1442766636610031], [1586858140.2446704, 11100, 0.15160329639911652], [1586858159.616379, 11200, 0.15502604842185974], [1586858179.0476003, 11300, 0.14115475118160248], [1586858198.2352185, 11400, 0.14559757709503174], [1586858217.2803895, 11500, 0.1518796682357788], [1586858250.809927, 11600, 0.14899760484695435], [1586858269.912122, 11700, 0.1487269550561905], [1586858289.2951415, 11800, 0.14337119460105896], [1586858308.4232693, 11900, 0.1596072018146515], [1586858327.502551, 12000, 0.14803186058998108], [1586858359.7144015, 12100, 0.1544763445854187], [1586858378.9532738, 12200, 0.13290007412433624], [1586858398.1300306, 12300, 0.14777523279190063], [1586858417.3777142, 12400, 0.14121028780937195], [1586858436.521951, 12500, 0.13533049821853638], [1586858469.5794427, 12600, 0.15017971396446228], [1586858488.7805583, 12700, 0.1393531709909439], [1586858507.9709954, 12800, 0.1513891965150833], [1586858527.1588612, 12900, 0.14312827587127686], [1586858546.1982064, 13000, 0.1510838270187378], [1586858579.041891, 13100, 0.14708632230758667], [1586858598.1906748, 13200, 0.15786080062389374], [1586858617.3163688, 13300, 0.14199265837669373], [1586858636.4434109, 13400, 0.16207848489284515], [1586858655.551788, 13500, 0.15235580503940582], [1586858688.5513372, 13600, 0.14045172929763794], [1586858707.5728238, 13700, 0.14127697050571442], [1586858726.7875397, 13800, 0.14192411303520203], [1586858746.0612557, 13900, 0.13480506837368011], [1586858765.1171975, 14000, 0.147608682513237], [1586858797.4682963, 14100, 0.14200840890407562], [1586858816.7086825, 14200, 0.13598379492759705], [1586858836.1055741, 14300, 0.1450304388999939], [1586858855.4243612, 14400, 0.14453913271427155], [1586858874.5479205, 14500, 0.14022241532802582], [1586858907.548986, 14600, 0.14784900844097137], [1586858926.873633, 14700, 0.15303082764148712], [1586858946.157179, 14800, 0.14289560914039612], [1586858965.3875964, 14900, 0.14284273982048035], [1586858984.5003383, 15000, 0.13956163823604584], [1586859017.6558218, 15100, 0.14368893206119537], [1586859036.889581, 15200, 0.13061979413032532], [1586859056.284109, 15300, 0.14829114079475403], [1586859075.4770763, 15400, 0.14069627225399017], [1586859094.6068091, 15500, 0.14508883655071259], [1586859127.8660688, 15600, 0.15201258659362793], [1586859147.0749166, 15700, 0.13479872047901154], [1586859166.412728, 15800, 0.1370956152677536], [1586859185.6590142, 15900, 0.13006334006786346], [1586859204.791982, 16000, 0.13930252194404602], [1586859236.6324954, 16100, 0.1354505717754364], [1586859255.8394973, 16200, 0.12885227799415588], [1586859275.0803604, 16300, 0.12992523610591888], [1586859294.327267, 16400, 0.13760201632976532], [1586859313.3765903, 16500, 0.13406610488891602], [1586859346.4915643, 16600, 0.13842643797397614], [1586859365.7353845, 16700, 0.1430473029613495], [1586859384.9798095, 16800, 0.1262475848197937], [1586859404.2263558, 16900, 0.13605833053588867], [1586859423.3220959, 17000, 0.13914847373962402], [1586859456.491451, 17100, 0.13970845937728882], [1586859475.771417, 17200, 0.14023847877979279], [1586859495.0936086, 17300, 0.13942228257656097], [1586859514.3145905, 17400, 0.1385488063097], [1586859533.316198, 17500, 0.13280755281448364], [1586859565.8005702, 17600, 0.12288782745599747], [1586859585.1214414, 17700, 0.1344289481639862], [1586859604.4177978, 17800, 0.13590456545352936], [1586859623.7318275, 17900, 0.13153283298015594], [1586859643.6331553, 18000, 0.041664835065603256], [1586859675.7836988, 18100, 0.14135049283504486], [1586859694.904731, 18200, 0.13119032979011536], [1586859714.2135096, 18300, 0.13987281918525696], [1586859733.4383297, 18400, 0.13145041465759277], [1586859752.4680028, 18500, 0.13747861981391907], [1586859784.8292658, 18600, 0.12018927931785583], [1586859804.0875418, 18700, 0.13166244328022003], [1586859823.366154, 18800, 0.13742512464523315], [1586859842.556417, 18900, 0.12844403088092804], [1586859861.625244, 19000, 0.12397259473800659], [1586859893.3123906, 19100, 0.152030348777771], [1586859912.5858355, 19200, 0.1452842652797699], [1586859931.8651648, 19300, 0.14470122754573822], [1586859951.152106, 19400, 0.1442878544330597], [1586859970.214393, 19500, 0.1304394006729126], [1586860002.2054079, 19600, 0.13768459856510162], [1586860021.4960203, 19700, 0.14927029609680176], [1586860040.7542732, 19800, 0.13234512507915497], [1586860060.0298347, 19900, 0.12799948453903198], [1586860079.0409648, 20000, 0.13746105134487152], [1586860110.8656988, 20100, 0.12908868491649628], [1586860130.1161942, 20200, 0.1343086212873459], [1586860149.3562853, 20300, 0.14050191640853882], [1586860168.630435, 20400, 0.13110393285751343], [1586860187.7481456, 20500, 0.14150716364383698], [1586860220.1084826, 20600, 0.13450898230075836], [1586860239.4301932, 20700, 0.132687047123909], [1586860258.6625192, 20800, 0.14286015927791595], [1586860277.7901838, 20900, 0.1333366483449936], [1586860296.916911, 21000, 0.13626061379909515], [1586860330.1037805, 21100, 0.1422240138053894], [1586860349.4379883, 21200, 0.12579716742038727], [1586860368.825054, 21300, 0.13947626948356628], [1586860388.087212, 21400, 0.13979056477546692], [1586860407.1353054, 21500, 0.12961839139461517], [1586860439.1629188, 21600, 0.1272619664669037], [1586860458.552872, 21700, 0.14011800289154053], [1586860478.098717, 21800, 0.1347445547580719], [1586860497.4423244, 21900, 0.1358145922422409], [1586860516.5056448, 22000, 0.12991905212402344], [1586860548.6215653, 22100, 0.12486741691827774], [1586860567.8254035, 22200, 0.13446448743343353], [1586860587.324339, 22300, 0.13005393743515015], [1586860606.5135572, 22400, 0.12570437788963318], [1586860625.5312934, 22500, 0.13978035748004913], [1586860658.2787857, 22600, 0.11998121440410614], [1586860677.3378124, 22700, 0.1355278491973877], [1586860696.6790636, 22800, 0.13440446555614471], [1586860715.8750436, 22900, 0.1236175000667572], [1586860734.9865155, 23000, 0.1302473098039627], [1586860767.9134252, 23100, 0.12666572630405426], [1586860787.0914094, 23200, 0.1289711594581604], [1586860806.4778082, 23300, 0.13042989373207092], [1586860825.7746432, 23400, 0.12517760694026947], [1586860844.8773847, 23500, 0.13371315598487854], [1586860876.7334816, 23600, 0.13252532482147217], [1586860895.822252, 23700, 0.12764285504817963], [1586860915.1617358, 23800, 0.13801828026771545], [1586860934.488956, 23900, 0.13763754069805145], [1586860953.5931356, 24000, 0.13739898800849915], [1586860986.3570983, 24100, 0.12976744771003723], [1586861005.4485397, 24200, 0.11277599632740021], [1586861024.7783167, 24300, 0.12759818136692047], [1586861044.113313, 24400, 0.1400662660598755], [1586861063.1789258, 24500, 0.12917178869247437], [1586861096.596682, 24600, 0.13442647457122803], [1586861115.804846, 24700, 0.12228554487228394], [1586861135.159792, 24800, 0.11972235143184662], [1586861154.541493, 24900, 0.12365545332431793], [1586861173.6478407, 25000, 0.13240794837474823], [1586861205.6123853, 25100, 0.13482995331287384], [1586861224.656287, 25200, 0.12682130932807922], [1586861243.8503268, 25300, 0.12145692855119705], [1586861263.1885858, 25400, 0.12125034630298615], [1586861282.4040196, 25500, 0.13062569499015808], [1586861314.2625146, 25600, 0.1429438441991806], [1586861333.3919384, 25700, 0.1250024437904358], [1586861352.5315092, 25800, 0.1206599622964859], [1586861371.8526173, 25900, 0.13344231247901917], [1586861390.9533246, 26000, 0.13156792521476746], [1586861423.0711617, 26100, 0.12299802899360657], [1586861442.2611911, 26200, 0.12427709996700287], [1586861461.5690734, 26300, 0.12305232137441635], [1586861480.999199, 26400, 0.13232140243053436], [1586861500.0613751, 26500, 0.11699166893959045], [1586861532.2032256, 26600, 0.12407336384057999], [1586861551.3331044, 26700, 0.12705634534358978], [1586861570.6751337, 26800, 0.11428047716617584], [1586861590.071945, 26900, 0.13160310685634613], [1586861609.9458897, 27000, 0.08591680973768234], [1586861642.2472742, 27100, 0.12148182094097137], [1586861661.4930093, 27200, 0.12286071479320526], [1586861680.8092291, 27300, 0.13739252090454102], [1586861700.1299856, 27400, 0.12424219399690628], [1586861719.3393064, 27500, 0.12812520563602448], [1586861751.9511747, 27600, 0.11164544522762299], [1586861771.0861871, 27700, 0.12320773303508759], [1586861790.334024, 27800, 0.13418538868427277], [1586861809.6373527, 27900, 0.11745444685220718], [1586861828.778417, 28000, 0.11859159171581268], [1586861860.7955794, 28100, 0.12957847118377686], [1586861880.0439854, 28200, 0.14370957016944885], [1586861899.2612014, 28300, 0.12645435333251953], [1586861918.5851989, 28400, 0.13028471171855927], [1586861937.730245, 28500, 0.1194283664226532], [1586861971.277431, 28600, 0.1152660995721817], [1586861990.4778755, 28700, 0.13234643638134003], [1586862009.741905, 28800, 0.12384767830371857], [1586862029.0616467, 28900, 0.12488479912281036], [1586862048.1833224, 29000, 0.12750385701656342], [1586862080.2633052, 29100, 0.12658946216106415], [1586862099.5571532, 29200, 0.11324373632669449], [1586862118.8222725, 29300, 0.1216115728020668], [1586862138.393802, 29400, 0.1270122528076172], [1586862157.601392, 29500, 0.13382716476917267], [1586862190.2642326, 29600, 0.13423964381217957], [1586862209.3965137, 29700, 0.13314853608608246], [1586862228.6718106, 29800, 0.12652842700481415], [1586862247.7370706, 29900, 0.12713021039962769], [1586862266.6732419, 30000, 0.12242063134908676]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-25fpv_face-scale_size-224_seed-41-tag-val_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855807.9591007, 500, 0.5905227661132812], [1586855918.891428, 1000, 0.4918867349624634], [1586856030.1207788, 1500, 0.4350816011428833], [1586856140.4614258, 2000, 0.38425150513648987], [1586856251.311468, 2500, 0.39279696345329285], [1586856361.3644817, 3000, 0.35304951667785645], [1586856471.8265078, 3500, 0.35695695877075195], [1586856581.5402455, 4000, 0.3556879162788391], [1586856691.9760747, 4500, 0.33643004298210144], [1586856801.5637383, 5000, 0.3622913062572479], [1586856912.0307345, 5500, 0.352449506521225], [1586857021.5586863, 6000, 0.3711947798728943], [1586857131.1635804, 6500, 0.343915730714798], [1586857240.9968934, 7000, 0.3788536787033081], [1586857351.249174, 7500, 0.38432398438453674], [1586857461.6701148, 8000, 0.36840569972991943], [1586857571.3622937, 8500, 0.35773390531539917], [1586857682.3381684, 9000, 0.3546483814716339], [1586857792.7888002, 9500, 0.35175925493240356], [1586857903.2620554, 10000, 0.4041927754878998], [1586858012.1165302, 10500, 0.3717148005962372], [1586858121.6412816, 11000, 0.3922985792160034], [1586858232.23171, 11500, 0.38240137696266174], [1586858341.202469, 12000, 0.40011289715766907], [1586858451.0557885, 12500, 0.41178175806999207], [1586858560.4927278, 13000, 0.3803437352180481], [1586858669.9901485, 13500, 0.3892858624458313], [1586858778.8958323, 14000, 0.40761691331863403], [1586858888.8682115, 14500, 0.4369082450866699], [1586858998.9537964, 15000, 0.4185245633125305], [1586859109.248676, 15500, 0.4092117249965668], [1586859218.063019, 16000, 0.41359999775886536], [1586859327.8629017, 16500, 0.43164193630218506], [1586859437.948353, 17000, 0.4101063907146454], [1586859547.191915, 17500, 0.39674556255340576], [1586859657.225059, 18000, 0.39659416675567627], [1586859766.2568717, 18500, 0.4043714702129364], [1586859874.7143607, 19000, 0.4252428114414215], [1586859983.6342542, 19500, 0.3839946389198303], [1586860092.3335, 20000, 0.39556214213371277], [1586860201.448352, 20500, 0.4075556695461273], [1586860311.4948728, 21000, 0.432273268699646], [1586860420.602962, 21500, 0.4153117537498474], [1586860530.017141, 22000, 0.4034089744091034], [1586860639.682502, 22500, 0.41821250319480896], [1586860749.3352728, 23000, 0.4361543357372284], [1586860858.1690567, 23500, 0.4455791115760803], [1586860967.8247676, 24000, 0.41060471534729004], [1586861077.9378216, 24500, 0.41746625304222107], [1586861186.988053, 25000, 0.4396001696586609], [1586861295.6641572, 25500, 0.432498574256897], [1586861404.4472184, 26000, 0.4404381811618805], [1586861513.619814, 26500, 0.4074838161468506], [1586861623.5295334, 27000, 0.41573458909988403], [1586861733.2644699, 27500, 0.41902831196784973], [1586861842.069487, 28000, 0.43002718687057495], [1586861952.679829, 28500, 0.40306317806243896], [1586862061.5849311, 29000, 0.42201390862464905], [1586862171.6412728, 29500, 0.4244748651981354], [1586862282.669218, 30000, 0.46063438057899475]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-5fpv_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855652.7019498, 100, 0.6660281419754028], [1586855670.489121, 200, 0.6039867997169495], [1586855688.4115245, 300, 0.5533597469329834], [1586855706.2566137, 400, 0.5235105156898499], [1586855724.144153, 500, 0.5024144649505615], [1586855771.812505, 600, 0.4714723229408264], [1586855789.7797961, 700, 0.45171356201171875], [1586855807.7200887, 800, 0.44148147106170654], [1586855825.8977976, 900, 0.43220043182373047], [1586855844.6896574, 1000, 0.4117804169654846], [1586855878.9222672, 1100, 0.39895933866500854], [1586855897.784555, 1200, 0.4012427031993866], [1586855916.6342351, 1300, 0.38803306221961975], [1586855935.510049, 1400, 0.3527282476425171], [1586855954.3268807, 1500, 0.3433528542518616], [1586855987.0478969, 1600, 0.3339499235153198], [1586856006.0091715, 1700, 0.3338997960090637], [1586856025.7671864, 1800, 0.21169136464595795], [1586856044.42894, 1900, 0.3180809020996094], [1586856063.2856283, 2000, 0.312990665435791], [1586856097.1226442, 2100, 0.3043045699596405], [1586856116.079118, 2200, 0.2933354079723358], [1586856135.0510182, 2300, 0.2954180836677551], [1586856154.0230787, 2400, 0.2701106369495392], [1586856173.0353615, 2500, 0.25774919986724854], [1586856206.4657116, 2600, 0.2721402049064636], [1586856225.3599005, 2700, 0.27323031425476074], [1586856244.374084, 2800, 0.2519969344139099], [1586856263.2871435, 2900, 0.23893308639526367], [1586856282.2881188, 3000, 0.24980059266090393], [1586856316.2139585, 3100, 0.2573058009147644], [1586856335.2099423, 3200, 0.23116163909435272], [1586856354.2331364, 3300, 0.22660696506500244], [1586856373.2492392, 3400, 0.22216518223285675], [1586856392.249852, 3500, 0.2204383909702301], [1586856426.203664, 3600, 0.07373398542404175], [1586856445.0764785, 3700, 0.21421444416046143], [1586856464.0857296, 3800, 0.2200569212436676], [1586856483.1303473, 3900, 0.20810143649578094], [1586856502.390513, 4000, 0.20173007249832153], [1586856535.8767016, 4100, 0.19814379513263702], [1586856554.8868175, 4200, 0.1881616860628128], [1586856573.8817132, 4300, 0.18655186891555786], [1586856592.8647501, 4400, 0.18909703195095062], [1586856611.8766475, 4500, 0.1796070784330368], [1586856644.7316847, 4600, 0.17510053515434265], [1586856663.7386072, 4700, 0.17412827908992767], [1586856682.6583776, 4800, 0.17908866703510284], [1586856701.6835134, 4900, 0.169215589761734], [1586856720.7204328, 5000, 0.15705981850624084], [1586856753.8212528, 5100, 0.14666053652763367], [1586856772.8197157, 5200, 0.16531194746494293], [1586856791.9086099, 5300, 0.1509065330028534], [1586856811.7258103, 5400, 0.036344435065984726], [1586856830.7759774, 5500, 0.1627713292837143], [1586856863.4739969, 5600, 0.16699667274951935], [1586856882.5466208, 5700, 0.15633489191532135], [1586856901.629063, 5800, 0.1472928524017334], [1586856920.7384589, 5900, 0.14393185079097748], [1586856939.7323313, 6000, 0.14697404205799103], [1586856973.2667162, 6100, 0.12570524215698242], [1586856992.3425307, 6200, 0.13821639120578766], [1586857011.3563952, 6300, 0.1347944140434265], [1586857030.4027972, 6400, 0.13061165809631348], [1586857049.4398074, 6500, 0.13299117982387543], [1586857081.9641328, 6600, 0.13867786526679993], [1586857101.0675578, 6700, 0.12821611762046814], [1586857120.109005, 6800, 0.12288491427898407], [1586857139.1325793, 6900, 0.11516162008047104], [1586857158.1511502, 7000, 0.1324666291475296], [1586857190.7444751, 7100, 0.1087653860449791], [1586857210.6417491, 7200, 0.010366956703364849], [1586857229.651833, 7300, 0.12055037170648575], [1586857248.7171838, 7400, 0.1173388883471489], [1586857267.661539, 7500, 0.11745002120733261], [1586857300.8777847, 7600, 0.1163025051355362], [1586857319.913263, 7700, 0.11704010516405106], [1586857338.9667063, 7800, 0.12077844142913818], [1586857358.099906, 7900, 0.1174439936876297], [1586857377.124998, 8000, 0.12050821632146835], [1586857410.1057646, 8100, 0.11628511548042297], [1586857429.2135198, 8200, 0.10778135806322098], [1586857448.2608948, 8300, 0.10351566970348358], [1586857467.328692, 8400, 0.10961493104696274], [1586857486.3632333, 8500, 0.09957525879144669], [1586857519.5435648, 8600, 0.09545732289552689], [1586857538.5326843, 8700, 0.10090408474206924], [1586857557.6336267, 8800, 0.09094025939702988], [1586857576.75967, 8900, 0.09969981759786606], [1586857596.5842743, 9000, 0.0072077251970767975], [1586857629.523201, 9100, 0.10288936644792557], [1586857648.5833158, 9200, 0.0873849019408226], [1586857667.7120674, 9300, 0.09745907038450241], [1586857686.7237763, 9400, 0.08822987973690033], [1586857705.8092573, 9500, 0.08682366460561752], [1586857739.110778, 9600, 0.0812554806470871], [1586857758.118008, 9700, 0.09014364331960678], [1586857777.130929, 9800, 0.08551830053329468], [1586857796.152326, 9900, 0.07732337713241577], [1586857815.1571686, 10000, 0.08205904811620712], [1586857848.3865607, 10100, 0.07146231830120087], [1586857867.4233015, 10200, 0.07841034233570099], [1586857886.436226, 10300, 0.07579020410776138], [1586857905.4479156, 10400, 0.09185347706079483], [1586857924.4216375, 10500, 0.08048888295888901], [1586857957.0696435, 10600, 0.08866884559392929], [1586857976.2111607, 10700, 0.08613671362400055], [1586857996.0122685, 10800, 0.005873534828424454], [1586858015.0723417, 10900, 0.09216534346342087], [1586858034.120194, 11000, 0.08032717555761337], [1586858067.1030617, 11100, 0.08848869055509567], [1586858086.1935744, 11200, 0.08511132001876831], [1586858105.1964474, 11300, 0.08510811626911163], [1586858124.1997967, 11400, 0.07837505638599396], [1586858143.2381494, 11500, 0.07763856649398804], [1586858176.0071585, 11600, 0.09078367054462433], [1586858195.0528665, 11700, 0.07991776615381241], [1586858213.99398, 11800, 0.0805281326174736], [1586858232.9727445, 11900, 0.07424978911876678], [1586858251.9501064, 12000, 0.0757230743765831], [1586858284.6291177, 12100, 0.09017395973205566], [1586858303.6759942, 12200, 0.0770936980843544], [1586858322.691353, 12300, 0.08021289855241776], [1586858341.660836, 12400, 0.08617524057626724], [1586858360.6512232, 12500, 0.07055335491895676], [1586858394.8622353, 12600, 0.032777417451143265], [1586858413.9576511, 12700, 0.0831356793642044], [1586858432.9909878, 12800, 0.08812765777111053], [1586858452.008197, 12900, 0.08975972980260849], [1586858471.0761633, 13000, 0.0840878114104271], [1586858504.4574711, 13100, 0.08271250873804092], [1586858523.5005527, 13200, 0.07654879242181778], [1586858542.5104141, 13300, 0.06677525490522385], [1586858561.4989598, 13400, 0.08507372438907623], [1586858580.4790044, 13500, 0.08267264813184738], [1586858613.5448537, 13600, 0.07169903069734573], [1586858632.678573, 13700, 0.07408088445663452], [1586858651.6957045, 13800, 0.07572650164365768], [1586858670.747381, 13900, 0.0751478523015976], [1586858690.096669, 14000, 0.08028675615787506], [1586858721.8925307, 14100, 0.0793251171708107], [1586858740.95915, 14200, 0.078785739839077], [1586858760.058768, 14300, 0.0726969763636589], [1586858779.9277864, 14400, 0.018151573836803436], [1586858798.9781036, 14500, 0.08861086517572403], [1586858832.3727758, 14600, 0.08063532412052155], [1586858851.4273884, 14700, 0.07369610667228699], [1586858870.4261591, 14800, 0.08479999750852585], [1586858889.4429305, 14900, 0.07615622133016586], [1586858908.461711, 15000, 0.07028543204069138], [1586858941.826062, 15100, 0.06411586701869965], [1586858960.8570094, 15200, 0.07726272940635681], [1586858979.887006, 15300, 0.07487080991268158], [1586858998.943267, 15400, 0.07927336543798447], [1586859017.9799132, 15500, 0.06799494475126266], [1586859050.8642533, 15600, 0.06469827145338058], [1586859069.884495, 15700, 0.07257980853319168], [1586859088.890639, 15800, 0.07897412031888962], [1586859107.799398, 15900, 0.07024428993463516], [1586859126.852476, 16000, 0.07844015955924988], [1586859159.7028255, 16100, 0.07716026902198792], [1586859179.8694243, 16200, 0.008359777741134167], [1586859198.8923397, 16300, 0.08179614692926407], [1586859217.960337, 16400, 0.07395618408918381], [1586859236.9613843, 16500, 0.08055543154478073], [1586859269.1842086, 16600, 0.07424943894147873], [1586859288.3283703, 16700, 0.07085683941841125], [1586859307.3646352, 16800, 0.07507622987031937], [1586859326.4829054, 16900, 0.07525230199098587], [1586859345.5189533, 17000, 0.0719093605875969], [1586859378.147216, 17100, 0.07260307669639587], [1586859397.2377062, 17200, 0.07109034061431885], [1586859416.2676036, 17300, 0.0688302293419838], [1586859435.3439286, 17400, 0.07073920220136642], [1586859454.4033816, 17500, 0.059067945927381516], [1586859486.825671, 17600, 0.07088471949100494], [1586859505.8781466, 17700, 0.06738130003213882], [1586859524.9169717, 17800, 0.07926034182310104], [1586859544.0370216, 17900, 0.06769134849309921], [1586859563.8444586, 18000, 0.01102970726788044], [1586859596.66243, 18100, 0.07853139191865921], [1586859615.7799356, 18200, 0.07021501660346985], [1586859634.8556645, 18300, 0.0721622183918953], [1586859653.8870723, 18400, 0.07697831839323044], [1586859673.044721, 18500, 0.0712013766169548], [1586859705.3959544, 18600, 0.06846314668655396], [1586859724.447794, 18700, 0.07435009628534317], [1586859743.532955, 18800, 0.06888449937105179], [1586859762.6064632, 18900, 0.07264957576990128], [1586859781.5875933, 19000, 0.06893286108970642], [1586859813.7648313, 19100, 0.061876557767391205], [1586859832.7212217, 19200, 0.05904683470726013], [1586859851.7872155, 19300, 0.07114889472723007], [1586859870.8389041, 19400, 0.06704016774892807], [1586859889.8903813, 19500, 0.06459565460681915], [1586859921.9101305, 19600, 0.07686758786439896], [1586859941.1630356, 19700, 0.06692355871200562], [1586859961.0724518, 19800, 0.008776340633630753], [1586859980.1447458, 19900, 0.06903082877397537], [1586859999.2106388, 20000, 0.07014979422092438], [1586860031.3131075, 20100, 0.08317212015390396], [1586860050.4116862, 20200, 0.07308129966259003], [1586860069.5193775, 20300, 0.06761366128921509], [1586860088.5252337, 20400, 0.06799304485321045], [1586860107.6231663, 20500, 0.07850020378828049], [1586860139.6809726, 20600, 0.06950195133686066], [1586860158.7760234, 20700, 0.06716048717498779], [1586860177.8466516, 20800, 0.060763463377952576], [1586860196.970385, 20900, 0.06341919302940369], [1586860216.0636234, 21000, 0.056508421897888184], [1586860248.583246, 21100, 0.05818498879671097], [1586860267.729691, 21200, 0.06758993864059448], [1586860286.8110418, 21300, 0.05694495141506195], [1586860305.9713209, 21400, 0.06912652403116226], [1586860325.078738, 21500, 0.06346183270215988], [1586860358.208931, 21600, 0.0156669020652771], [1586860377.2726665, 21700, 0.07723292708396912], [1586860396.2551284, 21800, 0.06887658685445786], [1586860415.5606935, 21900, 0.0680268406867981], [1586860434.8797977, 22000, 0.07452861964702606], [1586860467.2540338, 22100, 0.07655935734510422], [1586860486.2271595, 22200, 0.06176842749118805], [1586860505.2909162, 22300, 0.06716416031122208], [1586860524.276893, 22400, 0.06785479187965393], [1586860543.332881, 22500, 0.07424811273813248], [1586860576.4259934, 22600, 0.06808099150657654], [1586860595.5591688, 22700, 0.05949807167053223], [1586860614.610384, 22800, 0.06361038237810135], [1586860633.7661633, 22900, 0.06452769041061401], [1586860653.167433, 23000, 0.0663481280207634], [1586860684.9675882, 23100, 0.07129412144422531], [1586860703.9866424, 23200, 0.06265570968389511], [1586860722.9855385, 23300, 0.0585159957408905], [1586860742.931873, 23400, 0.00907827541232109], [1586860761.9340951, 23500, 0.07276006042957306], [1586860794.7422423, 23600, 0.06474577635526657], [1586860813.6962628, 23700, 0.06735163927078247], [1586860832.69309, 23800, 0.0664658173918724], [1586860852.2020092, 23900, 0.06230858340859413], [1586860871.615952, 24000, 0.05880524963140488], [1586860904.6520185, 24100, 0.06348753720521927], [1586860923.6824002, 24200, 0.06652442365884781], [1586860942.6417289, 24300, 0.05967283993959427], [1586860961.6128232, 24400, 0.06218825280666351], [1586860980.605545, 24500, 0.06294576823711395], [1586861012.6938524, 24600, 0.06360466033220291], [1586861031.7260654, 24700, 0.06031560152769089], [1586861050.7097304, 24800, 0.06129829213023186], [1586861069.630944, 24900, 0.06121975928544998], [1586861088.6353917, 25000, 0.06503818929195404], [1586861121.150205, 25100, 0.06671473383903503], [1586861141.1097777, 25200, 0.01203074399381876], [1586861160.1257105, 25300, 0.07161961495876312], [1586861179.1143932, 25400, 0.06345458328723907], [1586861198.0323906, 25500, 0.06299854815006256], [1586861230.0679014, 25600, 0.06429436802864075], [1586861249.0834885, 25700, 0.05527196079492569], [1586861268.0897548, 25800, 0.06573738902807236], [1586861287.0247736, 25900, 0.058990590274333954], [1586861305.9962022, 26000, 0.06167306378483772], [1586861338.2092173, 26100, 0.05505383014678955], [1586861357.2655585, 26200, 0.054018791764974594], [1586861376.3026164, 26300, 0.05691440775990486], [1586861395.3452697, 26400, 0.05400185286998749], [1586861414.4011648, 26500, 0.06309212744235992], [1586861446.3374178, 26600, 0.0672115758061409], [1586861465.3320627, 26700, 0.0691516175866127], [1586861484.2822888, 26800, 0.06316908448934555], [1586861503.322076, 26900, 0.06731130927801132], [1586861523.2175355, 27000, 0.003850639099255204], [1586861556.0912476, 27100, 0.07732868939638138], [1586861575.1623561, 27200, 0.059520479291677475], [1586861594.1741538, 27300, 0.06344741582870483], [1586861613.1937256, 27400, 0.0596475787460804], [1586861632.2006469, 27500, 0.06625881046056747], [1586861664.4161377, 27600, 0.05574781447649002], [1586861683.4233594, 27700, 0.059391625225543976], [1586861702.415865, 27800, 0.06382133066654205], [1586861721.4558332, 27900, 0.06607775390148163], [1586861740.4417167, 28000, 0.06319694221019745], [1586861773.1696043, 28100, 0.056487660855054855], [1586861792.193184, 28200, 0.059227488934993744], [1586861811.1550922, 28300, 0.06692447513341904], [1586861830.1686292, 28400, 0.059689175337553024], [1586861849.215678, 28500, 0.06270072609186172], [1586861882.4574022, 28600, 0.06585275381803513], [1586861901.4854908, 28700, 0.061893630772829056], [1586861921.3134134, 28800, 0.003224932821467519], [1586861940.2247329, 28900, 0.06814733147621155], [1586861959.2855008, 29000, 0.06590426713228226], [1586861991.4698875, 29100, 0.06219813972711563], [1586862010.438649, 29200, 0.06307253241539001], [1586862029.4104924, 29300, 0.06567513942718506], [1586862048.5560822, 29400, 0.06025150418281555], [1586862067.7062018, 29500, 0.057795897126197815], [1586862099.8378408, 29600, 0.056851208209991455], [1586862118.8382876, 29700, 0.058624882251024246], [1586862138.0579154, 29800, 0.0687674805521965], [1586862156.9831274, 29900, 0.06056758016347885], [1586862176.012537, 30000, 0.05919676274061203]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140-5fpv_face-scale_size-224_seed-41-tag-val_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586855753.4898949, 500, 0.5913429856300354], [1586855860.834727, 1000, 0.489700049161911], [1586855968.472943, 1500, 0.42119893431663513], [1586856078.4728582, 2000, 0.4052170217037201], [1586856187.61801, 2500, 0.39634969830513], [1586856297.3383112, 3000, 0.3941643238067627], [1586856406.4035432, 3500, 0.3975312113761902], [1586856517.43211, 4000, 0.41664326190948486], [1586856626.2852755, 4500, 0.4228699207305908], [1586856735.3614302, 5000, 0.44283750653266907], [1586856844.9947233, 5500, 0.46645087003707886], [1586856954.7129483, 6000, 0.47724491357803345], [1586857063.495904, 6500, 0.5347045063972473], [1586857172.2421148, 7000, 0.6051840782165527], [1586857282.353857, 7500, 0.5849719047546387], [1586857391.6477695, 8000, 0.5616219639778137], [1586857501.1290805, 8500, 0.6344056129455566], [1586857611.0490835, 9000, 0.6242844462394714], [1586857720.708366, 9500, 0.5892626643180847], [1586857829.9197524, 10000, 0.6214215755462646], [1586857938.621284, 10500, 0.6473310589790344], [1586858048.7567942, 11000, 0.64483243227005], [1586858157.5656965, 11500, 0.6412574052810669], [1586858266.1664286, 12000, 0.6745819449424744], [1586858375.4774513, 12500, 0.6388399004936218], [1586858485.9520068, 13000, 0.6752983331680298], [1586858595.088391, 13500, 0.607446014881134], [1586858703.4892004, 14000, 0.6174718141555786], [1586858813.9049878, 14500, 0.6428363919258118], [1586858923.3091784, 15000, 0.6623255610466003], [1586859032.4500592, 15500, 0.6652936935424805], [1586859141.2727842, 16000, 0.6475540399551392], [1586859250.6451323, 16500, 0.667614758014679], [1586859359.597674, 17000, 0.7071119546890259], [1586859468.3170702, 17500, 0.6326817870140076], [1586859578.1637998, 18000, 0.670319676399231], [1586859686.9138956, 18500, 0.6475911736488342], [1586859795.246726, 19000, 0.7274701595306396], [1586859903.3615372, 19500, 0.7057546973228455], [1586860012.7915556, 20000, 0.7394744753837585], [1586860121.1757455, 20500, 0.7149475812911987], [1586860230.0695212, 21000, 0.735158383846283], [1586860338.899185, 21500, 0.6905218958854675], [1586860448.8153892, 22000, 0.7372711300849915], [1586860558.009339, 22500, 0.6879163384437561], [1586860666.5111995, 23000, 0.6793884038925171], [1586860776.3120482, 23500, 0.7160317897796631], [1586860886.2001224, 24000, 0.7787652015686035], [1586860994.2090192, 24500, 0.7345258593559265], [1586861102.7038214, 25000, 0.7616718411445618], [1586861211.5560758, 25500, 0.7457313537597656], [1586861319.6859777, 26000, 0.7749032974243164], [1586861427.9017248, 26500, 0.7300410866737366], [1586861537.694948, 27000, 0.7247987389564514], [1586861646.0091102, 27500, 0.688856303691864], [1586861754.742134, 28000, 0.76389479637146], [1586861864.060306, 28500, 0.7217063903808594], [1586861973.0571952, 29000, 0.7580336332321167], [1586862081.3869693, 29500, 0.7167937159538269], [1586862190.570008, 30000, 0.7633118033409119]]
|
models/icpr2020dfdc/notebook/fpv/run-binclass_net-Xception_traindb-ff-c23-720-140-140_face-scale_size-224_seed-41-tag-train_loss.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[[1586291975.3201704, 100, 0.6679831743240356], [1586291993.4304955, 200, 0.6158567667007446], [1586292011.4871294, 300, 0.5648106932640076], [1586292029.7209146, 400, 0.5261803269386292], [1586292047.7381198, 500, 0.5064586997032166], [1586292082.7574108, 600, 0.4846850335597992], [1586292101.3131156, 700, 0.47369569540023804], [1586292120.4167633, 800, 0.45889729261398315], [1586292139.5032618, 900, 0.45369794964790344], [1586292158.652202, 1000, 0.4426594376564026], [1586292190.5228245, 1100, 0.4475826919078827], [1586292209.6935933, 1200, 0.4109523892402649], [1586292228.8628347, 1300, 0.40717852115631104], [1586292248.010621, 1400, 0.4065929055213928], [1586292267.177021, 1500, 0.3944239616394043], [1586292301.4895525, 1600, 0.3885843753814697], [1586292320.8012352, 1700, 0.3976536691188812], [1586292340.0818179, 1800, 0.39134231209754944], [1586292359.2144434, 1900, 0.37072649598121643], [1586292378.5321574, 2000, 0.3631998300552368], [1586292413.0321758, 2100, 0.363435834646225], [1586292432.3253937, 2200, 0.3692517876625061], [1586292451.280449, 2300, 0.34883278608322144], [1586292470.4023328, 2400, 0.3394226133823395], [1586292489.444125, 2500, 0.34220004081726074], [1586292521.2827551, 2600, 0.3281291723251343], [1586292540.2641757, 2700, 0.32381051778793335], [1586292559.3953867, 2800, 0.3158336281776428], [1586292578.4671495, 2900, 0.3129231035709381], [1586292597.521241, 3000, 0.31909453868865967], [1586292629.5400624, 3100, 0.29868295788764954], [1586292648.5060334, 3200, 0.30356645584106445], [1586292667.3931296, 3300, 0.3109613358974457], [1586292686.3985639, 3400, 0.28664126992225647], [1586292705.4842439, 3500, 0.2953551113605499], [1586292737.2322233, 3600, 0.29382607340812683], [1586292756.2063854, 3700, 0.2925931215286255], [1586292775.3083658, 3800, 0.29135724902153015], [1586292794.3485641, 3900, 0.27739593386650085], [1586292813.253063, 4000, 0.28777965903282166], [1586292845.6021702, 4100, 0.2773849368095398], [1586292864.566264, 4200, 0.2821083664894104], [1586292883.6402514, 4300, 0.274941623210907], [1586292902.5700881, 4400, 0.26023903489112854], [1586292921.637407, 4500, 0.2700675427913666], [1586292953.430946, 4600, 0.25430724024772644], [1586292972.394041, 4700, 0.2767929434776306], [1586292991.31508, 4800, 0.26018592715263367], [1586293010.3274946, 4900, 0.2641461491584778], [1586293029.3466687, 5000, 0.2688980996608734], [1586293061.5362453, 5100, 0.24515050649642944], [1586293080.8287745, 5200, 0.2568899989128113], [1586293099.9629261, 5300, 0.23996222019195557], [1586293119.0036983, 5400, 0.24424248933792114], [1586293138.313796, 5500, 0.26316407322883606], [1586293172.05125, 5600, 0.2350611537694931], [1586293191.1737726, 5700, 0.2437628209590912], [1586293210.1918266, 5800, 0.2455383986234665], [1586293229.270848, 5900, 0.22788004577159882], [1586293248.2553487, 6000, 0.24801135063171387], [1586293280.1883893, 6100, 0.23689888417720795], [1586293298.9833453, 6200, 0.23879247903823853], [1586293317.9686131, 6300, 0.22887566685676575], [1586293337.1845953, 6400, 0.2586883306503296], [1586293356.153022, 6500, 0.2292526811361313], [1586293388.187781, 6600, 0.2184494584798813], [1586293407.2480917, 6700, 0.22566339373588562], [1586293426.1024039, 6800, 0.22088776528835297], [1586293445.0817945, 6900, 0.21489301323890686], [1586293463.9886932, 7000, 0.21516656875610352], [1586293495.6052198, 7100, 0.22768722474575043], [1586293514.5303748, 7200, 0.2184179425239563], [1586293533.4854012, 7300, 0.22404402494430542], [1586293552.4882028, 7400, 0.22180131077766418], [1586293571.68406, 7500, 0.21801020205020905], [1586293605.2063575, 7600, 0.22138839960098267], [1586293624.197148, 7700, 0.21216954290866852], [1586293643.0796947, 7800, 0.19918282330036163], [1586293662.236008, 7900, 0.2110772430896759], [1586293681.1857715, 8000, 0.20901842415332794], [1586293713.153547, 8100, 0.205549418926239], [1586293732.0837512, 8200, 0.21961243450641632], [1586293751.1179285, 8300, 0.21566298604011536], [1586293770.0713162, 8400, 0.20643752813339233], [1586293788.9843647, 8500, 0.1966131180524826], [1586293820.935589, 8600, 0.20997868478298187], [1586293839.877461, 8700, 0.20776668190956116], [1586293858.8718905, 8800, 0.20099832117557526], [1586293878.26767, 8900, 0.2246607393026352], [1586293897.4495544, 9000, 0.19819983839988708], [1586293931.3632903, 9100, 0.2189931422472], [1586293950.3316958, 9200, 0.21566639840602875], [1586293969.3683298, 9300, 0.1987377256155014], [1586293988.1958709, 9400, 0.19692201912403107], [1586294007.1535046, 9500, 0.19308632612228394], [1586294038.5564282, 9600, 0.21875299513339996], [1586294057.4653323, 9700, 0.18242229521274567], [1586294076.3773384, 9800, 0.19702260196208954], [1586294095.6092527, 9900, 0.19145408272743225], [1586294114.5187867, 10000, 0.1965222954750061], [1586294145.7669315, 10100, 0.18730343878269196], [1586294164.6585057, 10200, 0.18596813082695007], [1586294183.6454792, 10300, 0.1988859474658966], [1586294202.6410127, 10400, 0.1902521848678589], [1586294221.7241688, 10500, 0.19608891010284424], [1586294255.267224, 10600, 0.19839264452457428], [1586294274.4020693, 10700, 0.17334479093551636], [1586294293.5331433, 10800, 0.1851489543914795], [1586294312.8101778, 10900, 0.1807815283536911], [1586294331.7754579, 11000, 0.17914865911006927], [1586294363.2736995, 11100, 0.1950003206729889], [1586294382.42496, 11200, 0.179718017578125], [1586294401.3059952, 11300, 0.15813234448432922], [1586294420.3388543, 11400, 0.18661315739154816], [1586294439.2811155, 11500, 0.1899346560239792], [1586294470.398258, 11600, 0.17899659276008606], [1586294489.3433242, 11700, 0.17260095477104187], [1586294508.3610096, 11800, 0.17119504511356354], [1586294527.2820847, 11900, 0.17980311810970306], [1586294546.2097719, 12000, 0.16801565885543823], [1586294577.2241004, 12100, 0.1723562479019165], [1586294596.7204335, 12200, 0.1799272745847702], [1586294615.76505, 12300, 0.17148357629776], [1586294634.6608584, 12400, 0.1752910166978836], [1586294653.5623155, 12500, 0.17005153000354767], [1586294687.2374024, 12600, 0.18733741343021393], [1586294706.4598737, 12700, 0.14731861650943756], [1586294725.2947285, 12800, 0.17867234349250793], [1586294744.1456053, 12900, 0.17619812488555908], [1586294763.0494876, 13000, 0.17761476337909698], [1586294793.4958286, 13100, 0.17225322127342224], [1586294812.4433532, 13200, 0.17791509628295898], [1586294831.3635235, 13300, 0.15435691177845], [1586294850.2931013, 13400, 0.16482801735401154], [1586294869.2239132, 13500, 0.177333265542984], [1586294900.0543754, 13600, 0.16517284512519836], [1586294919.060464, 13700, 0.1614481806755066], [1586294937.9768248, 13800, 0.1786530762910843], [1586294956.9387176, 13900, 0.1661805659532547], [1586294975.973045, 14000, 0.16953060030937195], [1586295007.1474833, 14100, 0.17149321734905243], [1586295026.0267208, 14200, 0.15513281524181366], [1586295044.9107845, 14300, 0.17495621740818024], [1586295063.7988994, 14400, 0.1653337925672531], [1586295082.967097, 14500, 0.1719500720500946], [1586295115.3697255, 14600, 0.1693984568119049], [1586295134.1645808, 14700, 0.16175854206085205], [1586295153.1010213, 14800, 0.15333591401576996], [1586295172.0281587, 14900, 0.17415498197078705], [1586295190.981562, 15000, 0.16224068403244019], [1586295221.821605, 15100, 0.16724807024002075], [1586295240.7779293, 15200, 0.17679443955421448], [1586295259.7714818, 15300, 0.1602848470211029], [1586295278.5774553, 15400, 0.16120490431785583], [1586295297.4722757, 15500, 0.1551085114479065], [1586295328.421661, 15600, 0.17098501324653625], [1586295347.3153415, 15700, 0.17656099796295166], [1586295366.1946876, 15800, 0.16733293235301971], [1586295385.0815997, 15900, 0.16061891615390778], [1586295403.9927757, 16000, 0.15829581022262573], [1586295435.2460566, 16100, 0.15878893435001373], [1586295454.1206844, 16200, 0.16997018456459045], [1586295472.97738, 16300, 0.15522775053977966], [1586295491.8956764, 16400, 0.15574531257152557], [1586295510.7904832, 16500, 0.15508447587490082], [1586295542.740398, 16600, 0.16084152460098267], [1586295561.6042936, 16700, 0.16596142947673798], [1586295580.547106, 16800, 0.164381742477417], [1586295599.4526958, 16900, 0.15149511396884918], [1586295618.3585305, 17000, 0.1695566177368164], [1586295649.8523195, 17100, 0.14629016816616058], [1586295668.692581, 17200, 0.1561884880065918], [1586295687.5589285, 17300, 0.15176017582416534], [1586295706.4732313, 17400, 0.1690753847360611], [1586295725.394172, 17500, 0.16038814187049866], [1586295756.2246156, 17600, 0.14959776401519775], [1586295775.1763668, 17700, 0.16172464191913605], [1586295794.1234627, 17800, 0.14282283186912537], [1586295812.985712, 17900, 0.15323449671268463], [1586295831.893024, 18000, 0.1577320396900177], [1586295863.5691764, 18100, 0.1456184983253479], [1586295882.4402325, 18200, 0.15752072632312775], [1586295901.3360286, 18300, 0.15942056477069855], [1586295920.2190208, 18400, 0.15724259614944458], [1586295939.2746673, 18500, 0.15555785596370697], [1586295971.1450696, 18600, 0.1655244082212448], [1586295990.064369, 18700, 0.16024744510650635], [1586296008.9411774, 18800, 0.16489803791046143], [1586296027.9496243, 18900, 0.1531676948070526], [1586296046.8781188, 19000, 0.15289856493473053], [1586296077.6947525, 19100, 0.16133493185043335], [1586296096.5184216, 19200, 0.15058298408985138], [1586296115.4511578, 19300, 0.1595984697341919], [1586296134.4015043, 19400, 0.15550783276557922], [1586296153.2737112, 19500, 0.15994244813919067], [1586296183.9885273, 19600, 0.14585313200950623], [1586296203.1253078, 19700, 0.14799053966999054], [1586296222.0372336, 19800, 0.1522814929485321], [1586296240.943597, 19900, 0.15100890398025513], [1586296259.8904414, 20000, 0.156118705868721], [1586296291.6626704, 20100, 0.15508431196212769], [1586296310.4792607, 20200, 0.1537294238805771], [1586296329.4024277, 20300, 0.1549709439277649], [1586296348.2929466, 20400, 0.15153883397579193], [1586296367.137444, 20500, 0.14185485243797302], [1586296398.6675093, 20600, 0.13985148072242737], [1586296417.6516812, 20700, 0.15476135909557343], [1586296436.5235333, 20800, 0.1524515450000763], [1586296455.489793, 20900, 0.15265633165836334], [1586296474.331155, 21000, 0.15216164290905], [1586296505.0400903, 21100, 0.1493675261735916], [1586296523.9946768, 21200, 0.15225379168987274], [1586296542.9308434, 21300, 0.15395385026931763], [1586296561.8337955, 21400, 0.15646302700042725], [1586296580.7159483, 21500, 0.15173125267028809], [1586296611.3700485, 21600, 0.17534680664539337], [1586296630.1587577, 21700, 0.15632274746894836], [1586296649.094264, 21800, 0.16222694516181946], [1586296668.003271, 21900, 0.15921665728092194], [1586296686.9309163, 22000, 0.1426924616098404], [1586296718.7288144, 22100, 0.14772026240825653], [1586296737.5297763, 22200, 0.14768382906913757], [1586296756.479941, 22300, 0.15953724086284637], [1586296775.3351538, 22400, 0.148847296833992], [1586296794.1661015, 22500, 0.15252341330051422], [1586296826.60745, 22600, 0.1486487239599228], [1586296845.3931334, 22700, 0.15626779198646545], [1586296864.2315586, 22800, 0.14999839663505554], [1586296883.115771, 22900, 0.14580413699150085], [1586296901.9773133, 23000, 0.16200527548789978], [1586296932.526891, 23100, 0.15041762590408325], [1586296951.416657, 23200, 0.16022813320159912], [1586296970.318802, 23300, 0.16377823054790497], [1586296989.1810815, 23400, 0.13556639850139618], [1586297008.1030269, 23500, 0.15097834169864655], [1586297038.849902, 23600, 0.15347877144813538], [1586297057.6794953, 23700, 0.14273636043071747], [1586297076.50446, 23800, 0.15538986027240753], [1586297095.610042, 23900, 0.16079986095428467], [1586297114.48791, 24000, 0.14918482303619385], [1586297146.720867, 24100, 0.15873757004737854], [1586297165.5776658, 24200, 0.16343086957931519], [1586297184.4593484, 24300, 0.16029122471809387], [1586297203.343794, 24400, 0.15360385179519653], [1586297222.2435784, 24500, 0.14359445869922638], [1586297253.0636563, 24600, 0.15760035812854767], [1586297272.040434, 24700, 0.1498725265264511], [1586297290.893896, 24800, 0.1508834958076477], [1586297309.8813422, 24900, 0.17922626435756683], [1586297328.985155, 25000, 0.16255995631217957], [1586297359.5636017, 25100, 0.15481621026992798], [1586297378.5013535, 25200, 0.14976654946804047], [1586297397.3270106, 25300, 0.1619918942451477], [1586297416.4046462, 25400, 0.1739489585161209], [1586297435.1997771, 25500, 0.16698548197746277], [1586297465.9806347, 25600, 0.1468023955821991], [1586297484.8348598, 25700, 0.15879495441913605], [1586297503.7206247, 25800, 0.15767799317836761], [1586297522.5670307, 25900, 0.16227740049362183], [1586297541.4218645, 26000, 0.1451282501220703], [1586297573.5115392, 26100, 0.15906114876270294], [1586297592.3238564, 26200, 0.1513485312461853], [1586297611.197523, 26300, 0.15809078514575958], [1586297630.1078656, 26400, 0.1418161243200302], [1586297648.9814003, 26500, 0.14599499106407166], [1586297679.5019228, 26600, 0.15586070716381073], [1586297698.3224914, 26700, 0.16495925188064575], [1586297717.1620646, 26800, 0.15779998898506165], [1586297736.0692012, 26900, 0.1500464677810669], [1586297754.9425461, 27000, 0.14945131540298462], [1586297785.657116, 27100, 0.15937305986881256], [1586297804.5385187, 27200, 0.15860053896903992], [1586297823.4389796, 27300, 0.15256676077842712], [1586297842.4256763, 27400, 0.1373084932565689], [1586297861.311477, 27500, 0.13307487964630127], [1586297892.1221688, 27600, 0.16003037989139557], [1586297911.0710552, 27700, 0.1336749643087387], [1586297929.8746924, 27800, 0.1546894758939743], [1586297948.6992574, 27900, 0.15752457082271576], [1586297967.5171962, 28000, 0.14812180399894714], [1586297999.2752726, 28100, 0.13231725990772247], [1586298018.1544938, 28200, 0.1415928155183792], [1586298037.0176375, 28300, 0.16109448671340942], [1586298055.9246562, 28400, 0.15276139974594116], [1586298074.9881542, 28500, 0.1602812111377716], [1586298105.5403044, 28600, 0.14477933943271637], [1586298124.4212499, 28700, 0.15168596804141998], [1586298143.1239636, 28800, 0.1619006097316742], [1586298161.894036, 28900, 0.14764513075351715], [1586298180.7258105, 29000, 0.15362757444381714], [1586298211.2442322, 29100, 0.15159744024276733], [1586298230.0811448, 29200, 0.15776127576828003], [1586298248.90585, 29300, 0.14871583878993988], [1586298267.6477737, 29400, 0.1500227004289627], [1586298286.4747803, 29500, 0.14318037033081055], [1586298317.9378018, 29600, 0.14575910568237305], [1586298336.714194, 29700, 0.1579938381910324], [1586298355.4881861, 29800, 0.1380677968263626], [1586298374.3348796, 29900, 0.14779503643512726], [1586298393.0821471, 30000, 0.14043186604976654]]
|