Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameters? #1

Closed
HaruoHosoya opened this issue Dec 7, 2021 · 3 comments
Closed

parameters? #1

HaruoHosoya opened this issue Dec 7, 2021 · 3 comments

Comments

@HaruoHosoya
Copy link

I have difficulty of reproducing the results shown from README. I ran ff_training.py, get_rpr.py, and invert.py consecutively using the same versions of python/pytorch, but I got only unrecognizable noise images as reconstruction. I ran it several times but the results are similar. Did you give additional command-line arguments to these scripts?

@ukky17
Copy link
Owner

ukky17 commented Dec 7, 2021

@HaruoHosoya Thank you for the comment. I didn't give any additional arguments; I used the default parameters given in ArgumentParser and was able to generate naturalistic images.

I don't know why the program didn't work in your case, but the loss scores might be helpful to adjust the parameters, especially lambdas. For your reference, below is the output when I previously run python invert.py (with the default parameters).

test resp shape: (10000, 256, 8, 8)
test image shape: (10000, 3, 32, 32)
train resp shape: (50000, 256, 8, 8)
train image shape: (50000, 3, 32, 32)
Epoch 0, Time 238.12
  Train: 0.012796, 0.547893, 0.069729, 0.014041, 0.300302
  Test:  0.010291, 0.493790, 0.058010, 0.011365, 0.274226
Epoch 1, Time 235.47
  Train: 0.010145, 0.539667, 0.056430, 0.011249, 0.301747
  Test:  0.009722, 0.668325, 0.052899, 0.010919, 0.327969
TEpoch 2, Time 234.49
  Train: 0.009468, 0.529180, 0.052715, 0.010525, 0.307933
  Test:  0.009044, 0.522657, 0.051326, 0.010080, 0.256956
Epoch 3, Time 234.92
  Train: 0.009080, 0.524205, 0.050421, 0.010109, 0.311537
  Test:  0.009157, 0.442447, 0.050725, 0.010106, 0.291684
Epoch 4, Time 234.66
  Train: 0.008813, 0.519279, 0.048985, 0.009822, 0.315642
  Test:  0.008685, 0.483414, 0.048966, 0.009658, 0.260552
...

@HaruoHosoya
Copy link
Author

HaruoHosoya commented Dec 8, 2021

@ukky17 Thanks for reply. I show below two logs, the one using the default parameters and the other using adjusted lambda_* parameters to compensate the difference between yours and mine (the ratio loss_g/loss_d for training now looks similar to yours). The resulting images are similar and bad. I notice that, in my case, loss_d values for training and test are very different, while yours are similar. Also, in my case, loss_g doesn't decrease at all, while yours does. Any idea?

  1. using the default parameters

test resp shape: (10000, 256, 8, 8)
test image shape: (10000, 3, 32, 32)
train resp shape: (50000, 256, 8, 8)
train image shape: (50000, 3, 32, 32)
Epoch 0, Time 69.04
Train: 0.062342, 0.920429, 0.180257, 0.065065, 0.070150
Test: 0.061357, 0.916260, 0.176226, 0.064036, 0.004469
Epoch 1, Time 66.64
Train: 0.062115, 0.956813, 0.176591, 0.064838, 0.037477
Test: 0.061169, 1.052739, 0.173898, 0.063961, 0.003879
Epoch 2, Time 67.17
Train: 0.062082, 0.965750, 0.175825, 0.064806, 0.030368
Test: 0.060777, 0.863741, 0.176078, 0.063402, 0.008579
Epoch 3, Time 67.46
Train: 0.062075, 0.966654, 0.176177, 0.064803, 0.034042
Test: 0.060959, 0.954981, 0.174026, 0.063654, 0.005351
Epoch 4, Time 66.99
Train: 0.062052, 0.970124, 0.174856, 0.064771, 0.028622
Test: 0.061040, 1.082508, 0.173847, 0.063861, 0.004120
Epoch 5, Time 66.90
Train: 0.062035, 0.973467, 0.174632, 0.064755, 0.020890
Test: 0.061127, 1.007541, 0.174084, 0.063875, 0.001082
Epoch 6, Time 67.45
Train: 0.062045, 0.968793, 0.175321, 0.064767, 0.036514
Test: 0.061175, 1.041520, 0.173190, 0.063948, 0.004075
Epoch 7, Time 67.51
Train: 0.062033, 0.973549, 0.175029, 0.064757, 0.027554
Test: 0.060844, 0.989257, 0.174212, 0.063576, 0.005379
Epoch 8, Time 67.42
Train: 0.062007, 0.978004, 0.174833, 0.064734, 0.021346
Test: 0.061076, 1.053426, 0.172262, 0.063852, 0.001646
...

  1. using adjusted parameters

