Giter Site home page Giter Site logo

f3net's Introduction

Implementation of F3-Net​ : Frequency in Face Forgery Network

Note

This is a personal implementation of F3-Net , so there are lots of difference compared to the official version. To learn more details about F3-Net, please check the paper here.

Result

Model is tested on FaceForensics++ LQ data and reports AUC.

Model Paper Valid(Mine) Test(Mine)
Baseline 89.3 92.0 89.6
FAD 90.7 91.3 89.5
LFS 88.9 87.5 84.7
Both 92.8 91.0 88.6
Mix 93.3 \ \

Obviously, there's something wrong with the implementation of LFS branch and I'm working on it now.

Usage

Hyperparameter

Hyperparameters are in train.py.

Variable name Description
dataset_path The path of dataset, support FF++ only.
pretrained_path The path of pretrained Xception model.
batch_size 128 in paper.
max_epoch how many epochs to train the model.
loss_freq print loss after how many iterations
mode mode of the network, see details below.

Load a pretrained Xception

Download Xception model trained on ImageNet (through this link) or use your own pretrained Xception.

Then modify the pretrained_path variable.

Use FF++ dataset

The dataset related function is designed for FaceForensics++ dataset. Check this github repo or paper for more details of the dataset.

After preprocessing, the data should be organized as following:

|-- dataset
|   |-- train
|   |   |-- real
|   |   |	|-- 000
|   |   |	|	|-- frame0.jpg
|   |   |	|	|-- frame1.jpg
|   |   |	|	|-- ...
|   |   |	|-- 001
|   |   |	|-- ...
|   |   |-- fake
|   |   	|-- Deepfakes
|   |   	|	|-- 000_167
|   |		|	|	|-- frame0.jpg
|   |		|	|	|-- frame1.jpg
|   |		|	|	|-- ...
|   |		|	|-- 001_892
|   |		|	|-- ...
|   |   	|-- Face2Face
|   |		|	|-- ...
|   |   	|-- FaceSwap
|   |   	|-- NeuralTextures
|   |-- valid
|   |	|-- real
|   |	|	|-- ...
|   |	|-- fake
|   |		|-- ...
|   |-- test
|   |	|-- ...

Model mode

There are four modes supported in F3-Net​.

Mode(string)
'FAD' Use FAD branch only.
'LFS' Use LFS branch only.
'Both' Use both of branches and concate before classification.
'Mix'(unavailable) Use both of branches and MixBlock.

Note:

Mode 'Mix' is unavailable yet. If you're interested in this part, check 'class Mixblock' in models.py.

Run

Environment:

Pytorch, torchvision, numpy, sklearn, pillow are needed.

To train the model

python train.py

Reference

Yuyang Qian, Guojun Yin, Lu Sheng, Zixuan Chen, and Jing Shao. Thinking in frequency: Face forgery detection by mining frequency-aware clues. arXiv preprint arXiv:2007.09355, 2020

Paper Link

f3net's People

Contributors

yyk-wew avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.