This code provides a simple solution based on transfer learning (ResNet50) for the camera model identification kaggle competion. The solution:
- achieves 50% accuracy on public leaderboard
- achieves 90% validation accuracy for training set and 95% accuracy for manipulated training set.
- takes about 16 hours to run on a macbook pro (no GPUs) -- most of the time is for one time computation
- the data files created by the code will take about 30 GB of space on the hard disk
The code has been tested, but there is no guarantee of correctness. If you do find bugs, please let me know.
How to use the code:
- This code uses keras/tensorflow with python 3.5 -- see the conda environment file
- Place the training data in folder data/train, place testing data in the folder data/test. The folder data/train should have 10 subdirectories corresponding to 10 camera models.
- Generate manipulated training data by running data/create_manip_data_py - this should take about one hour to run
- Extract patches and compute resnet features by running data/create_resnet.py -- this should take about 12 hours to run
- Run training and make predictions by running Network/run_network.py -- this should take about an hour
The overall solution simply computes resnet features for patches extracted from close to center of the image. We train two models, one for unaltered image and one for manipulated images and use the corresponding model to make predictions.
Hat tip to IgorMuniz (https://www.kaggle.com/igormunizims/pre-processing-for-data-augmentation) for the code for generating manipulated images.