python invert.py --lambda_img=0.02 --lambda_adv=0.00005 --lambda_feat=0.0003
test resp shape: (10000, 256, 8, 8)
test image shape: (10000, 3, 32, 32)
train resp shape: (50000, 256, 8, 8)
train image shape: (50000, 3, 32, 32)
Epoch 0, Time 70.61
Train: 0.062621, 0.920313, 0.179995, 0.001352, 0.096919
Test: 0.061623, 1.006139, 0.174405, 0.001335, 0.019429
Epoch 1, Time 70.51
Train: 0.062315, 0.963888, 0.175787, 0.001347, 0.036341
Test: 0.060994, 1.037385, 0.173458, 0.001324, 0.008299
Epoch 2, Time 70.41
Train: 0.062280, 0.955017, 0.174686, 0.001346, 0.040562
Test: 0.061169, 0.975571, 0.175972, 0.001325, 0.007981
Epoch 3, Time 68.71
Train: 0.062242, 0.978318, 0.174623, 0.001346, 0.041942
Test: 0.061127, 0.977562, 0.173377, 0.001323, 0.002352
Epoch 4, Time 68.49
Train: 0.062210, 0.970575, 0.173272, 0.001345, 0.027981
Test: 0.060934, 1.018060, 0.173111, 0.001322, 0.003301
Epoch 5, Time 68.62
Train: 0.062224, 0.972491, 0.173549, 0.001345, 0.031365
Test: 0.060962, 1.112787, 0.171626, 0.001326, 0.005110
Epoch 6, Time 68.07
Train: 0.062190, 0.972276, 0.173274, 0.001344, 0.026025
Test: 0.060579, 0.934411, 0.172045, 0.001310, 0.008814
Epoch 7, Time 68.46
Train: 0.062165, 0.969345, 0.171951, 0.001343, 0.029999
Test: 0.061101, 0.908433, 0.171522, 0.001319, 0.005193
Epoch 8, Time 68.78
Train: 0.062248, 0.969179, 0.172746, 0.001345, 0.038489
Test: 0.061236, 1.065461, 0.171845, 0.001330, 0.004004
Epoch 9, Time 67.84
Train: 0.062204, 0.973345, 0.172559, 0.001345, 0.033740
Test: 0.061222, 1.016806, 0.173432, 0.001327, 0.006019
Epoch 10, Time 68.05
Train: 0.062219, 0.969613, 0.172944, 0.001345, 0.034513
Test: 0.061145, 1.009146, 0.170403, 0.001324, 0.002087
Epoch 11, Time 67.76
Train: 0.062147, 0.968081, 0.172071, 0.001343, 0.028754
Test: 0.061019, 0.990229, 0.172044, 0.001322, 0.002990
Epoch 12, Time 67.92
Train: 0.062125, 0.974244, 0.172498, 0.001343, 0.030615
Test: 0.061018, 1.023234, 0.171053, 0.001323, 0.005527
Epoch 13, Time 68.24
Train: 0.062164, 0.972657, 0.173308, 0.001344, 0.031809
Test: 0.060929, 0.911533, 0.172117, 0.001316, 0.006186
..

@ukky17
Copy link
Owner

ukky17 commented Dec 10, 2021

@HaruoHosoya In your both cases, loss_d is almost zero from the beginning, which means the generated noisy images are too easy to be classified as fake. I guess you need to increment lambda_adv (e.g., x5, x10, x100, ...) over the other lambdas to create more naturalistic images that are more challenging to the descriminator.

@ukky17 ukky17 closed this as completed Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants