Open FishWoWater opened 1 year ago
Hi,
Hi! Thanks for your excellent work
I am trying to train an encoder on FFHQ-256(simply downsample by 4, no other difference). I followed your instructions, using pretrained model from rosinality's pytorch (he trained a ffhq-256 generator, fid about 4.5).
The training command is:
python scripts/train.py \ --dataset_type ffhq256_encode \ --exp_dir ffhq256_runs \ --start_from_latent_avg \ --use_w_pool \ --w_discriminator_lambda 0.1 \ --progressive_start 20000 \ --id_lambda 0.5 \ --val_interval 10000 \ --max_steps 200000 \ --stylegan_size 256 \ --stylegan_weights pretrained/ffhq256.pt \ --workers 8 \ --batch_size 8 \ --test_batch_size 4 \ --test_workers 4
And the timestamp log is
Step - 0, {'d_real_loss': 0.7016021013259888, 'd_fake_loss': 0.6899294853210449, 'discriminator_loss': 1.3915315866470337, 'discriminator_r1_loss': 0.14338113367557526, 'encoder_discriminator_loss': 0.6978803277015686, 'total_delta_loss': 0.0, 'loss_id': 0.9844004511833191, 'id_improve': -0.9844004085753113, 'loss_l2': 0.3082093596458435, 'loss_lpips': 0.4985581040382385, 'loss': 1.269044041633606} **Best**: Step - 10000, Loss - 0.889 {'d_real_loss': 0.33978470489808493, 'd_fake_loss': 0.3404182106767382, 'discriminator_loss': 0.6802029153278896, 'encoder_discriminator_loss': 1.2457492366518292, 'total_delta_loss': 0.0, 'loss_id': 0.6824955214772905, 'id_improve': -0.6824955142502274, 'loss_l2': 0.1293251315823623, 'loss_lpips': 0.3671035212022918, 'loss': 0.8888306429726737} **Best**: Step - 20000, Loss - 0.824 {'d_real_loss': 0.3872227889639991, 'd_fake_loss': 0.3586013491834913, 'discriminator_loss': 0.7458241385051182, 'encoder_discriminator_loss': 1.2047405561038427, 'delta1_loss': 0.15429342092786516, 'total_delta_loss': 0.15429342092786516, 'loss_id': 0.6041845628193446, 'id_improve': -0.6041845562144049, 'loss_l2': 0.1218068499139377, 'loss_lpips': 0.34963348155362267, 'loss': 0.8241108402865274} **Best**: Step - 30000, Loss - 0.778 {'d_real_loss': 0.5012619704178402, 'd_fake_loss': 0.40082144611222403, 'discriminator_loss': 0.9020834160872868, 'encoder_discriminator_loss': 1.1313219239030565, 'delta1_loss': 14.56706987108503, 'delta2_loss': 13.702224325452532, 'delta3_loss': 4.820313121386937, 'delta4_loss': 3.9601078657422746, 'delta5_loss': 0.5990517323698317, 'delta6_loss': 0.13941717435632434, 'total_delta_loss': 37.788183977399555, 'loss_id': 0.5471724800893238, 'id_improve': -0.5471724728760975, 'loss_l2': 0.11170206224492618, 'loss_lpips': 0.3394771266664777, 'loss': 0.7775598411219461} **Best**: Step - 40000, Loss - 0.728 {'d_real_loss': 0.48103327115944455, 'd_fake_loss': 0.4874046610934394, 'discriminator_loss': 0.9684379317760468, 'encoder_discriminator_loss': 0.9751422879014696, 'delta1_loss': 18.027785672869, 'delta2_loss': 16.38810309764317, 'delta3_loss': 10.988220975603376, 'delta4_loss': 9.603871344430106, 'delta5_loss': 12.861217633928572, 'delta6_loss': 7.118343661444528, 'delta7_loss': 6.986871947424753, 'delta8_loss': 3.3474109948022024, 'delta9_loss': 4.457656445094517, 'delta10_loss': 0.2533977639164243, 'delta11_loss': 0.13834538337162564, 'total_delta_loss': 90.17122466169084, 'loss_id': 0.49378250174863, 'id_improve': -0.4937824952240501, 'loss_l2': 0.10460309387530599, 'loss_lpips': 0.3263379201207842, 'loss': 0.7281131620066507} **Best**: Step - 50000, Loss - 0.678 {'d_real_loss': 0.5183534749916622, 'd_fake_loss': 0.5005026561703001, 'discriminator_loss': 1.0188561307702746, 'encoder_discriminator_loss': 0.9508360887254987, 'delta1_loss': 17.322715874808175, 'delta2_loss': 17.556439180101666, 'delta3_loss': 13.482044838496616, 'delta4_loss': 11.044818592071532, 'delta5_loss': 15.850536167144776, 'delta6_loss': 12.353549545833042, 'delta7_loss': 11.07594022641863, 'delta8_loss': 4.813646181515285, 'delta9_loss': 10.073346173150199, 'delta10_loss': 8.56948744719369, 'delta11_loss': 4.779077777045114, 'delta12_loss': 0.4675270553486688, 'delta13_loss': 1.8025680211612156, 'total_delta_loss': 129.1916970084054, 'loss_id': 0.4211734685046332, 'id_improve': -0.4211734616256186, 'loss_l2': 0.09605733350983688, 'loss_lpips': 0.31364191617284504, 'loss': 0.6784795570032938} **Best**: Step - 60000, Loss - 0.636 {'d_real_loss': 0.5513297355685916, 'd_fake_loss': 0.5085385031189237, 'discriminator_loss': 1.0598682399477277, 'encoder_discriminator_loss': 0.9361559580053602, 'delta1_loss': 16.758544070107597, 'delta2_loss': 17.208166840689522, 'delta3_loss': 14.68115563746861, 'delta4_loss': 11.341631665366037, 'delta5_loss': 15.925338117871966, 'delta6_loss': 12.490061225346157, 'delta7_loss': 13.4336318561009, 'delta8_loss': 7.399054774965559, 'delta9_loss': 14.259773545401437, 'delta10_loss': 9.303923548017229, 'delta11_loss': 9.975248181751796, 'delta12_loss': 8.008254882540022, 'delta13_loss': 8.761321244103568, 'total_delta_loss': 159.54610540771483, 'loss_id': 0.3516254990356309, 'id_improve': -0.3516254922917911, 'loss_l2': 0.09055833426543644, 'loss_lpips': 0.3047330184493746, 'loss': 0.6356823235750199} **Best**: Step - 70000, Loss - 0.593 {'d_real_loss': 0.4899105620554515, 'd_fake_loss': 0.5946671114989689, 'discriminator_loss': 1.0845776724815368, 'encoder_discriminator_loss': 0.8194241188934871, 'delta1_loss': 15.701713750566755, 'delta2_loss': 15.855603553771973, 'delta3_loss': 14.523084532056536, 'delta4_loss': 11.026161511012486, 'delta5_loss': 16.987236520494733, 'delta6_loss': 12.915533846173968, 'delta7_loss': 16.186471403394428, 'delta8_loss': 8.280356090000698, 'delta9_loss': 17.720297581808907, 'delta10_loss': 11.157449965885707, 'delta11_loss': 11.174499346051897, 'delta12_loss': 8.392613976069859, 'delta13_loss': 9.410291743414742, 'total_delta_loss': 169.33131373814174, 'loss_id': 0.30481456025157655, 'id_improve': -0.3048145543251719, 'loss_l2': 0.0872249039539269, 'loss_lpips': 0.29753805146047047, 'loss': 0.5934713061196464} **Best**: Step - 80000, Loss - 0.573 {'d_real_loss': 0.5320783030986785, 'd_fake_loss': 0.5505050171273095, 'discriminator_loss': 1.0825833205154964, 'encoder_discriminator_loss': 0.8734664029393877, 'delta1_loss': 14.835542006901333, 'delta2_loss': 15.50957855115618, 'delta3_loss': 14.445527881622315, 'delta4_loss': 10.541336637769426, 'delta5_loss': 16.568625031607493, 'delta6_loss': 12.911964121682303, 'delta7_loss': 16.18050126865932, 'delta8_loss': 8.40610628237043, 'delta9_loss': 20.16634405844552, 'delta10_loss': 12.227433030264718, 'delta11_loss': 11.59318392780849, 'delta12_loss': 8.199862649372646, 'delta13_loss': 10.160310638155256, 'total_delta_loss': 171.74631601388114, 'loss_id': 0.26813250596182686, 'id_improve': -0.26813249921798704, 'loss_l2': 0.08477565373054573, 'loss_lpips': 0.2903721150670733, 'loss': 0.5728355088404247} **Best**: Step - 90000, Loss - 0.554 {'d_real_loss': 0.5382110259192331, 'd_fake_loss': 0.5559589345455169, 'discriminator_loss': 1.0941699616227831, 'encoder_discriminator_loss': 0.8685437455177307, 'delta1_loss': 13.954312205723355, 'delta2_loss': 14.660734062739781, 'delta3_loss': 14.89351101902553, 'delta4_loss': 11.330829843793596, 'delta5_loss': 16.576431892395018, 'delta6_loss': 13.891081099373954, 'delta7_loss': 17.982578189849853, 'delta8_loss': 9.285926962716239, 'delta9_loss': 21.561810701642717, 'delta10_loss': 13.040013064793179, 'delta11_loss': 13.401209011077881, 'delta12_loss': 9.397846788951329, 'delta13_loss': 10.52294839968, 'total_delta_loss': 180.49923312813894, 'loss_id': 0.24335204197679247, 'id_improve': -0.24335203537983555, 'loss_l2': 0.08157898154854774, 'loss_lpips': 0.2843450908746038, 'loss': 0.5536853020872389} **Best**: Step - 100000, Loss - 0.542 {'d_real_loss': 0.5272515380552837, 'd_fake_loss': 0.5641616157633917, 'discriminator_loss': 1.0914131534440177, 'encoder_discriminator_loss': 0.860555246080671, 'delta1_loss': 13.12588039289202, 'delta2_loss': 14.376826125553675, 'delta3_loss': 13.755780887603759, 'delta4_loss': 10.746911767687116, 'delta5_loss': 16.387352701459612, 'delta6_loss': 13.653101882389613, 'delta7_loss': 17.81318026951381, 'delta8_loss': 9.803610111781529, 'delta9_loss': 20.80701674216134, 'delta10_loss': 13.734557426452637, 'delta11_loss': 14.139393835885183, 'delta12_loss': 9.492880734579904, 'delta13_loss': 10.387179551260813, 'total_delta_loss': 178.2236725202288, 'loss_id': 0.2317125922526632, 'id_improve': -0.23171258582387652, 'loss_l2': 0.07942930865287781, 'loss_lpips': 0.2807707330925124, 'loss': 0.5416024549518312} **Best**: Step - 110000, Loss - 0.532 {'d_real_loss': 0.5229683432408742, 'd_fake_loss': 0.5645030341659273, 'discriminator_loss': 1.087471376623426, 'encoder_discriminator_loss': 0.8669003076553344, 'delta1_loss': 13.17856760787964, 'delta2_loss': 14.638441285814558, 'delta3_loss': 14.50678541292463, 'delta4_loss': 10.954528208596367, 'delta5_loss': 16.039545974731446, 'delta6_loss': 13.597764656066895, 'delta7_loss': 17.85595723615374, 'delta8_loss': 9.956944754464285, 'delta9_loss': 19.904374697004044, 'delta10_loss': 13.61887195641654, 'delta11_loss': 14.11181454031808, 'delta12_loss': 10.160802596228462, 'delta13_loss': 11.541445333753312, 'total_delta_loss': 180.06584435163225, 'loss_id': 0.22021957414490836, 'id_improve': -0.2202195677118642, 'loss_l2': 0.07623229572176933, 'loss_lpips': 0.27829292387621746, 'loss': 0.5316796271971294} **Best**: Step - 120000, Loss - 0.526 {'d_real_loss': 0.5354935176883425, 'd_fake_loss': 0.5516237240859441, 'discriminator_loss': 1.0871172411441803, 'encoder_discriminator_loss': 0.8856623258590698, 'delta1_loss': 13.212133595602854, 'delta2_loss': 13.864619135720389, 'delta3_loss': 14.271907021113805, 'delta4_loss': 11.008753874642508, 'delta5_loss': 16.03886773300171, 'delta6_loss': 13.60721917288644, 'delta7_loss': 16.764577909742084, 'delta8_loss': 10.206713019234794, 'delta9_loss': 18.711055477687292, 'delta10_loss': 13.91588458960397, 'delta11_loss': 14.358008961268833, 'delta12_loss': 10.233306737627302, 'delta13_loss': 11.43933776473999, 'total_delta_loss': 177.632385219029, 'loss_id': 0.21125927693503244, 'id_improve': -0.21125927047218596, 'loss_l2': 0.07559238938987255, 'loss_lpips': 0.27523917824881416, 'loss': 0.5255060857875007} **Best**: Step - 130000, Loss - 0.514 {'d_real_loss': 0.4935643748044968, 'd_fake_loss': 0.598879716532571, 'discriminator_loss': 1.0924440914222173, 'encoder_discriminator_loss': 0.8310897267545972, 'delta1_loss': 12.39154990223476, 'delta2_loss': 13.84753018297468, 'delta3_loss': 14.363186290740966, 'delta4_loss': 11.71942119870867, 'delta5_loss': 15.498365438733781, 'delta6_loss': 13.414395892551967, 'delta7_loss': 16.818958937508718, 'delta8_loss': 10.670224406651089, 'delta9_loss': 18.424169927869524, 'delta10_loss': 14.60775991330828, 'delta11_loss': 14.438366428375245, 'delta12_loss': 11.323090820857457, 'delta13_loss': 11.877327709742955, 'total_delta_loss': 179.39434739467075, 'loss_id': 0.20534859016963414, 'id_improve': -0.20534858368550027, 'loss_l2': 0.07514850292035512, 'loss_lpips': 0.27209438707998823, 'loss': 0.5144861546584538} **Best**: Step - 150000, Loss - 0.508 {'d_real_loss': 0.5239753640549524, 'd_fake_loss': 0.5517680752107075, 'discriminator_loss': 1.0757434394700187, 'encoder_discriminator_loss': 0.8887580646106175, 'delta1_loss': 12.069740650177001, 'delta2_loss': 14.079951566968646, 'delta3_loss': 14.173042000361852, 'delta4_loss': 11.749335427965436, 'delta5_loss': 14.612159272330148, 'delta6_loss': 13.008636927468435, 'delta7_loss': 15.921529917035784, 'delta8_loss': 10.943290007455008, 'delta9_loss': 17.283827338627407, 'delta10_loss': 13.916481563023158, 'delta11_loss': 14.731179823194232, 'delta12_loss': 10.80954455947876, 'delta13_loss': 12.081347612108503, 'total_delta_loss': 175.38006699044365, 'loss_id': 0.1946100889784949, 'id_improve': -0.19461008240921157, 'loss_l2': 0.07229039748225893, 'loss_lpips': 0.267758961047445, 'loss': 0.507754435300827} **Best**: Step - 160000, Loss - 0.505 {'d_real_loss': 0.5039711021866117, 'd_fake_loss': 0.576258687547275, 'discriminator_loss': 1.0802297898360662, 'encoder_discriminator_loss': 0.860206483398165, 'delta1_loss': 12.207271796635219, 'delta2_loss': 14.207210446493967, 'delta3_loss': 14.026682252066475, 'delta4_loss': 12.019303820473807, 'delta5_loss': 14.266081255776541, 'delta6_loss': 12.823951917375837, 'delta7_loss': 15.59526053564889, 'delta8_loss': 10.95840862601144, 'delta9_loss': 17.220220364706858, 'delta10_loss': 13.482668175833567, 'delta11_loss': 14.809888321467808, 'delta12_loss': 11.05729426084246, 'delta13_loss': 12.270133732386999, 'total_delta_loss': 174.9443760811942, 'loss_id': 0.19469832916770663, 'id_improve': -0.194698322730405, 'loss_l2': 0.0734686122408935, 'loss_lpips': 0.26669182091099874, 'loss': 0.5051807611669813} **Best**: Step - 170000, Loss - 0.501 {'d_real_loss': 0.5183321298020227, 'd_fake_loss': 0.5626954877035959, 'discriminator_loss': 1.081027617079871, 'encoder_discriminator_loss': 0.8843512642383575, 'delta1_loss': 12.164690612248013, 'delta2_loss': 14.177573647635324, 'delta3_loss': 14.265702887398856, 'delta4_loss': 12.387305819920131, 'delta5_loss': 14.584255469730921, 'delta6_loss': 12.64424515587943, 'delta7_loss': 15.637556322915213, 'delta8_loss': 11.144386197226389, 'delta9_loss': 17.150431997571673, 'delta10_loss': 13.397757482256209, 'delta11_loss': 14.69159345463344, 'delta12_loss': 11.193545652662005, 'delta13_loss': 12.40858670588902, 'total_delta_loss': 175.84763153076173, 'loss_id': 0.18966005264009747, 'id_improve': -0.1896600461091314, 'loss_l2': 0.07164329036431653, 'loss_lpips': 0.26399861147574016, 'loss': 0.5012768635920116} **Best**: Step - 180000, Loss - 0.498 {'d_real_loss': 0.5172498641695296, 'd_fake_loss': 0.561306234734399, 'discriminator_loss': 1.0785560993807657, 'encoder_discriminator_loss': 0.8802593492780413, 'delta1_loss': 11.969760142190117, 'delta2_loss': 14.058045655931744, 'delta3_loss': 14.089098889487131, 'delta4_loss': 12.452212262289864, 'delta5_loss': 14.116705338614327, 'delta6_loss': 12.722484199523926, 'delta7_loss': 15.584298207964215, 'delta8_loss': 11.326971095493862, 'delta9_loss': 16.561264398302352, 'delta10_loss': 13.668671104431152, 'delta11_loss': 14.756754652840751, 'delta12_loss': 11.274729160308837, 'delta13_loss': 12.935860809326172, 'total_delta_loss': 175.51685543387276, 'loss_id': 0.1871454393352781, 'id_improve': -0.1871454328085695, 'loss_l2': 0.07091422581885543, 'loss_lpips': 0.2631248582005501, 'loss': 0.4981161424091884} **Best**: Step - 190000, Loss - 0.497 {'d_real_loss': 0.5203464512654713, 'd_fake_loss': 0.5552760522195271, 'discriminator_loss': 1.0756225047111512, 'encoder_discriminator_loss': 0.8856716017041888, 'delta1_loss': 12.122942100524902, 'delta2_loss': 14.115172087533134, 'delta3_loss': 13.896317190442767, 'delta4_loss': 12.411240946088519, 'delta5_loss': 14.219236741202218, 'delta6_loss': 12.995988104139055, 'delta7_loss': 14.699215572902135, 'delta8_loss': 11.547245595659529, 'delta9_loss': 16.655504314967565, 'delta10_loss': 13.637474517822266, 'delta11_loss': 14.307357136317663, 'delta12_loss': 10.87007657459804, 'delta13_loss': 12.893993777683804, 'total_delta_loss': 174.37176466587613, 'loss_id': 0.18721966780935015, 'id_improve': -0.18721966129541398, 'loss_l2': 0.07035948013407843, 'loss_lpips': 0.2621722467626844, 'loss': 0.4971486291374479} **Best**: Step - 200000, Loss - 0.496 {'d_real_loss': 0.5371929698841913, 'd_fake_loss': 0.5433254551206316, 'discriminator_loss': 1.0805184250559126, 'encoder_discriminator_loss': 0.9044496844155447, 'delta1_loss': 12.002083243233818, 'delta2_loss': 13.881373910631453, 'delta3_loss': 13.722927636282785, 'delta4_loss': 12.424749132973806, 'delta5_loss': 14.241044855935233, 'delta6_loss': 12.596375752040318, 'delta7_loss': 14.28156014415196, 'delta8_loss': 11.31403621510097, 'delta9_loss': 16.612094989231654, 'delta10_loss': 13.269863793509348, 'delta11_loss': 14.12449946975708, 'delta12_loss': 11.124916054316929, 'delta13_loss': 12.755195190429687, 'total_delta_loss': 172.35072075544085, 'loss_id': 0.18548516816752297, 'id_improve': -0.1854851617046765, 'loss_l2': 0.06989605299702713, 'loss_lpips': 0.2611077668922288, 'loss': 0.4964399674449648} Step - 200000, {'d_real_loss': 0.5371929698841913, 'd_fake_loss': 0.5433254551206316, 'discriminator_loss': 1.0805184250559126, 'encoder_discriminator_loss': 0.9044496844155447, 'delta1_loss': 12.002083243233818, 'delta2_loss': 13.881373910631453, 'delta3_loss': 13.722927636282785, 'delta4_loss': 12.424749132973806, 'delta5_loss': 14.241044855935233, 'delta6_loss': 12.596375752040318, 'delta7_loss': 14.28156014415196, 'delta8_loss': 11.31403621510097, 'delta9_loss': 16.612094989231654, 'delta10_loss': 13.269863793509348, 'delta11_loss': 14.12449946975708, 'delta12_loss': 11.124916054316929, 'delta13_loss': 12.755195190429687, 'total_delta_loss': 172.35072075544085, 'loss_id': 0.18548516816752297, 'id_improve': -0.1854851617046765, 'loss_l2': 0.06989605299702713, 'loss_lpips': 0.2611077668922288, 'loss': 0.4964399674449648}
I am wondering whether the loss log is reasonable and do you have any advice on training a ffhq-256 encoder
some example inversions:
here are the logs/images/test/face at 200k iterations
Thank you very much!
Hi, did you solve your problem? I encountered a same problem with you! Thank you very much!
Hi! Thanks for your excellent work
I am trying to train an encoder on FFHQ-256(simply downsample by 4, no other difference). I followed your instructions, using pretrained model from rosinality's pytorch (he trained a ffhq-256 generator, fid about 4.5).
The training command is:
And the timestamp log is
I am wondering whether the loss log is reasonable and do you have any advice on training a ffhq-256 encoder
some example inversions:
here are the logs/images/test/face at 200k iterations
Thank you very much!