Advertisement
TheTextMaster

Faceswap train.ini file

Nov 22nd, 2020
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
INI file 21.55 KB | None | 0 0
  1. [global]
  2. # options that apply to all models
  3. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  4.  
  5. # how much of the extracted image to train on. a lower coverage will limit the model's scope to a zoomed-in central area while higher amounts can include the entire face. a trade-off exists between lower amounts given more detail versus higher amounts avoiding noticeable swap transitions. sensible values to use are:
  6. #   62.5%% spans from eyebrow to eyebrow.
  7. #   75.0%% spans from temple to temple.
  8. #   87.5%% spans from ear to ear.
  9. #   100.0%% is a mugshot.
  10. #
  11. # select a decimal number between 62.5 and 100.0
  12. # [default: 68.75]
  13. coverage = 68.75
  14.  
  15. # use icnr to tile the default initializer in a repeating pattern. this strategy is designed for pairing with sub-pixel / pixel shuffler to reduce the 'checkerboard effect' in image reconstruction.
  16. #    https://arxiv.org/ftp/arxiv/papers/1707/1707.02937.pdf
  17. #
  18. # choose from: true, false
  19. # [default: false]
  20. icnr_init = False
  21.  
  22. # use convolution aware initialization for convolutional layers. this can help eradicate the vanishing and exploding gradient problem as well as lead to higher accuracy, lower loss and faster convergence.
  23. # nb:
  24. #    this can use more vram when creating a new model so you may want to lower the batch size for the first run. the batch size can be raised again when reloading the model.
  25. #    multi-gpu is not supported for this option, so you should start the model on a single gpu. once training has started, you can stop training, enable multi-gpu and resume.
  26. #    building the model will likely take several minutes as the calculations for this initialization technique are expensive. this will only impact starting a new model.
  27. #
  28. # choose from: true, false
  29. # [default: false]
  30. conv_aware_init = False
  31.  
  32. # the optimizer to use.
  33. #    adam - adaptive moment optimization. a stochastic gradient descent method that is based on adaptive estimation of first-order and second-order moments.
  34. #    nadam - adaptive moment optimization with nesterov momentum. much like adam but uses a different formula for calculating momentum.
  35. #    rms-prop - root mean square propogation. maintains a moving (discounted) average of the square of the gradients. divides the gradient by the root of this average.
  36. #
  37. # choose from: ['adam', 'nadam', 'rms-prop']
  38. # [default: adam]
  39. optimizer = adam
  40.  
  41. # learning rate - how fast your network will learn (how large are the modifications to the model weights after one batch of training). values that are too large might result in model crashes and the inability of the model to find the best solution. values that are too small might be unable to escape from dead-ends and find the best global minimum.
  42. #
  43. # this option can be updated for existing models.
  44. # select a decimal number between 1e-06 and 0.0001
  45. # [default: 5e-05]
  46. learning_rate = 5e-05
  47.  
  48. # use reflection padding rather than zero padding with convolutions. each convolution must pad the image boundaries to maintain the proper sizing. more complex padding schemes can reduce artifacts at the border of the image.
  49. #    http://www-cs.engr.ccny.cuny.edu/~wolberg/cs470/hw/hw2_pad.txt
  50. #
  51. # choose from: true, false
  52. # [default: false]
  53. reflect_padding = False
  54.  
  55. # [nvidia only]. enable the tensorflow gpu 'allow_growth' configuration option. this option prevents tensorflow from allocating all of the gpu vram at launch but can lead to higher vram fragmentation and slower performance. should only be enabled if you are receiving errors regarding 'cudnn fails to initialize' when commencing training.
  56. #
  57. # this option can be updated for existing models.
  58. # choose from: true, false
  59. # [default: false]
  60. allow_growth = False
  61.  
  62. # [nvidia only], nvidia gpus can run operations in float16 faster than in float32. mixed precision allows you to use a mix of float16 with float32, to get the performance benefits from float16 and the numeric stability benefits from float32.
  63. #
  64. # while mixed precision will run on most nvidia models, it will only speed up training on more recent gpus. those with compute capability 7.0 or higher will see the greatest performance benefit from mixed precision because they have tensor cores. older gpus offer no math performance benefit for using mixed precision, however memory and bandwidth savings can enable some speedups. generally rtx gpus and later will offer the most benefit.
  65. #
  66. # choose from: true, false
  67. # [default: false]
  68. mixed_precision = False
  69.  
  70. # [gpu only]. the number of faces to feed through the model at once when running the convert process.
  71. #
  72. # nb: increasing this figure is unlikely to improve convert speed, however, if you are getting out of memory errors, then you may want to reduce the batch size.
  73. #
  74. # this option can be updated for existing models.
  75. # select an integer between 1 and 32
  76. # [default: 16]
  77. convert_batchsize = 16
  78.  
  79. [global.loss]
  80. # loss configuration options
  81. # loss is the mechanism by which a neural network judges how well it thinks that it is recreating a face.
  82. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  83.  
  84. # the loss function to use.
  85. #    mae - mean absolute error will guide reconstructions of each pixel towards its median value in the training dataset. robust to outliers but as a median, it can potentially ignore some infrequent image types in the dataset.
  86. #    mse - mean squared error will guide reconstructions of each pixel towards its average value in the training dataset. as an avg, it will be suspectible to outliers and typically produces slightly blurrier results.
  87. #    logcosh - log(cosh(x)) acts similiar to mse for small errors and to mae for large errors. like mse, it is very stable and prevents overshoots when errors are near zero. like mae, it is robust to outliers. nb: due to a bug in plaidml, this loss does not work on amd cards.
  88. #    smooth_l1 --- modification of the mae loss to correct two of its disadvantages. this loss has improved stability and guidance for small errors.
  89. #    l_inf_norm --- the l_inf norm will reduce the largest individual pixel error in an image. as each largest error is minimized sequentially, the overall error is improved. this loss will be extremely focused on outliers.
  90. #    ssim - structural similarity index metric is a perception-based loss that considers changes in texture, luminance, contrast, and local spatial statistics of an image. potentially delivers more realistic looking images.
  91. #    gmsd - gradient magnitude similarity deviation seeks to match the global standard deviation of the pixel to pixel differences between two images. similiar in approach to ssim. nb: this loss does not currently work on amd cards.
  92. #    pixel_gradient_difference - instead of minimizing the difference between the absolute value of each pixel in two reference images, compute the pixel to pixel spatial difference in each image and then minimize that difference between two images. allows for large color shifts,but maintains the structure of the image.
  93. #
  94. # choose from: ['mae', 'mse', 'logcosh', 'smooth_loss', 'l_inf_norm', 'ssim', 'gmsd', 'pixel_gradient_diff']
  95. # [default: ssim]
  96. loss_function = ssim
  97.  
  98. # the loss function to use when learning a mask.
  99. #    mae - mean absolute error will guide reconstructions of each pixel towards its median value in the training dataset. robust to outliers but as a median, it can potentially ignore some infrequent image types in the dataset.
  100. #    mse - mean squared error will guide reconstructions of each pixel towards its average value in the training dataset. as an avg, it will be suspectible to outliers and typically produces slightly blurrier results.
  101. #
  102. # choose from: ['mae', 'mse']
  103. # [default: mse]
  104. mask_loss_function = mse
  105.  
  106. # the amount of l2 regularization to apply as a penalty to structural similarity loss functions.
  107. #
  108. # nb: you should only adjust this if you know what you are doing!
  109. #
  110. # l2 regularization applies a penalty term to the given loss function. this penalty will only be applied if ssim or gmsd is selected for the main loss function, otherwise it is ignored.
  111. #
  112. # the value given here is as a percentage weight of the main loss function. for example:
  113. #    100 - will give equal weighting to the main loss and the penalty function.
  114. #    25 - will give the penalty function 1/4 of the weight of the main loss function.
  115. #    400 - will give the penalty function 4x as much importance as the main loss function.
  116. #    0 - disables l2 regularization altogether.
  117. #
  118. # select an integer between 0 and 400
  119. # [default: 100]
  120. l2_reg_term = 100
  121.  
  122. # the amount of priority to give to the eyes.
  123. #
  124. # the value given here is as a multiplier of the main loss score. for example:
  125. #    1 - the eyes will receive the same priority as the rest of the face.
  126. #    10 - the eyes will be given a score 10 times higher than the rest of the face.
  127. #
  128. # nb: penalized mask loss must be enable to use this option.
  129. #
  130. # this option can be updated for existing models.
  131. # select an integer between 1 and 40
  132. # [default: 3]
  133. eye_multiplier = 3
  134.  
  135. # the amount of priority to give to the mouth.
  136. #
  137. # the value given here is as a multiplier of the main loss score. for example:
  138. #    1 - the mouth will receive the same priority as the rest of the face.
  139. #    10 - the mouth will be given a score 10 times higher than the rest of the face.
  140. #
  141. # nb: penalized mask loss must be enable to use this option.
  142. #
  143. # this option can be updated for existing models.
  144. # select an integer between 1 and 40
  145. # [default: 2]
  146. mouth_multiplier = 2
  147.  
  148. # image loss function is weighted by mask presence. for areas of the image without the facial mask, reconstuction errors will be ignored while the masked face area is prioritized. may increase overall quality by focusing attention on the core face area.
  149. #
  150. # choose from: true, false
  151. # [default: true]
  152. penalized_mask_loss = True
  153.  
  154. # the mask to be used for training. if you have selected 'learn mask' or 'penalized mask loss' you must select a value other than 'none'. the required mask should have been selected as part of the extract process. if it does not exist in the alignments file then it will be generated prior to training commencing.
  155. #   none: don't use a mask.
  156. #   components: mask designed to provide facial segmentation based on the positioning of landmark locations. a convex hull is constructed around the exterior of the landmarks to create a mask.
  157. #   extended: mask designed to provide facial segmentation based on the positioning of landmark locations. a convex hull is constructed around the exterior of the landmarks and the mask is extended upwards onto the forehead.
  158. #   vgg-clear: mask designed to provide smart segmentation of mostly frontal faces clear of obstructions. profile faces and obstructions may result in sub-par performance.
  159. #   vgg-obstructed: mask designed to provide smart segmentation of mostly frontal faces. the mask model has been specifically trained to recognize some facial obstructions (hands and eyeglasses). profile faces may result in sub-par performance.
  160. #   unet-dfl: mask designed to provide smart segmentation of mostly frontal faces. the mask model has been trained by community members and will need testing for further description. profile faces may result in sub-par performance.
  161. #
  162. # choose from: ['none', 'components', 'extended', 'unet-dfl', 'vgg-clear', 'vgg-obstructed']
  163. # [default: extended]
  164. mask_type = extended
  165.  
  166. # apply gaussian blur to the mask input. this has the effect of smoothing the edges of the mask, which can help with poorly calculated masks and give less of a hard edge to the predicted mask. the size is in pixels (calculated from a 128px mask). set to 0 to not apply gaussian blur. this value should be odd, if an even number is passed in then it will be rounded to the next odd number.
  167. #
  168. # select an integer between 0 and 9
  169. # [default: 3]
  170. mask_blur_kernel = 3
  171.  
  172. # sets pixels that are near white to white and near black to black. set to 0 for off.
  173. #
  174. # select an integer between 0 and 50
  175. # [default: 4]
  176. mask_threshold = 4
  177.  
  178. # dedicate a portion of the model to learning how to duplicate the input mask. increases vram usage in exchange for learning a quick ability to try to replicate more complex mask models.
  179. #
  180. # choose from: true, false
  181. # [default: false]
  182. learn_mask = False
  183.  
  184. [model.dfl_h128]
  185. # dfl h128 model (adapted from https://github.com/iperov/deepfacelab)
  186. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  187.  
  188. # lower memory mode. set to 'true' if having issues with vram useage.
  189. # nb: models with a changed lowmem mode are not compatible with each other.
  190. #
  191. # choose from: true, false
  192. # [default: false]
  193. lowmem = False
  194.  
  195. [model.dfl_sae]
  196. # dfl sae model (adapted from https://github.com/iperov/deepfacelab)
  197. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  198.  
  199. # resolution (in pixels) of the input image to train on.
  200. # be aware larger resolution will dramatically increase vram requirements.
  201. #
  202. # must be divisible by 16.
  203. #
  204. # select an integer between 64 and 256
  205. # [default: 128]
  206. input_size = 128
  207.  
  208. # controls gradient clipping of the optimizer. can prevent model corruption at the expense of vram.
  209. #
  210. # this option can be updated for existing models.
  211. # choose from: true, false
  212. # [default: true]
  213. clipnorm = True
  214.  
  215. # model architecture:
  216. #   'df': keeps the faces more natural.
  217. #   'liae': can help fix overly different face shapes.
  218. #
  219. # choose from: ['df', 'liae']
  220. # [default: df]
  221. architecture = df
  222.  
  223. # face information is stored in autoencoder dimensions. if there are not enough dimensions then certain facial features may not be recognized.
  224. # higher number of dimensions are better, but require more vram.
  225. # set to 0 to use the architecture defaults (256 for liae, 512 for df).
  226. #
  227. # select an integer between 0 and 1024
  228. # [default: 0]
  229. autoencoder_dims = 0
  230.  
  231. # encoder dimensions per channel. higher number of encoder dimensions will help the model to recognize more facial features, but will require more vram.
  232. #
  233. # select an integer between 21 and 85
  234. # [default: 42]
  235. encoder_dims = 42
  236.  
  237. # decoder dimensions per channel. higher number of decoder dimensions will help the model to improve details, but will require more vram.
  238. #
  239. # select an integer between 10 and 85
  240. # [default: 21]
  241. decoder_dims = 21
  242.  
  243. # multiscale decoder can help to obtain better details.
  244. #
  245. # choose from: true, false
  246. # [default: false]
  247. multiscale_decoder = False
  248.  
  249. [model.dlight]
  250. # a lightweight, high resolution dfaker variant (adapted from https://github.com/dfaker/df)
  251. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  252.  
  253. # higher settings will allow learning more features such as tatoos, piercing,
  254. # and wrinkles.
  255. # strongly affects vram usage.
  256. #
  257. # choose from: ['lowmem', 'fair', 'best']
  258. # [default: best]
  259. features = best
  260.  
  261. # defines detail fidelity. lower setting can appear 'rugged' while 'good' might take onger time to train.
  262. # affects vram usage.
  263. #
  264. # choose from: ['fast', 'good']
  265. # [default: good]
  266. details = good
  267.  
  268. # output image resolution (in pixels).
  269. # be aware that larger resolution will increase vram requirements.
  270. # nb: must be either 128, 256, or 384.
  271. #
  272. # select an integer between 128 and 384
  273. # [default: 256]
  274. output_size = 256
  275.  
  276. [model.original]
  277. # original faceswap model.
  278. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  279.  
  280. # lower memory mode. set to 'true' if having issues with vram useage.
  281. # nb: models with a changed lowmem mode are not compatible with each other.
  282. #
  283. # choose from: true, false
  284. # [default: false]
  285. lowmem = False
  286.  
  287. [model.realface]
  288. # an extra detailed variant of original model.
  289. # incorporates ideas from bryanlyon and inspiration from the villain model.
  290. # requires about 6gb-8gb of vram (batchsize 8-16).
  291. #
  292. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  293.  
  294. # resolution (in pixels) of the input image to train on.
  295. # be aware larger resolution will dramatically increase vram requirements.
  296. # higher resolutions may increase prediction accuracy, but does not effect the resulting output size.
  297. # must be between 64 and 128 and be divisible by 16.
  298. #
  299. # select an integer between 64 and 128
  300. # [default: 64]
  301. input_size = 64
  302.  
  303. # output image resolution (in pixels).
  304. # be aware that larger resolution will increase vram requirements.
  305. # nb: must be between 64 and 256 and be divisible by 16.
  306. #
  307. # select an integer between 64 and 256
  308. # [default: 128]
  309. output_size = 128
  310.  
  311. # number of nodes for decoder. might affect your model's ability to learn in general.
  312. # note that: lower values will affect the ability to predict details.
  313. #
  314. # select an integer between 768 and 2048
  315. # [default: 1536]
  316. dense_nodes = 1536
  317.  
  318. # encoder convolution layer complexity. sensible ranges: 128 to 150.
  319. #
  320. # select an integer between 96 and 160
  321. # [default: 128]
  322. complexity_encoder = 128
  323.  
  324. # decoder complexity.
  325. #
  326. # select an integer between 512 and 544
  327. # [default: 512]
  328. complexity_decoder = 512
  329.  
  330. [model.unbalanced]
  331. # an unbalanced model with adjustable input size options.
  332. # this is an unbalanced model so b>a swaps may not work well
  333. #
  334. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  335.  
  336. # resolution (in pixels) of the image to train on.
  337. # be aware larger resolution will dramatically increasevram requirements.
  338. # make sure your resolution is divisible by 64 (e.g. 64, 128, 256 etc.).
  339. # nb: your faceset must be at least 1.6x larger than your required input size.
  340. # (e.g. 160 is the maximum input size for a 256x256 faceset).
  341. #
  342. # select an integer between 64 and 512
  343. # [default: 128]
  344. input_size = 128
  345.  
  346. # lower memory mode. set to 'true' if having issues with vram useage.
  347. # nb: models with a changed lowmem mode are not compatible with each other.
  348. # nb: lowmem will override cutom nodes and complexity settings.
  349. #
  350. # choose from: true, false
  351. # [default: false]
  352. lowmem = False
  353.  
  354. # controls gradient clipping of the optimizer. can prevent model corruption at the expense of vram.
  355. #
  356. # choose from: true, false
  357. # [default: true]
  358. clipnorm = True
  359.  
  360. # number of nodes for decoder. don't change this unless you know what you are doing!
  361. #
  362. # select an integer between 512 and 4096
  363. # [default: 1024]
  364. nodes = 1024
  365.  
  366. # encoder convolution layer complexity. sensible ranges: 128 to 160.
  367. #
  368. # select an integer between 64 and 1024
  369. # [default: 128]
  370. complexity_encoder = 128
  371.  
  372. # decoder a complexity.
  373. #
  374. # select an integer between 64 and 1024
  375. # [default: 384]
  376. complexity_decoder_a = 384
  377.  
  378. # decoder b complexity.
  379. #
  380. # select an integer between 64 and 1024
  381. # [default: 512]
  382. complexity_decoder_b = 512
  383.  
  384. [model.villain]
  385. # a higher resolution version of the original model by villainguy.
  386. # extremely vram heavy. don't try to run this if you have a small gpu.
  387. #
  388. # nb: unless specifically stated, values changed here will only take effect when creating a new model.
  389.  
  390. # lower memory mode. set to 'true' if having issues with vram useage.
  391. # nb: models with a changed lowmem mode are not compatible with each other.
  392. #
  393. # choose from: true, false
  394. # [default: false]
  395. lowmem = False
  396.  
  397. [trainer.original]
  398. # original trainer options.
  399. # warning: the defaults for augmentation will be fine for 99.9% of use cases. only change them if you absolutely know what you are doing!
  400.  
  401. # number of sample faces to display for each side in the preview when training.
  402. #
  403. # select an integer between 2 and 16
  404. # [default: 14]
  405. preview_images = 14
  406.  
  407. # percentage amount to randomly zoom each training image in and out.
  408. #
  409. # select an integer between 0 and 25
  410. # [default: 5]
  411. zoom_amount = 5
  412.  
  413. # percentage amount to randomly rotate each training image.
  414. #
  415. # select an integer between 0 and 25
  416. # [default: 10]
  417. rotation_range = 10
  418.  
  419. # percentage amount to randomly shift each training image horizontally and vertically.
  420. #
  421. # select an integer between 0 and 25
  422. # [default: 5]
  423. shift_range = 5
  424.  
  425. # percentage chance to randomly flip each training image horizontally.
  426. # nb: this is ignored if the 'no-flip' option is enabled
  427. #
  428. # select an integer between 0 and 75
  429. # [default: 50]
  430. flip_chance = 50
  431.  
  432. # disable warp augmentation. warping is integral to the neural network training. if you decide to disable warping, you should only do so towards the end of a model's training session.
  433. #
  434. # this option can be updated for existing models.
  435. # choose from: true, false
  436. # [default: false]
  437. disable_warp = False
  438.  
  439. # percentage amount to randomly alter the lightness of each training image.
  440. # nb: this is ignored if the 'no-flip' option is enabled
  441. #
  442. # select an integer between 0 and 75
  443. # [default: 30]
  444. color_lightness = 30
  445.  
  446. # percentage amount to randomly alter the 'a' and 'b' colors of the l*a*b* color space of each training image.
  447. # nb: this is ignored if the 'no-flip' option is enabled
  448. #
  449. # select an integer between 0 and 50
  450. # [default: 8]
  451. color_ab = 8
  452.  
  453. # percentage chance to perform contrast limited adaptive histogram equalization on each training image.
  454. # nb: this is ignored if the 'no-augment-color' option is enabled
  455. #
  456. # this option can be updated for existing models.
  457. # select an integer between 0 and 75
  458. # [default: 50]
  459. color_clahe_chance = 50
  460.  
  461. # the grid size dictates how much contrast limited adaptive histogram equalization is performed on any training image selected for clahe. contrast will be applied randomly with a gridsize of 0 up to the maximum. this value is a multiplier calculated from the training image size.
  462. # nb: this is ignored if the 'no-augment-color' option is enabled
  463. #
  464. # select an integer between 1 and 8
  465. # [default: 4]
  466. color_clahe_max_size = 4
  467.  
  468.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement