Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions classification/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
env
classification/network/__pycache__
classification/dataset/__pycache__
model/*
37 changes: 30 additions & 7 deletions classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,38 @@ The models were trained using the Face2Face face tracker, though the `detect_fro

Note that we provide the trained models from our paper which have not been fine-tuned for general compressed videos. You can find our used models under [this link](http://kaldir.vc.in.tum.de:/FaceForensics/models/faceforensics++_models.zip).

Setup:
Setup (requires Python 3):
- Install `virtualenv`:
```shell
pip install virtualenv
```
- Create a Python virtual environment:
```shell
virtualenv env
```
- Activate virtual environment:
1. Windows:
```shell
cd venv\Scripts
activate
cd ..\..
```
2. Lunix / Mac:
```shell
source venv/bin/activate
```
- Install required modules via `requirement.txt` file
- Download pre-trained models ([`wget`](http://gnuwin32.sourceforge.net/packages/wget.htm) allows easier download)
```shell
wget -O model/xception-b5690688.pth http://data.lip6.fr/cadene/pretrainedmodels/xception-b5690688.pth
```
- Run detection from a single video file or folder with
```shell
python detect_from_video.py
-i <path to input video or folder of videos with extenstion '.mp4' or '.avi'>
-m <path to model file, default is imagenet model
-o <path to output folder, will contain output video(s)
```
```shell
python detect_from_video.py
-i <path to input video or folder of videos with extenstion '.mp4' or '.avi'>
-m <path to model file, default is imagenet model
-o <path to output folder, will contain output video(s)
```
from the classification folder. Enable cuda with ```--cuda``` or see parameters with ```python detect_from_video.py -h```.


Expand Down
2 changes: 1 addition & 1 deletion classification/network/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def return_pytorch04_xception(pretrained=True):
model.fc = model.last_linear
del model.last_linear
state_dict = torch.load(
'/home/ondyari/.torch/models/xception-b5690688.pth')
'model/xception-b5690688.pth')
for name, weights in state_dict.items():
if 'pointwise' in name:
state_dict[name] = weights.unsqueeze(-1).unsqueeze(-1)
Expand Down
13 changes: 7 additions & 6 deletions classification/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ astor==0.7.1
certifi==2018.11.29
cffi==1.12.1
cmake==3.12.0
dlib==19.15.0
dlib==19.7.0
face-recognition==1.2.3
face-recognition-models==0.3.0
ffmpy==0.2.2
Expand All @@ -12,10 +12,10 @@ grpcio==1.14.1
h5py==2.8.0
Keras==2.2.0
Markdown==2.6.11
mkl-fft==1.0.10
mkl-random==1.0.2
mkl-fft
mkl-random
munch==2.3.2
numpy==1.16.2
numpy==1.18.1
nvidia-ml-py3==7.352.0
olefile==0.46
opencv-python==3.4.1.15
Expand All @@ -27,6 +27,7 @@ pycparser==2.19
scandir==1.7
six==1.12.0
termcolor==1.1.0
torch==1.0.1.post2
torchvision==0.2.1
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==1.3.1
torchvision==0.4.2
tqdm==4.25.0