Giter Club home page Giter Club logo

lgrad's Introduction

Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection


Beijing Jiaotong University, YanShan University

overall pipeline

Reference github repository for the paper Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection. Tan CC et al., proceedings of the IEEE/CVF CVPR 2023 . If you use our code, please cite our paper:

@inproceedings{tan2023learning,
  title={Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection},
  author={Tan, Chuangchuang and Zhao, Yao and Wei, Shikui and Gu, Guanghua and Wei, Yunchao},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={12105--12114},
  year={2023}
}

Update

  • 2023.08.17 The Gradient data is released. Baidu drive
  • 2023.08.17 The Pytorch version of img2grad is released.

Environment setup

Img2grad environment: We suggest transforming the image into a gradient using the tensorflow environment in docker image nvcr.io/nvidia/tensorflow:21.02-tf1-py3 from nvidia.

Classification environment: We recommend installing the required packages by running the command:

pip install -r requirements.txt

Getting the data

Download dataset from CNNDetection.

Transform Image to Gradients

  1. Download pretrained model of stylegan, and put this <project dir>/img2grad/stylegan/networks/. Or run using
mkdir -p ./img2gad/stylegan/networks
wget https://lid-1302259812.cos.ap-nanjing.myqcloud.com/tmp/karras2019stylegan-bedrooms-256x256.pkl -O ./img2gad/stylegan/networks/karras2019stylegan-bedrooms-256x256.pkl
  1. Run using
sh ./transform_img2grad.sh {GPU-ID} {Data-Root-Dir} {Grad-Save-Dir}

Training the model

sh ./train-detector.sh {GPU-ID} {Grad-Save-Dir}

Testing the detector

Download all pretrained weight files fromhttps://drive.google.com/drive/folders/17-MAyCpMqyn4b_DFP2LekrmIgRovwoix?usp=share_link.

cd CNNDetection
CUDA_VISIBLE_DEVICES=0 python eval_test8gan.py --model_path {Model-Path}  --dataroot {Grad-Test-Path} --batch_size {BS}

Acknowledgments

This repository borrows partially from the CNNDetection, stylegan, and genforce.

lgrad's People

Contributors

chuangchuangtan 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.