yelusaleng / RRU-Net

Official repository for "RRU-Net: The Ringed Residual U-Net for Image Splicing Forgery Detection" (CVPRW 2019)
106 stars 17 forks source link

ValueError: could not broadcast input array from shape (3,440,440) into shape (3) #2

Closed zanbarad closed 4 years ago

zanbarad commented 4 years ago

Hello,

I am using source code of Ring Residual UNet (RRUNet) for image forgery localization. I am using CASIA v2.0 dataset. I have two separate folders for (i) training data (color image) and (ii) Ground Truth Mask.

However, I am getting the following error. I have also printed the shape of images for your reference. I have also debug the code and found that the error occurs due to the following line in train.py file: imgs = np.array([i[0] for i in b]).astype(np.float32) (Line No. 68 in train.py)

Request you to look into the error.

Shape of b[i][0] is (3, 440, 440) Shape of b[i][0] is (3, 587, 587) Shape of b[i][0] is (3, 440, 440) Shape of b[i][0] is (3, 587, 587) Traceback (most recent call last): File "train.py", line 224, in dataset=dataset) File "train.py", line 131, in train_net imgs = np.array([i[0] for i in b]).astype(np.float32) ValueError: could not broadcast input array from shape (3,440,440) into shape (3)

yelusaleng commented 4 years ago

@zanbarad hi, you need to resize the original image to 384*256*3

zanbarad commented 4 years ago

Hi,   Thank you very much for your response. We have resized the images and the problem has been solved.

 However, we are training RRU-Net on spliced images (1750 images) available in CASIA v2.0 dataset. We kept the validation dataset size equals to 20% of training data. We are using the default settings (learning rate : 0.1, Batch Size : 6, No. of epochs: 50 etc..) of RRU-Net.

   We conducted the experiments multiple times. However, we are getting highest value of the dice coefficient  to 0.26 on validation dataset. The best model (saved in result/logs/CASIA/Ringed_Res_Unet) did not perform well on test dataset (50 images).

     We also experimented by changing the value of "ft = true" so that the best model found in earlier run can be loaded (used) as starting point for next run. In this scenario also the model did not show improvement.

    Request you to provide your valuable suggestions for the same.

yelusaleng commented 4 years ago

@zanbarad , how about the loss and accuracy of training process and the validation accuaracy?

yelusaleng commented 4 years ago

@zanbarad , there is a training trick. i reduce the learning rate to one tenth after 50 epochs, lr == 0,1 in epoch 0\~50, lr == 0.01 in epoch 51\~100, lr == 0.001 in epoch 101\~150.

zanbarad commented 4 years ago

Hi, Thank you for your quick reply. I have changed the batch size from 6 to 16. In both cases (batch size of 6 and 16), there is an improvement in values of training loss and validation dice coefficient for a number of epochs. After that the values fluctuates (goes down and up in a specific range). For batch size of 16, there is a little improvement seen in the value of training accuracy (loss is reduced) and validation dice coefficient as compared to batch size of 6. I will try the suggestions given by you (change the value of learning rate after specific number of epochs) and let you know.

Once again thank you for your suggestions.

zanbarad commented 4 years ago

Hi, We did experiments by dynamically changing the learning rate (For first 50 epochs = 0.1, 51-100 = 0.01, 101 - 150 = 0.001). The best model (obtained out of multiple runs) gives the value of training loss = 0.0432 and validation coefficient = 0.6575. However, the model is not performing good on test dataset (Not generating masks for almost half number of images). Request you to provide your valuable suggestions. Waiting for your reply.

yelusaleng commented 4 years ago

@zanbarad , is your test dataset from CASIA V2.0?

zanbarad commented 4 years ago

@yelusaleng Yes, We are using CASIA v2.0 dataset for training and testing. We performed experiments using only spliced (tampered) images (excluding cut-copy-paste images) and not the authenticated (original) images for training and testing. The result of these experiments were reported to you in previous communication. Now, we are planning to perform experiments using both (spliced and authenticated) images for training and testing. We created manual masks (black image of size 384 X 256) for authenticated images. Request you to provide your valuable suggestions.

yelusaleng commented 4 years ago

i am sor about that i can't provide more suggestions for you since i don't know your actual experimental situation. simultaneously, there is a sure thing that any little difference may cause different results. i will try my best to help you if you have any questions.

zanbarad commented 4 years ago

@yelusaleng Have you used both authenticated (original) and spliced images for training and testing for the results of experiments presented in the paper titled "RRU-Net: The Ringed Residual U-Net for Image Splicing Forgery Detection"

Waiting for your reply.

yelusaleng commented 4 years ago

@zanbarad i only used tampered images for training and testing, but you can try to use the two.