NicoRahm / CGvsPhoto

Computer Graphics vs Real Photographic Images : A Deep-learning approach
MIT License
25 stars 14 forks source link

training accuracy 0.5, and didn't change #4

Open VisualMediaSec opened 6 years ago

VisualMediaSec commented 6 years ago

(tensorflow) forensics@forensics-hdu:~/CGvsPG/pycodes$ (tensorflow) forensics@forensics-hdu:~/CGvsPG/pycodes$ (tensorflow) forensics@forensics-hdu:~/CGvsPG/pycodes$ CUDA_VISIBLE_DEVICES=0 python model.py

random initialisation ... (' random seed =', 2665) config=Personal

(' tensorFlow version: ', '1.4.1') Check-points directory : /home/forensics/CGvsPG/pycodes/weights/ Summaries directory : /home/forensics/CGvsPG/pycodes/summaries/ Visualizations directory : /home/forensics/CGvsPG/pycodes/visualization/ import data : image_size = 100x100... (' number of classes :', 2, ' ', ['Real', 'CGG'])

 train data

(' ', 'Real', 20000, 'images loaded') (' ', 'CGG', 20000, 'images loaded')

 test data

(' ', 'Real', 2000, 'images loaded') (' ', 'CGG', 2000, 'images loaded')

 validation data

(' ', 'Real', 1000, 'images loaded') (' ', 'CGG', 1000, 'images loaded')

 shuffle lists ...

create model ... Model with statistics. Creating layer 1 - Shape : 5x5x3x32 Creating layer 2 - Shape : 3x3x32x32 Creating layer 3 - Shape : 3x3x32x64 Creating feature extraction layer Creating MLP setup loss function and optimizer ... test ... model created. Choose a name for the run : gogogo start session ... 2018-01-22 14:31:17.462880: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA 2018-01-22 14:31:17.716957: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.683 pciBusID: 0000:17:00.0 totalMemory: 10.91GiB freeMemory: 10.76GiB 2018-01-22 14:31:17.716987: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:17:00.0, compute capability: 6.1) variable initialization ...

Restore weight from previous session ? (y/N) : N train ... step 0, training accuracy 0.5 (2000 validations tests) saving weights in file : /home/forensics/CGvsPG/pycodes/weights/gogogo0.ckpt OK step 10, training accuracy 0.5 (2000 validations tests) step 20, training accuracy 0.5 (2000 validations tests) step 30, training accuracy 0.5 (2000 validations tests) step 40, training accuracy 0.5 (2000 validations tests) step 50, training accuracy 0.5 (2000 validations tests) step 60, training accuracy 0.5 (2000 validations tests) step 70, training accuracy 0.5 (2000 validations tests) step 80, training accuracy 0.5 (2000 validations tests) step 90, training accuracy 0.5 (2000 validations tests) step 100, training accuracy 0.5 (2000 validations tests) saving weights in file : /home/forensics/CGvsPG/pycodes/weights/gogogo100.ckpt OK (' Time last 100 batchs : ', '00:00:24') (' Remaining time : ', '01:00:57') step 110, training accuracy 0.5 (2000 validations tests) step 120, training accuracy 0.5 (2000 validations tests) step 130, training accuracy 0.5 (2000 validations tests) step 140, training accuracy 0.5 (2000 validations tests) step 150, training accuracy 0.5 (2000 validations tests) step 160, training accuracy 0.5 (2000 validations tests) step 170, training accuracy 0.5 (2000 validations tests) step 180, training accuracy 0.5 (2000 validations tests) step 190, training accuracy 0.5 (2000 validations tests) step 200, training accuracy 0.5 (2000 validations tests) saving weights in file : /home/forensics/CGvsPG/pycodes/weights/gogogo200.ckpt OK (' Time last 100 batchs : ', '00:00:24') (' Remaining time : ', '01:00:51') step 210, training accuracy 0.5 (2000 validations tests) step 220, training accuracy 0.5 (2000 validations tests) step 230, training accuracy 0.5 (2000 validations tests) step 240, training accuracy 0.5 (2000 validations tests) step 250, training accuracy 0.5 (2000 validations tests) step 260, training accuracy 0.5 (2000 validations tests) step 270, training accuracy 0.5 (2000 validations tests) step 280, training accuracy 0.5 (2000 validations tests) step 290, training accuracy 0.5 (2000 validations tests) step 300, training accuracy 0.5 (2000 validations tests) saving weights in file : /home/forensics/CGvsPG/pycodes/weights/gogogo300.ckpt OK (' Time last 100 batchs : ', '00:00:23') (' Remaining time : ', '00:57:09')

VisualMediaSec commented 6 years ago

Hi, Thanks for you works. I am trying to repeat your experiment, but the training accuracy keeps in 0.5. I think there are something wrong with the configure. So would you mind double check your codes at github and update it, which is consistent with the article (WIFS2017, Distinguishing Computer Graphics from Natural Images Using Convolution Neural Networks)? or could you tell me how to resolve the accuracy issue? Thanks again.

NicoRahm commented 6 years ago

Hi, thanks for reporting this issue. I just tried again the current implementation with the database of the paper and the default parameters: it worked fine for me. Have you changed any parameter? Could you give me the code you used for constructing the model and training it so that I can see what happened? I will try to run other tests today and I'll let you know.

VisualMediaSec commented 6 years ago

Thanks for your work. I have fixed this issue by changing the parameter.

define a single-image classifier

clf = Model(database_path, image_size, config='Personal', filters=[32, 32, 64], batch_size=50, feature_extractor='Stats', remove_context=True, remove_filter_size=5, only_green=False)

trains the classifier and test it on the testing set

clf.train(nb_train_batch=800*5, nb_test_batch=80, nb_validation_batch=40)

VisualMediaSec commented 6 years ago

Furthermore, there are several questions I want to know. What parameter do you set for the article (WIFS2017, Distinguishing Computer Graphics from Natural Images Using Convolution Neural Networks)? I want to compare my method with your work.

  1. converted RAW to JPEG format (compression rate is 95%) ?
  2. only green channel are used in the method of the wifs2017 paper?

Thanks for you work again.

NicoRahm commented 6 years ago

Hi, Can you tell me which parameter you changed in the definition of the model in order to make it work? Maybe it is an error that I can fix directly. Furthermore, if you want to use the implementation of the WIFS article, you should set remove_context = False and only_green = True. This repository includes some extensions of our work which are not published yet... To answer your questions:

  1. I answered the RAW to JPEG compression question in this issue.
  2. Yes we only used the green channel in the WIFS paper.
VisualMediaSec commented 6 years ago

in CGvsPhoto/examples/test_pipeline.py: clf.train(nb_train_batch = 1, I think it should be like the following:

define a single-image classifier

clf = Model(database_path, image_size, config='Personal', filters=[32, 64], batch_size=50, feature_extractor='Stats', remove_context=False, remove_filter_size=5, only_green=True)

trains the classifier and test it on the testing set

clf.train(nb_train_batch=800*20, nb_test_batch=40, nb_validation_batch=20)