Coder Social home page Coder Social logo

bnn_cammodel's Introduction

Reliable Camera Model Identification Through Uncertainty Estimation

This repo is the implementation from the following paper:

Pan, Jiarong, et al. "Reliable Camera Model Identification Through Uncertainty Estimation." 2021 IEEE International Workshop on Biometrics and Forensics (IWBF). IEEE, 2021.

If you use this implementation, please cite the following paper:

@INPROCEEDINGS{
  9465097,
  author={Pan, Jiarong and Maier, Anatol and Lorch, Benedikt and Riess, Christian},
  booktitle={2021 IEEE International Workshop on Biometrics and Forensics (IWBF)}, 
  title={Reliable Camera Model Identification Through Uncertainty Estimation}, 
  year={2021},
  pages={1-6},
  doi={10.1109/IWBF50991.2021.9465097}
}

Environment

The environment is built successfully with Anaconda, so we recommend to use it.

Alterternatively, you can use virtualenv and pip.

$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install --upgrade pip
$ pip install -r requirements.txt

File Structure

Directories

.
├── ckpts
├── data
├── logs
├── params
├── results
└── utils
  • ckpts saves the checkpoints for the trained model, you can use it for evaluation or restore your training.
  • data stores the data from Dresden and Kaggle database and their csv files.
    • name of database is prefix.
    • base suffix contains the patches for train, val and test.
    • If you set the even_database to True, it will generate files with even as suffix.
  • logs is the tensorboard directory.
  • params store the configuration file for the network training and experiments.
  • results stores the results, including log file of training and evaluation, as well as images for visulization.
  • utils stores utility functions.

Python files

├── main.py
├── model_lib.py
├── dataloader_lib.py
├── train.py
├── trainer_lib.py
├── experiment.py
└── experiment_lib.py
  • main.py loads the parameters in configuraion files and runs the program.

  • model_lib defines model architectures.

  • dataloader_lib defines dataloader to collect and load images from different dataset, it also includes function like split dataset and extract patches from images.

    • after these, the structure of directory data looks like the following:

      ├── data
      │   ├── *_base
      |   |   ├── test
      |   |   │   ├── Camera_1
      |   |   │   └── Camera_2
      |   |   ├── train
      |   |   │   ├── Camera_1
      |   |   │   └── Camera_2
      |   |   └── val
      |   |   │   ├── Camera_1
      |   |   │   └── Camera_2
      │   ├── database_name
      |   |   │   ├── Camera_1
      |   |   │   └── Camera_2
      │   └── database_name.csv
      
  • train.py builds the model and data iterators, then performs training and evaluation (optional).

  • trainer_lib provides different training schemes for different models.

  • experiment.py loads data and performs different experiments.

  • experiment_lib.py provides different experiment settings.

Utility functions:

├── data_preparation.py
├── patch.py
├── misc.py
└── visualization.py
  • data_preparation.py contains the functions that are used for decoding images building data iterator and adding post-processing effects to the images.
  • patch.py provides functions to divide a image into patches.
  • misc.py contains functions to parse arguements from command line, instantiate class specified in configuration files and write information to log file.
  • visualization.py provides function to plot histograms of predictions, ROC curve and also the histograms of weights in different layes.

Before Running

Set the parameters in the json files under the directory params.

Some parameters are worthed to notice:

"run": {
    "name": "VanillaCNN",
    "train": true,
    "evaluate": true,
    "experiment": false
}
  • train and evaluate are boolean values, you can change it to enable/disable.
  • experiment can be only set true when running the experiment.json.
"dataloader": {
    "name": "DresdenDataLoader",
    "database_image_dir": "data/dresden",
    "patch_dir": "data/dresden_base",
    "brands": ["Canon", "Canon", "Nikon", "Nikon", "Sony"],
    "models": ["Ixus70", "Ixus55", "D200", "D70", "DSC-H50"],
    "even_database": false,
}
  • name specify the class we want to use in dataloader_lib.
  • database_image_dir define the path to store the downloaded images from dataset.
  • brands and models are the brand and model information of the camera models, they should be with same size and same order.
  • even_database is to specify whether to enforce the dataset to be even for each class or not.

Run

$ bash run.sh

or you can run single file via

$ python main.py -p $PATH_OF_JSON_FILE

bnn_cammodel's People

Contributors

jiarongp avatar btlorch avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

bnn_cammodel's Issues

get data

how can i get the cam picture in this project?

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.