This repo is the implementation from the following paper:
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}
}
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.
├── ckpts
├── data
├── logs
├── params
├── results
└── utils
ckptssaves the checkpoints for the trained model, you can use it for evaluation or restore your training.datastores the data fromDresdenandKaggledatabase and their csv files.- name of database is prefix.
basesuffix contains the patches fortrain,valandtest.- If you set the
even_databasetoTrue, it will generate files withevenas suffix.
logsis the tensorboard directory.paramsstore the configuration file for the network training and experiments.resultsstores the results, including log file of training and evaluation, as well as images for visulization.utilsstores utility functions.
├── main.py
├── model_lib.py
├── dataloader_lib.py
├── train.py
├── trainer_lib.py
├── experiment.py
└── experiment_lib.py
-
main.pyloads the parameters in configuraion files and runs the program. -
model_libdefines model architectures. -
dataloader_libdefines 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
datalooks 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.pybuilds the model and data iterators, then performs training and evaluation (optional). -
trainer_libprovides different training schemes for different models. -
experiment.pyloads data and performs different experiments. -
experiment_lib.pyprovides different experiment settings.
Utility functions:
├── data_preparation.py
├── patch.py
├── misc.py
└── visualization.py
data_preparation.pycontains the functions that are used for decoding images building data iterator and adding post-processing effects to the images.patch.pyprovides functions to divide a image into patches.misc.pycontains functions to parse arguements from command line, instantiate class specified in configuration files and write information to log file.visualization.pyprovides function to plot histograms of predictions, ROC curve and also the histograms of weights in different layes.
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
}trainandevaluateare boolean values, you can change it to enable/disable.experimentcan be only set true when running theexperiment.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,
}namespecify the class we want to use indataloader_lib.database_image_dirdefine the path to store the downloaded images from dataset.brandsandmodelsare the brand and model information of the camera models, they should be with same size and same order.even_databaseis to specify whether to enforce the dataset to be even for each class or not.
$ bash run.shor you can run single file via
$ python main.py -p $PATH_OF_JSON_FILE